Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use anchor for resource links #773

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions auspice-client/customisations/splash.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ const Splash = ({available, browserDimensions, dispatch, errorMessage, changePag
}
<div style={{marginTop: "30px"}}/>
{pageInfo.showDatasets ?
<ListAvailable type="datasets" data={available.datasets} width={browserDimensions.width} dispatch={dispatch} changePage={changePage}/> :
<ListAvailable type="datasets" data={available.datasets} width={browserDimensions.width}/> :
null
}
{pageInfo.showNarratives ?
<ListAvailable type="narratives" data={available.narratives} width={browserDimensions.width} dispatch={dispatch} changePage={changePage}/> :
<ListAvailable type="narratives" data={available.narratives} width={browserDimensions.width}/> :
null
}
</div>
Expand All @@ -59,7 +59,7 @@ const Splash = ({available, browserDimensions, dispatch, errorMessage, changePag


/* lifted from auspice's default splash page */
function ListAvailable({type, data, width, dispatch, changePage}) {
function ListAvailable({type, data, width}) {
const numCols = width > 1000 ? 3 : width > 750 ? 2 : 1;
const ColumnList = styled.ul`
-moz-column-count: ${numCols};
Expand All @@ -79,7 +79,7 @@ function ListAvailable({type, data, width, dispatch, changePage}) {
<div style={{flex: "1 50%", minWidth: "0"}}>
{(data && data.length) ? (
<ColumnList>
{data.map((d) => formatDataset(d.request, dispatch, changePage))}
{data.map((d) => formatDataset(d.request))}
</ColumnList>
) :
"None found."
Expand Down Expand Up @@ -114,17 +114,19 @@ function ErrorMessage({errorMessage}) {
);
}

const ListItem = styled.li`
margin: 5px 0;
`

/* lifted from auspice's default splash page */
function formatDataset(requestPath, dispatch, changePage) {
function formatDataset(requestPath) {

// FIXME: Do we actually need dispatch and changePage here? I've removed them for now.
Comment on lines +122 to +124
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my main concern - it's not clear to me what dispatch and changePage were used for. Seems to work fine without it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour will be a little different -- dispatching stays within the SPA, whereas links will go to a new URL, fetch the auspice HTML entrypoint, fetch the auspice JS (cache hit), reparse the JS and so on. In practice, the Auspice splash page within nextstrain.org is used rarely - perhaps only for community data?

P.S. I've wanted proper link behaviour for a while now, especially in the default Auspice splash page.


return (
<li key={requestPath}>
<div
style={{color: "#5097BA", textDecoration: "none", cursor: "pointer", fontWeight: "400", fontSize: "94%"}}
onClick={() => dispatch(changePage({path: requestPath, push: true}))}
>
{requestPath}
</div>
</li>
<ListItem key={requestPath}>
<a href={"/" + requestPath}>{requestPath}</a>
</ListItem>
);
}

Expand Down
Loading