-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
162 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...]/(explore)/explore/(interactive)/interactive/literature/[experiment-data-type]/error.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use client'; | ||
|
||
import ExperimentLiteratureHeader from '@/components/explore-section/Literature/components/ArticleList/ExperimentLiteratureHeader'; | ||
import { EXPERIMENT_DATA_TYPES } from '@/constants/explore-section/data-types/experiment-data-types'; | ||
|
||
type Props = { | ||
basePath: string; | ||
noExperimentSelected?: boolean; | ||
noBrainRegionSelected?: boolean; | ||
}; | ||
|
||
function ErrorContainer({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<div className="mx-10 mb-2 mt-12 flex h-screen w-full max-w-7xl items-start gap-x-4"> | ||
<div className="mx-10 mt-12 flex w-full flex-col">{children}</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default function LiteratureArticlesError({ | ||
basePath, | ||
noExperimentSelected, | ||
noBrainRegionSelected, | ||
}: Props) { | ||
if (noBrainRegionSelected) { | ||
return ( | ||
<ErrorContainer> | ||
<div className="m-auto self-center border p-4">Please select a brain region.</div> | ||
</ErrorContainer> | ||
); | ||
} | ||
|
||
if (noExperimentSelected) { | ||
const validExperimentTypes = Object.values(EXPERIMENT_DATA_TYPES).map( | ||
(experiment) => experiment.name | ||
); | ||
|
||
return ( | ||
<ErrorContainer> | ||
<ExperimentLiteratureHeader basePath={basePath} /> | ||
<div className="m-auto self-center border p-4"> | ||
<h3 className="text-center text-xl">No articles were found for this experiment type.</h3> | ||
<p>Please make sure that the experiment type is one of the following:</p> | ||
<br /> | ||
<ul className="m-auto w-fit list-disc self-center"> | ||
{validExperimentTypes.map((experiment) => ( | ||
<li key={experiment}>{experiment}</li> | ||
))} | ||
</ul> | ||
</div> | ||
</ErrorContainer> | ||
); | ||
} | ||
|
||
return ( | ||
<ErrorContainer> | ||
<div className="m-auto self-center border p-4"> | ||
There was an error fetching literature data for this experiment type. | ||
</div> | ||
</ErrorContainer> | ||
); | ||
} |
21 changes: 21 additions & 0 deletions
21
.../(explore)/explore/(interactive)/interactive/literature/[experiment-data-type]/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use client'; | ||
|
||
import BackToInteractiveExplorationBtn from '@/components/explore-section/BackToInteractiveExplorationBtn'; | ||
import { LabProjectLayoutProps } from '@/types/virtual-lab/layout'; | ||
import { generateVlProjectUrl } from '@/util/virtual-lab/urls'; | ||
|
||
export default function ArticleListForExperimentLayout({ | ||
children, | ||
params, | ||
}: LabProjectLayoutProps) { | ||
const vlProjectUrl = generateVlProjectUrl(params.virtualLabId, params.projectId); | ||
return ( | ||
<div className="flex h-screen overflow-y-hidden bg-white"> | ||
<BackToInteractiveExplorationBtn | ||
prefetch={false} | ||
href={`${vlProjectUrl}/explore/interactive`} | ||
/> | ||
{children} | ||
</div> | ||
); | ||
} |
53 changes: 53 additions & 0 deletions
53
...d]/(explore)/explore/(interactive)/interactive/literature/[experiment-data-type]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use client'; | ||
|
||
import { useParams } from 'next/navigation'; | ||
import { useAtom, useSetAtom } from 'jotai'; | ||
import { useQueryState } from 'nuqs'; | ||
|
||
import Error from './error'; | ||
import { ArticleListing as Listing } from '@/components/explore-section/Literature/components/ArticleList/ArticlesListing'; | ||
import Filters from '@/components/explore-section/Literature/components/ArticleList/ArticleListFilters'; | ||
import { | ||
articleListFiltersAtom, | ||
articleListingFilterPanelOpenAtom, | ||
initialFilters, | ||
} from '@/state/explore-section/literature-filters'; | ||
import { EXPERIMENT_DATA_TYPES } from '@/constants/explore-section/data-types/experiment-data-types'; | ||
import { generateVlProjectUrl } from '@/util/virtual-lab/urls'; | ||
|
||
export default function Page() { | ||
const params = useParams<{ | ||
virtualLabId: string; | ||
projectId: string; | ||
'experiment-data-type': string; | ||
}>(); | ||
const openFilterPanel = useSetAtom(articleListingFilterPanelOpenAtom); | ||
const [filters, updateFilters] = useAtom(articleListFiltersAtom); | ||
const [brainRegion] = useQueryState('brainRegion'); | ||
const currentExperiment = Object.values(EXPERIMENT_DATA_TYPES).find( | ||
(experiment) => experiment.name === params?.['experiment-data-type'] ?? '' | ||
); | ||
const vlProjectUrl = generateVlProjectUrl(params.virtualLabId, params.projectId); | ||
if (!currentExperiment) | ||
return ( | ||
<Error noExperimentSelected basePath={`${vlProjectUrl}/explore/interactive/literature`} /> | ||
); | ||
if (!brainRegion) | ||
return ( | ||
<Error noBrainRegionSelected basePath={`${vlProjectUrl}/explore/interactive/literature`} /> | ||
); | ||
|
||
return ( | ||
<div className="flex w-full"> | ||
<Listing basePath={`${vlProjectUrl}/explore/interactive/literature`} /> | ||
<Filters | ||
values={filters} | ||
onSubmit={updateFilters} | ||
onClearFilters={() => { | ||
updateFilters({ ...initialFilters }); | ||
openFilterPanel(false); | ||
}} | ||
/> | ||
</div> | ||
); | ||
} |
76 changes: 0 additions & 76 deletions
76
...(project)/project/[projectId]/(explore)/explore/(main)/(literature)/literature/layout.tsx
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...]/(project)/project/[projectId]/(explore)/explore/(main)/(literature)/literature/page.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters