-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1282 from nextstrain/fix/web-tree-page-blank
- Loading branch information
Showing
3 changed files
with
126 additions
and
114 deletions.
There are no files selected for viewing
121 changes: 12 additions & 109 deletions
121
packages_rs/nextclade-web/src/components/Tree/TreePage.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 |
---|---|---|
@@ -1,117 +1,20 @@ | ||
import React, { useMemo } from 'react' | ||
import styled from 'styled-components' | ||
import { I18nextProvider } from 'react-i18next' | ||
import { connect } from 'react-redux' | ||
import { AuspiceMetadata } from 'auspice' | ||
import type { State } from 'src/state/reducer' | ||
import i18nAuspice from 'src/i18n/i18n.auspice' | ||
import FiltersSummary from 'auspice/src/components/info/filtersSummary' | ||
import React from 'react' | ||
import dynamic from 'next/dynamic' | ||
import { Layout } from 'src/components/Layout/Layout' | ||
import { LogoGisaid as LogoGisaidBase } from 'src/components/Common/LogoGisaid' | ||
import { Tree } from 'src/components/Tree/Tree' | ||
import { Sidebar } from 'src/components/Tree/Sidebar' | ||
|
||
export const Container = styled.div` | ||
flex: 1; | ||
flex-basis: 100%; | ||
width: 100%; | ||
height: 100%; | ||
min-width: 1080px; | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: nowrap; | ||
` | ||
|
||
const MainContent = styled.main` | ||
flex: 1; | ||
flex-basis: 100%; | ||
overflow-y: hidden; | ||
` | ||
|
||
const AuspiceContainer = styled.div` | ||
display: flex; | ||
flex: 1; | ||
flex-basis: 99%; | ||
height: 100%; | ||
` | ||
|
||
const SidebarContainer = styled.div` | ||
flex: 0 0 260px; | ||
background-color: #30353f; | ||
overflow-y: auto; | ||
` | ||
|
||
const TreeContainer = styled.div` | ||
flex: 1 1; | ||
overflow-y: scroll; | ||
` | ||
|
||
const TreeTopPanel = styled.div` | ||
display: flex; | ||
` | ||
|
||
const FiltersSummaryWrapper = styled.div` | ||
flex: 1 1 100%; | ||
` | ||
|
||
const LogoGisaidWrapper = styled.div` | ||
display: flex; | ||
flex: 0 0 auto; | ||
margin: 0 auto; | ||
margin-right: 2.25rem; | ||
margin-top: 10px; | ||
` | ||
|
||
const LogoGisaid = styled(LogoGisaidBase)` | ||
margin-top: auto; | ||
` | ||
|
||
export interface TreePageProps { | ||
treeMeta?: AuspiceMetadata | ||
} | ||
|
||
const mapStateToProps = (state: State) => ({ | ||
treeMeta: state.metadata, | ||
import { LOADING } from 'src/components/Loading/Loading' | ||
|
||
const TreePageContent = dynamic(() => import('src/components/Tree/TreePageContent'), { | ||
ssr: false, | ||
loading() { | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
return <>{LOADING}</> | ||
}, | ||
}) | ||
|
||
export const TreePage = connect(mapStateToProps, null)(TreePageDisconnected) | ||
|
||
function TreePageDisconnected({ treeMeta }: TreePageProps) { | ||
const isDataFromGisaid = useMemo( | ||
() => treeMeta?.dataProvenance?.some((provenance) => provenance.name?.toLowerCase() === 'gisaid'), | ||
[treeMeta], | ||
) | ||
|
||
export function TreePage() { | ||
return ( | ||
<Layout> | ||
<Container> | ||
<MainContent> | ||
<AuspiceContainer> | ||
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} | ||
{/* @ts-ignore */} | ||
<I18nextProvider i18n={i18nAuspice}> | ||
<SidebarContainer> | ||
<Sidebar /> | ||
</SidebarContainer> | ||
<TreeContainer> | ||
<TreeTopPanel> | ||
<FiltersSummaryWrapper> | ||
<FiltersSummary /> | ||
</FiltersSummaryWrapper> | ||
{isDataFromGisaid && ( | ||
<LogoGisaidWrapper> | ||
<LogoGisaid /> | ||
</LogoGisaidWrapper> | ||
)} | ||
</TreeTopPanel> | ||
<Tree /> | ||
</TreeContainer> | ||
</I18nextProvider> | ||
</AuspiceContainer> | ||
</MainContent> | ||
</Container> | ||
<TreePageContent /> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default TreePage |
113 changes: 113 additions & 0 deletions
113
packages_rs/nextclade-web/src/components/Tree/TreePageContent.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,113 @@ | ||
import React, { useMemo } from 'react' | ||
import styled from 'styled-components' | ||
import { I18nextProvider } from 'react-i18next' | ||
import { connect } from 'react-redux' | ||
import { AuspiceMetadata } from 'auspice' | ||
import type { State } from 'src/state/reducer' | ||
import i18nAuspice from 'src/i18n/i18n.auspice' | ||
import FiltersSummary from 'auspice/src/components/info/filtersSummary' | ||
import { LogoGisaid as LogoGisaidBase } from 'src/components/Common/LogoGisaid' | ||
import { Tree } from 'src/components/Tree/Tree' | ||
import { Sidebar } from 'src/components/Tree/Sidebar' | ||
|
||
export const Container = styled.div` | ||
flex: 1; | ||
flex-basis: 100%; | ||
width: 100%; | ||
height: 100%; | ||
min-width: 1080px; | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: nowrap; | ||
` | ||
|
||
const MainContent = styled.main` | ||
flex: 1; | ||
flex-basis: 100%; | ||
overflow-y: hidden; | ||
` | ||
|
||
const AuspiceContainer = styled.div` | ||
display: flex; | ||
flex: 1; | ||
flex-basis: 99%; | ||
height: 100%; | ||
` | ||
|
||
const SidebarContainer = styled.div` | ||
flex: 0 0 260px; | ||
background-color: #30353f; | ||
overflow-y: auto; | ||
` | ||
|
||
const TreeContainer = styled.div` | ||
flex: 1 1; | ||
overflow-y: scroll; | ||
` | ||
|
||
const TreeTopPanel = styled.div` | ||
display: flex; | ||
` | ||
|
||
const FiltersSummaryWrapper = styled.div` | ||
flex: 1 1 100%; | ||
` | ||
|
||
const LogoGisaidWrapper = styled.div` | ||
display: flex; | ||
flex: 0 0 auto; | ||
margin: 0 auto; | ||
margin-right: 2.25rem; | ||
margin-top: 10px; | ||
` | ||
|
||
const LogoGisaid = styled(LogoGisaidBase)` | ||
margin-top: auto; | ||
` | ||
|
||
export interface TreePageProps { | ||
treeMeta?: AuspiceMetadata | ||
} | ||
|
||
const mapStateToProps = (state: State) => ({ | ||
treeMeta: state.metadata, | ||
}) | ||
|
||
const TreePageContent = connect(mapStateToProps, null)(TreePageContentDisconnected) | ||
export default TreePageContent | ||
|
||
function TreePageContentDisconnected({ treeMeta }: TreePageProps) { | ||
const isDataFromGisaid = useMemo( | ||
() => treeMeta?.dataProvenance?.some((provenance) => provenance.name?.toLowerCase() === 'gisaid'), | ||
[treeMeta], | ||
) | ||
|
||
return ( | ||
<Container> | ||
<MainContent> | ||
<AuspiceContainer> | ||
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} | ||
{/* @ts-ignore */} | ||
<I18nextProvider i18n={i18nAuspice}> | ||
<SidebarContainer> | ||
<Sidebar /> | ||
</SidebarContainer> | ||
<TreeContainer> | ||
<TreeTopPanel> | ||
<FiltersSummaryWrapper> | ||
<FiltersSummary /> | ||
</FiltersSummaryWrapper> | ||
{isDataFromGisaid && ( | ||
<LogoGisaidWrapper> | ||
<LogoGisaid /> | ||
</LogoGisaidWrapper> | ||
)} | ||
</TreeTopPanel> | ||
<Tree /> | ||
</TreeContainer> | ||
</I18nextProvider> | ||
</AuspiceContainer> | ||
</MainContent> | ||
</Container> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,5 +1 @@ | ||
import dynamic from 'next/dynamic' | ||
|
||
const TreePage = dynamic(() => import('src/components/Tree/TreePage'), { ssr: false }) | ||
|
||
export default TreePage | ||
export { TreePage as default } from 'src/components/Tree/TreePage' |
eb24265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nextclade – ./
nextclade.vercel.app
nextclade-nextstrain.vercel.app
nextclade-git-master-nextstrain.vercel.app