Skip to content

Commit e418c16

Browse files
authored
change settings page layout (#148)
1 parent a50348e commit e418c16

File tree

1 file changed

+91
-76
lines changed

1 file changed

+91
-76
lines changed

frontend/src/pages/settings.tsx

Lines changed: 91 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import {
44
Heading,
55
HStack,
66
Link,
7+
Tab,
8+
TabList,
9+
TabPanel,
10+
TabPanels,
11+
Tabs,
712
Text,
813
useDisclosure,
914
useToast,
@@ -23,6 +28,7 @@ import { useState } from "react"
2328
import superjson from "superjson"
2429
import { makeToast } from "utils"
2530
import Editor from "@monaco-editor/react"
31+
import { SectionHeader } from "components/utils/Card"
2632

2733
export const getServerSideProps: GetServerSideProps = async context => {
2834
const apiKeys = await getKeys()
@@ -119,84 +125,93 @@ const Settings = ({ keys: _keysString, metloConfig }) => {
119125
currentTab={SideNavLinkDestination.Settings}
120126
>
121127
<ContentContainer maxContentW="100rem" px="8" py="8">
122-
<VStack h="full" w="full" spacing="8">
123-
<Box w="full">
124-
<Heading fontWeight="medium" size="lg" mb="4">
125-
API Keys
126-
</Heading>
127-
<VStack
128-
w="full"
129-
alignItems="flex-start"
130-
borderWidth="1px"
131-
rounded="md"
132-
spacing="0"
133-
overflow="hidden"
134-
>
135-
<Box p="4" borderBottom="1px" borderColor="inherit" w="full">
136-
<HStack justifyContent="space-between">
137-
<Box />
138-
<Button colorScheme="blue" onClick={onOpen}>
139-
New
128+
<VStack h="full" w="full" alignItems="flex-start" spacing="0">
129+
<Heading fontWeight="medium" size="lg" mb="4">
130+
Settings
131+
</Heading>
132+
<Tabs w="full" display="flex" flexDir="column" flexGrow="1">
133+
<TabList>
134+
<Tab>
135+
<SectionHeader text="API Keys" />
136+
</Tab>
137+
<Tab>
138+
<SectionHeader text="Metlo Config" />
139+
</Tab>
140+
</TabList>
141+
<TabPanels flexGrow="1" h="full">
142+
<TabPanel px="0" overflow="auto" h="full">
143+
<VStack
144+
w="full"
145+
alignItems="flex-start"
146+
borderWidth="1px"
147+
rounded="md"
148+
spacing="0"
149+
overflow="hidden"
150+
>
151+
<Box p="4" borderBottom="1px" borderColor="inherit" w="full">
152+
<HStack justifyContent="space-between">
153+
<Box />
154+
<Button colorScheme="blue" onClick={onOpen}>
155+
New
156+
</Button>
157+
<NewKeys
158+
isOpen={isOpen}
159+
onClose={onClose}
160+
onCreate={addKey}
161+
isAddingKey={isAddingKey}
162+
/>
163+
<KeyAddedModal
164+
newKey={newKey}
165+
newKeyName={newKeyName}
166+
isOpen={isNewKeyOpen}
167+
onClose={onNewKeyClose}
168+
/>
169+
</HStack>
170+
</Box>
171+
<Box w="full">
172+
<ListKeys keys={keys} setKeys={setKeys} />
173+
</Box>
174+
</VStack>
175+
</TabPanel>
176+
<TabPanel px="0" overflow="auto" h="full">
177+
<HStack w="full" justifyContent="space-between" pb="15px">
178+
<Text>
179+
View our{" "}
180+
<Link
181+
target="_blank"
182+
color="blue"
183+
href="https://docs.metlo.com/docs/metlo-config"
184+
>
185+
docs
186+
</Link>{" "}
187+
on how to set up a metlo config.
188+
</Text>
189+
<Button
190+
colorScheme="blue"
191+
onClick={() => updateMetloConfigHandler()}
192+
isLoading={updatingMetloConfig}
193+
>
194+
Save
140195
</Button>
141-
<NewKeys
142-
isOpen={isOpen}
143-
onClose={onClose}
144-
onCreate={addKey}
145-
isAddingKey={isAddingKey}
146-
/>
147-
<KeyAddedModal
148-
newKey={newKey}
149-
newKeyName={newKeyName}
150-
isOpen={isNewKeyOpen}
151-
onClose={onNewKeyClose}
152-
/>
153196
</HStack>
154-
</Box>
155-
<Box w="full">
156-
<ListKeys keys={keys} setKeys={setKeys} />
157-
</Box>
158-
</VStack>
159-
</Box>
160-
<Box h="full" w="full">
161-
<HStack w="full" justifyContent="space-between">
162-
<Heading fontWeight="medium" size="lg" mb="4">
163-
Metlo Config
164-
</Heading>
165-
<Button
166-
colorScheme="blue"
167-
onClick={() => updateMetloConfigHandler()}
168-
isLoading={updatingMetloConfig}
169-
>
170-
Save
171-
</Button>
172-
</HStack>
173-
<Text pt="5px" pb="15px">
174-
View our{" "}
175-
<Link
176-
target="_blank"
177-
color="blue"
178-
href="https://docs.metlo.com/docs/metlo-config"
179-
>
180-
docs
181-
</Link>{" "}
182-
on how to set up a metlo config.
183-
</Text>
184-
<Box pt="2" rounded="md" h="700px" w="full" borderWidth="1px">
185-
<Editor
186-
width="100%"
187-
defaultLanguage="yaml"
188-
value={configString}
189-
onChange={val => setConfigString(val)}
190-
options={{
191-
minimap: {
192-
enabled: false,
193-
},
194-
automaticLayout: true,
195-
scrollBeyondLastLine: false,
196-
}}
197-
/>
198-
</Box>
199-
</Box>
197+
<Box pt="2" rounded="md" h="700px" w="full" borderWidth="1px">
198+
<Editor
199+
width="100%"
200+
defaultLanguage="yaml"
201+
value={configString}
202+
onChange={val => setConfigString(val)}
203+
options={{
204+
minimap: {
205+
enabled: false,
206+
},
207+
automaticLayout: true,
208+
scrollBeyondLastLine: false,
209+
}}
210+
/>
211+
</Box>
212+
</TabPanel>
213+
</TabPanels>
214+
</Tabs>
200215
</VStack>
201216
</ContentContainer>
202217
</SidebarLayoutShell>

0 commit comments

Comments
 (0)