From 9b385f24fc25a6bd0c9bc1e588baff0e6ff0f71c Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Thu, 28 Sep 2023 17:21:13 +0200 Subject: [PATCH] feat(web): re-add dataset customization --- .../FilePicker/FilePickerAdvanced.tsx | 2 +- .../components/Main/DatasetContentSection.tsx | 33 +++++++++++--- .../Main/DatasetContentTabAdvanced.tsx | 45 +++++++++++++++++++ .../src/components/Main/DatasetCurrent.tsx | 36 +-------------- .../src/components/Main/DatasetSelector.tsx | 3 +- .../src/components/Main/MainInputForm.tsx | 1 - .../src/components/Main/MainPage.tsx | 2 +- .../src/components/Main/WizardManualStep.tsx | 12 ++--- 8 files changed, 83 insertions(+), 51 deletions(-) create mode 100644 packages_rs/nextclade-web/src/components/Main/DatasetContentTabAdvanced.tsx diff --git a/packages_rs/nextclade-web/src/components/FilePicker/FilePickerAdvanced.tsx b/packages_rs/nextclade-web/src/components/FilePicker/FilePickerAdvanced.tsx index 0eac95b9f..c728226ac 100644 --- a/packages_rs/nextclade-web/src/components/FilePicker/FilePickerAdvanced.tsx +++ b/packages_rs/nextclade-web/src/components/FilePicker/FilePickerAdvanced.tsx @@ -37,7 +37,7 @@ export function FilePickerAdvanced() { @@ -33,6 +43,7 @@ export function DatasetContentSection() { {currentDataset?.files.changelog && } + {currentDataset && } ) @@ -68,6 +79,8 @@ const TabContent = styled(TabContentBase)` flex: 1; flex-direction: column; overflow: hidden; + + margin-top: -1px; ` const TabPane = styled(TabPaneBase)` @@ -75,8 +88,12 @@ const TabPane = styled(TabPaneBase)` flex: 1; flex-direction: column; overflow: auto; + border: 1px #ccc9 solid; - border-radius: 5px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + border-top-right-radius: 5px; + padding: 1rem; ` @@ -100,6 +117,8 @@ const NavItem = styled(NavItemBase)` border-bottom: 0 !important; + z-index: 2; + .active { font-weight: bold; background-color: ${(props) => props.theme.white} !important; diff --git a/packages_rs/nextclade-web/src/components/Main/DatasetContentTabAdvanced.tsx b/packages_rs/nextclade-web/src/components/Main/DatasetContentTabAdvanced.tsx new file mode 100644 index 000000000..dd177a0a8 --- /dev/null +++ b/packages_rs/nextclade-web/src/components/Main/DatasetContentTabAdvanced.tsx @@ -0,0 +1,45 @@ +import React from 'react' +import styled from 'styled-components' +import { FilePickerAdvanced } from 'src/components/FilePicker/FilePickerAdvanced' +import AdvancedModeExplanationContent from 'src/components/Main/AdvancedModeExplanation.mdx' + +export function DatasetContentTabAdvanced() { + return ( + +
+ + + +
+ +
+ +
+
+ ) +} + +export const AdvancedModeExplanationWrapper = styled.div` + > p { + margin: 0; + } +` + +const Container = styled.div` + display: flex; + flex: 1; + flex-direction: column; + overflow: hidden; +` + +const Header = styled.div` + flex: 0; +` + +const Main = styled.div` + display: flex; + flex: 1; + flex-direction: column; + overflow: auto; + width: 100%; +` diff --git a/packages_rs/nextclade-web/src/components/Main/DatasetCurrent.tsx b/packages_rs/nextclade-web/src/components/Main/DatasetCurrent.tsx index bca6716e6..13eb5159d 100644 --- a/packages_rs/nextclade-web/src/components/Main/DatasetCurrent.tsx +++ b/packages_rs/nextclade-web/src/components/Main/DatasetCurrent.tsx @@ -53,7 +53,7 @@ const Main = styled.div` overflow: auto; width: 100%; - margin-top: 1rem; + margin: 0.5rem 0; ` export const FlexLeft = styled.div` @@ -69,15 +69,6 @@ const ChangeButton = styled(Button)` margin-left: auto; ` -export const AdvancedModeExplanationWrapper = styled.div` - max-width: 550px; - margin-top: 0.5rem; - - > p { - margin: 0; - } -` - export function DatasetCurrent() { // Periodically checks if there's local update for the current dataset useUpdatedDataset() @@ -90,31 +81,6 @@ export function DatasetCurrent() { resetDatasetCurrent() }, [resetDatasetCurrent]) - // const [advancedOpen, setAdvancedOpen] = useState(false) - // const onCustomizeClicked = useCallback(() => setAdvancedOpen((advancedOpen) => !advancedOpen), []) - - // const customize = useMemo(() => { - // if (datasetCurrent?.path === 'autodetect') { - // return null - // } - // - // return ( - // - // - // - // - // - // - // - // - // - // - // - // - // - // ) - // }, [advancedOpen, datasetCurrent?.path, onCustomizeClicked]) - if (!datasetCurrent) { return null } diff --git a/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx b/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx index e198a7af1..52d9eed1d 100644 --- a/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx +++ b/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx @@ -186,7 +186,8 @@ const Container = styled(ContainerBase)` flex: 1; flex-direction: column; overflow: hidden; - margin-right: 10px; + margin: 0 auto; + max-width: 800px; ` const Header = styled.div` diff --git a/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx b/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx index 9713fbfa6..05bc7ddbe 100644 --- a/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx +++ b/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx @@ -26,7 +26,6 @@ const Container = styled.div` flex: 1; flex-direction: column; overflow: hidden; - margin: 0 auto; ` const Header = styled.div` diff --git a/packages_rs/nextclade-web/src/components/Main/MainPage.tsx b/packages_rs/nextclade-web/src/components/Main/MainPage.tsx index 9bc88dce4..a88d79f57 100644 --- a/packages_rs/nextclade-web/src/components/Main/MainPage.tsx +++ b/packages_rs/nextclade-web/src/components/Main/MainPage.tsx @@ -12,7 +12,7 @@ const Main = styled.div` margin: 0 auto; width: 100%; - max-width: ${(props) => props.theme.containerMaxWidths.xxl}; + max-width: 1400px; ` export function MainPage() { diff --git a/packages_rs/nextclade-web/src/components/Main/WizardManualStep.tsx b/packages_rs/nextclade-web/src/components/Main/WizardManualStep.tsx index c3c2aabaa..1af5ef2ee 100644 --- a/packages_rs/nextclade-web/src/components/Main/WizardManualStep.tsx +++ b/packages_rs/nextclade-web/src/components/Main/WizardManualStep.tsx @@ -1,12 +1,12 @@ import React from 'react' -import { Row as RowBase, Col as ColBase, Container as ContainerBase } from 'reactstrap' +import { Row as RowBase, Col as ColBase } from 'reactstrap' import styled from 'styled-components' import { QuerySequenceFilePicker } from 'src/components/Main/QuerySequenceFilePicker' import { DatasetCurrent } from 'src/components/Main/DatasetCurrent' export function WizardManualStep() { return ( - + @@ -19,7 +19,9 @@ export function WizardManualStep() { ) } -const Container = styled(ContainerBase)` +const Container = styled.div` + width: 100% !important; + @media (min-width: 991.98px) { overflow: hidden; height: 100%; @@ -27,7 +29,7 @@ const Container = styled(ContainerBase)` ` const Row = styled(RowBase)` - width: 100%; + width: 100% !important; @media (min-width: 991.98px) { overflow: hidden; @@ -36,7 +38,7 @@ const Row = styled(RowBase)` ` const Col = styled(ColBase)` - width: 100%; + width: 100% !important; @media (min-width: 991.98px) { overflow: hidden;