diff --git a/packages_rs/nextclade-web/src/components/Main/DatasetCurrentSummary.tsx b/packages_rs/nextclade-web/src/components/Main/DatasetCurrentSummary.tsx
index 5e2f51ee5..042d70ec0 100644
--- a/packages_rs/nextclade-web/src/components/Main/DatasetCurrentSummary.tsx
+++ b/packages_rs/nextclade-web/src/components/Main/DatasetCurrentSummary.tsx
@@ -1,6 +1,7 @@
import React from 'react'
import { Col, Row } from 'reactstrap'
import { useRecoilValue } from 'recoil'
+import styled from 'styled-components'
import { ButtonChangeDataset } from 'src/components/Main/ButtonChangeDataset'
import { ButtonRun } from 'src/components/Main/ButtonRun'
import { useRunAnalysis } from 'src/hooks/useRunAnalysis'
@@ -8,7 +9,6 @@ import { useUpdatedDataset } from 'src/io/fetchDatasets'
import { datasetCurrentAtom } from 'src/state/dataset.state'
import { DatasetCurrentUpdateNotification } from 'src/components/Main/DatasetCurrentUpdateNotification'
import { DatasetInfo } from 'src/components/Main/DatasetInfo'
-import styled from 'styled-components'
export interface DatasetCurrentSummaryProps {
toDatasetSelection(): void
diff --git a/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx b/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx
index a9f0d71b9..31e61db27 100644
--- a/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx
+++ b/packages_rs/nextclade-web/src/components/Main/DatasetSelector.tsx
@@ -20,18 +20,6 @@ export interface DatasetSelectorProps {
onDatasetHighlighted?(dataset?: Dataset): void
}
-export function DatasetSelector({ datasetHighlighted, onDatasetHighlighted }: DatasetSelectorProps) {
- const { datasets } = useRecoilValue(datasetsAtom)
-
- return (
-
- )
-}
-
export function DatasetAutosuggestionResultsList({ datasetHighlighted, onDatasetHighlighted }: DatasetSelectorProps) {
const { datasets } = useRecoilValue(datasetsAtom)
@@ -57,28 +45,25 @@ export function DatasetAutosuggestionResultsList({ datasetHighlighted, onDataset
}, [autodetectResults, datasets])
const datasetsActive = useMemo(() => {
- if (!result) {
- return []
- }
const { itemsStartWith, itemsInclude } = result
return [...itemsStartWith, ...itemsInclude]
}, [result])
const datasetsInactive = useMemo(() => {
- if (!result) {
- return []
- }
const { itemsNotInclude } = result
return itemsNotInclude
}, [result])
+ const showSuggestions = useMemo(() => !isNil(autodetectResults) && autodetectResults.length > 0, [autodetectResults])
+
useEffect(() => {
- const topSuggestion = result?.itemsInclude[0]
+ const topSuggestion = result.itemsInclude[0]
+
if (autodetectRunState === AutodetectRunState.Done) {
onDatasetHighlighted?.(topSuggestion)
setAutodetectRunState(AutodetectRunState.Idle)
}
- }, [autodetectRunState, result?.itemsInclude, onDatasetHighlighted, setAutodetectRunState])
+ }, [autodetectRunState, result.itemsInclude, onDatasetHighlighted, setAutodetectRunState])
return (
)
}
diff --git a/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx b/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx
index 295d9321a..3d2489ae7 100644
--- a/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx
+++ b/packages_rs/nextclade-web/src/components/Main/MainInputForm.tsx
@@ -1,14 +1,18 @@
import React, { useCallback, useMemo, useState } from 'react'
+import { isNil } from 'lodash'
import { useRecoilValue } from 'recoil'
import styled from 'styled-components'
+import { hasRequiredInputsAtom } from 'src/state/inputs.state'
+import { datasetCurrentAtom } from 'src/state/dataset.state'
+import { ErrorInternal } from 'src/helpers/ErrorInternal'
import { DatasetCurrentSummary } from 'src/components/Main/DatasetCurrentSummary'
import { MainSectionTitle } from 'src/components/Main/MainSectionTitle'
import { QuerySequenceFilePicker } from 'src/components/Main/QuerySequenceFilePicker'
import { StepDatasetSelection } from 'src/components/Main/StepDatasetSelection'
-import { ErrorInternal } from 'src/helpers/ErrorInternal'
-import { datasetCurrentAtom } from 'src/state/dataset.state'
import { useUpdatedDatasetIndex } from 'src/io/fetchDatasets'
import { DatasetNoneSection } from 'src/components/Main/ButtonChangeDataset'
+import { useTranslationSafe } from 'src/helpers/useTranslationSafe'
+import { useRunSeqAutodetect } from 'src/hooks/useRunSeqAutodetect'
const Container = styled.div`
display: flex;
@@ -51,10 +55,15 @@ export enum WizardPage {
function MainWizard() {
const [page, setPage] = useState(WizardPage.Landing)
+ const runAutodetect = useRunSeqAutodetect()
+ const hasRequiredInputs = useRecoilValue(hasRequiredInputsAtom)
const toDatasetSelection = useCallback(() => {
setPage(WizardPage.DatasetSelection)
- }, [])
+ if (hasRequiredInputs) {
+ runAutodetect()
+ }
+ }, [hasRequiredInputs, runAutodetect])
const toLanding = useCallback(() => {
setPage(WizardPage.Landing)
}, [])
@@ -82,6 +91,15 @@ export interface StepLandingProps {
}
function StepLanding({ toDatasetSelection }: StepLandingProps) {
+ const { t } = useTranslationSafe()
+ const dataset = useRecoilValue(datasetCurrentAtom)
+ const text = useMemo(() => {
+ if (isNil(dataset)) {
+ return t('Select dataset')
+ }
+ return t('Selected dataset')
+ }, [dataset, t])
+
return (
@@ -91,7 +109,14 @@ function StepLanding({ toDatasetSelection }: StepLandingProps) {
)
diff --git a/packages_rs/nextclade-web/src/components/Main/StepDatasetSelection.tsx b/packages_rs/nextclade-web/src/components/Main/StepDatasetSelection.tsx
index e1a8360e1..ccd0339a5 100644
--- a/packages_rs/nextclade-web/src/components/Main/StepDatasetSelection.tsx
+++ b/packages_rs/nextclade-web/src/components/Main/StepDatasetSelection.tsx
@@ -6,7 +6,7 @@ import { useRecoilValue, useSetRecoilState } from 'recoil'
import { Row as RowBase, Col as ColBase, Button } from 'reactstrap'
import { useTranslationSafe } from 'src/helpers/useTranslationSafe'
import { datasetCurrentAtom } from 'src/state/dataset.state'
-import { DatasetSelector } from 'src/components/Main/DatasetSelector'
+import { DatasetAutosuggestionResultsList } from 'src/components/Main/DatasetSelector'
import { DatasetCurrent } from 'src/components/Main/DatasetCurrent'
export interface StepDatasetSelectionProps {
@@ -63,7 +63,7 @@ function DatasetSelection() {
-
+