Skip to content

Commit

Permalink
Legacy import: styling updates
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Oct 30, 2023
1 parent 8c4a9ec commit 226d279
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 38 deletions.
19 changes: 12 additions & 7 deletions packages/web-console/src/scenes/Console/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ const Console = () => {
<Top>
<Sidebar align="top">
<PopperHover
delay={350}
placement="bottom"
trigger={
<Navigation
Expand Down Expand Up @@ -163,7 +162,6 @@ const Console = () => {
viewModes.map(({ icon, mode, tooltipText }) => (
<PopperHover
key={mode}
delay={350}
placement="right"
trigger={
<Navigation
Expand All @@ -183,12 +181,19 @@ const Console = () => {
<Tooltip>{tooltipText}</Tooltip>
</PopperHover>
))}
<PrimaryToggleButton
onClick={() => setBottomPanel("import")}
selected={bottomPanel === "import"}
<PopperHover
placement="right"
trigger={
<PrimaryToggleButton
onClick={() => setBottomPanel("import")}
selected={bottomPanel === "import"}
>
<Upload2 size={BUTTON_ICON_SIZE} />
</PrimaryToggleButton>
}
>
<Upload2 size={BUTTON_ICON_SIZE} />
</PrimaryToggleButton>
<Tooltip>Import files from CSV</Tooltip>
</PopperHover>
</Sidebar>
<Tab ref={resultRef}>
{result && <Result viewMode={resultViewMode} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const StyledTable = styled(Table)`
}
tbody td {
background: ${({ theme }) => theme.color.backgroundLighter};
background: ${({ theme }) => theme.color.backgroundDarker};
&:first-child {
border-top-left-radius: ${({ theme }) => theme.borderRadius};
Expand All @@ -46,7 +46,7 @@ const StyledTable = styled(Table)`

const EmptyState = styled(Box).attrs({ justifyContent: "center" })`
width: 100%;
background: ${({ theme }) => theme.color.backgroundLighter};
background: ${({ theme }) => theme.color.backgroundDarker};
border-radius: ${({ theme }) => theme.borderRadius};
padding: 1rem;
`
Expand Down
11 changes: 8 additions & 3 deletions packages/web-console/src/scenes/Import/ImportCSVFiles/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useRef, useState } from "react"
import styled from "styled-components"
import { Box } from "../../../components/Box"
import { DropBox } from "./dropbox"
import { FilesToUpload } from "./files-to-upload"
Expand All @@ -11,7 +12,7 @@ import * as QuestDB from "../../../utils/questdb"
import { useSelector } from "react-redux"
import { selectors } from "../../../store"
import { DEFAULT_TIMESTAMP_FORMAT, MAX_UNCOMMITTED_ROWS } from "./const"
import { useIsVisible } from "../../../components/Hooks"
import { useIsVisible } from "../../../components"
import {
extractPrecionFromGeohash,
isGeoHash,
Expand All @@ -24,6 +25,10 @@ type Props = {
onImported: (result: UploadResult) => void
}

const Root = styled(Box).attrs({ gap: "4rem", flexDirection: "column" })`
padding: 2rem;
`

export const ImportCSVFiles = ({ onImported }: Props) => {
const { quest } = useContext(QuestContext)
const [filesDropped, setFilesDropped] = useState<ProcessedFile[]>([])
Expand Down Expand Up @@ -144,7 +149,7 @@ export const ImportCSVFiles = ({ onImported }: Props) => {
}, [isVisible])

return (
<Box gap="4rem" flexDirection="column" ref={rootRef}>
<Root ref={rootRef}>
<DropBox
files={filesDropped}
onFilesDropped={handleDrop}
Expand Down Expand Up @@ -246,6 +251,6 @@ export const ImportCSVFiles = ({ onImported }: Props) => {
setFilesDropped(processedFiles)
}}
/>
</Box>
</Root>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const Inputs = styled(Box).attrs({ gap: "0", flexDirection: "column" })`

const Option = styled(Drawer.GroupItem)`
width: 100%;
&:nth-child(even) {
background: #242531;
}
`

const InputWrapper = styled.div`
Expand Down Expand Up @@ -207,7 +211,32 @@ export const UploadSettingsDialog = ({
setSettings(initialState)
onOpenChange(false)
}}
withCloseButton
afterTitle={
<Box gap="1rem">
<Button
prefixIcon={<Undo size={18} />}
skin="secondary"
onClick={() => {
setSettings(initialState)
onOpenChange(false)
}}
type="button"
>
Dismiss
</Button>

<Button
prefixIcon={<Settings4 size={18} />}
skin="success"
onClick={() => {
onSubmit(settings)
onOpenChange(false)
}}
>
Submit
</Button>
</Box>
}
>
<Drawer.ContentWrapper>
<Items>
Expand Down Expand Up @@ -273,31 +302,6 @@ export const UploadSettingsDialog = ({
</Option>
))}
</Inputs>

<Drawer.Actions>
<Button
prefixIcon={<Undo size={18} />}
skin="secondary"
onClick={() => {
setSettings(initialState)
onOpenChange(false)
}}
type="button"
>
Dismiss
</Button>

<Button
prefixIcon={<Settings4 size={18} />}
skin="success"
onClick={() => {
onSubmit(settings)
onOpenChange(false)
}}
>
Submit
</Button>
</Drawer.Actions>
</Items>
</Drawer.ContentWrapper>
</Drawer>
Expand Down

0 comments on commit 226d279

Please sign in to comment.