Skip to content

Commit 99fef48

Browse files
authored
fix(web): datastore settings styles (#3207)
1 parent e0e6390 commit 99fef48

File tree

2 files changed

+63
-39
lines changed

2 files changed

+63
-39
lines changed

web/src/components/Settings/DataStoreForm/DataStoreForm.styled.ts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
import styled, {css} from 'styled-components';
2-
import {Typography} from 'antd';
2+
import {Tabs, Typography} from 'antd';
33
import {CheckCircleOutlined} from '@ant-design/icons';
44

5+
const defaultHeight = 'calc(100vh - 106px - 48px);';
6+
57
export const FormContainer = styled.div`
68
display: grid;
79
grid-template-columns: auto 1fr;
8-
gap: 24px;
9-
min-height: 750px;
10+
height: ${defaultHeight};
11+
overflow: hidden;
1012
`;
1113

1214
export const FactoryContainer = styled.div`
1315
display: flex;
1416
flex-direction: column;
1517
padding: 22px 0;
16-
border-left: ${({theme}) => `1px solid ${theme.color.borderLight}`};
1718
justify-content: space-between;
19+
height: ${defaultHeight};
20+
overflow-y: scroll;
1821
1922
.ant-form-item {
2023
margin: 0;
@@ -28,10 +31,23 @@ export const TopContainer = styled.div`
2831
padding: 0 22px;
2932
`;
3033

31-
export const DataStoreListContainer = styled.div`
32-
display: flex;
33-
gap: 16px;
34-
flex-direction: column;
34+
export const DataStoreListContainer = styled(Tabs)`
35+
height: calc(100vh - 25px - 106px - 48px);
36+
37+
&& {
38+
.ant-tabs-content-holder {
39+
width: 1px;
40+
}
41+
42+
.ant-tabs-tab {
43+
margin: 0 !important;
44+
padding: 0;
45+
}
46+
47+
.ant-tabs-nav-list {
48+
gap: 16px;
49+
}
50+
}
3551
`;
3652

3753
export const DataStoreItemContainer = styled.div<{$isDisabled: boolean; $isSelected: boolean}>`
@@ -40,7 +56,6 @@ export const DataStoreItemContainer = styled.div<{$isDisabled: boolean; $isSelec
4056
gap: 10px;
4157
padding: 12px 22px;
4258
cursor: pointer;
43-
border-left: ${({theme, $isSelected}) => $isSelected && `2px solid ${theme.color.primary}`};
4459
4560
${({$isDisabled}) =>
4661
$isDisabled &&
@@ -95,8 +110,11 @@ export const ButtonsContainer = styled.div`
95110
justify-content: space-between;
96111
gap: 8px;
97112
margin-top: 23px;
98-
padding: 16px 22px 0;
113+
padding: 16px 22px;
99114
border-top: 1px solid ${({theme}) => theme.color.borderLight};
115+
position: sticky;
116+
bottom: 0;
117+
background: white;
100118
`;
101119

102120
export const SaveContainer = styled.div`

web/src/components/Settings/DataStoreForm/DataStoreSelectionInput.tsx

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Popover} from 'antd';
1+
import {Popover, Tabs} from 'antd';
22
import {noop} from 'lodash';
33
import {useTheme} from 'styled-components';
44
import {ConfigMode, SupportedDataStores} from 'types/DataStore.types';
@@ -26,7 +26,7 @@ const DataStoreSelectionInput = ({onChange = noop, value = SupportedDataStores.J
2626
const configuredDataStoreType = dataStoreConfig.defaultDataStore.type;
2727

2828
return (
29-
<S.DataStoreListContainer>
29+
<S.DataStoreListContainer tabPosition="left">
3030
{supportedDataStoreList.map(dataStore => {
3131
if (dataStore === SupportedDataStores.Agent && !getFlag(Flag.IsAgentDataStoreEnabled)) {
3232
return null;
@@ -35,37 +35,43 @@ const DataStoreSelectionInput = ({onChange = noop, value = SupportedDataStores.J
3535
const isSelected = value === dataStore;
3636
const isConfigured = configuredDataStoreType === dataStore && dataStoreConfig.mode === ConfigMode.READY;
3737
const isDisabled = isLocalModeEnabled && dataStore !== SupportedDataStores.Agent;
38+
3839
return (
39-
<S.DataStoreItemContainer
40-
$isDisabled={isDisabled}
41-
$isSelected={isSelected}
40+
<Tabs.TabPane
4241
key={dataStore}
43-
onClick={() => (isDisabled ? noop() : onChange(dataStore))}
44-
>
45-
<DataStoreIcon dataStoreType={dataStore} color={isSelected ? primary : text} width="22" height="22" />
46-
47-
{isDisabled ? (
48-
<Popover
49-
content={
50-
<div>
51-
In localMode only the Agent data store can be used. <br /> If you want to connect to a different
52-
data store <br /> please create a new environment
53-
</div>
54-
}
55-
placement="right"
42+
tab={
43+
<S.DataStoreItemContainer
44+
$isDisabled={isDisabled}
45+
$isSelected={isSelected}
46+
key={dataStore}
47+
onClick={() => (isDisabled ? noop() : onChange(dataStore))}
5648
>
57-
<S.DataStoreName $isSelected={isSelected}>{SupportedDataStoresToName[dataStore]}</S.DataStoreName>
58-
</Popover>
59-
) : (
60-
<S.DataStoreName $isSelected={isSelected}>{SupportedDataStoresToName[dataStore]}</S.DataStoreName>
61-
)}
49+
<DataStoreIcon dataStoreType={dataStore} color={isSelected ? primary : text} width="22" height="22" />
50+
51+
{isDisabled ? (
52+
<Popover
53+
content={
54+
<div>
55+
In localMode only the Agent data store can be used. <br /> If you want to connect to a different
56+
data store <br /> please create a new environment
57+
</div>
58+
}
59+
placement="right"
60+
>
61+
<S.DataStoreName $isSelected={isSelected}>{SupportedDataStoresToName[dataStore]}</S.DataStoreName>
62+
</Popover>
63+
) : (
64+
<S.DataStoreName $isSelected={isSelected}>{SupportedDataStoresToName[dataStore]}</S.DataStoreName>
65+
)}
6266

63-
{isConfigured && (
64-
<Popover content="This data source is currently configured" placement="right">
65-
<S.InfoIcon />
66-
</Popover>
67-
)}
68-
</S.DataStoreItemContainer>
67+
{isConfigured && (
68+
<Popover content="This data source is currently configured" placement="right">
69+
<S.InfoIcon />
70+
</Popover>
71+
)}
72+
</S.DataStoreItemContainer>
73+
}
74+
/>
6975
);
7076
})}
7177
</S.DataStoreListContainer>

0 commit comments

Comments
 (0)