-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FTP links component to the Species page (#1088)
Co-authored-by: Andrey Azov <[email protected]>
- Loading branch information
1 parent
7a09805
commit 64eb0b0
Showing
8 changed files
with
214 additions
and
6 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
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
24 changes: 24 additions & 0 deletions
24
...p/species/components/species-sidebar-modal/modal-views/SpeciesSidebarDownloads.module.css
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,24 @@ | ||
.sectionHead { | ||
font-size: 12px; | ||
font-weight: var(--font-weight-light); | ||
border-bottom: 1px solid var(--color-grey); | ||
margin-bottom: 10px; | ||
margin-top: 45px; | ||
} | ||
|
||
.sectionHead:first-child { | ||
margin-top: 30px; | ||
} | ||
|
||
.SpeciesFtpLink{ | ||
margin-left: 10px; | ||
} | ||
|
||
.SpeciesFtpLink:not(:last-child) { | ||
margin-bottom: 25px; | ||
} | ||
|
||
.SpeciesFtpLinkTitle{ | ||
font-weight: var(--font-weight-light); | ||
margin-bottom: 10px; | ||
} |
102 changes: 102 additions & 0 deletions
102
...tent/app/species/components/species-sidebar-modal/modal-views/SpeciesSidebarDownloads.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,102 @@ | ||
/** | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { useAppSelector } from 'src/store'; | ||
import { getActiveGenomeId } from 'src/content/app/species/state/general/speciesGeneralSelectors'; | ||
|
||
import { useSpeciesFtpLinksQuery } from 'src/content/app/species/state/api/speciesApiSlice'; | ||
|
||
import ExternalLink from 'src/shared/components/external-link/ExternalLink'; | ||
import { CircleLoader } from 'src/shared/components/loader'; | ||
|
||
import styles from './SpeciesSidebarDownloads.module.css'; | ||
|
||
const SpeciesSidebarDownloads = () => { | ||
const activeGenomeId = useAppSelector(getActiveGenomeId) || ''; | ||
const { data: ftpLinksResponse, isFetching } = useSpeciesFtpLinksQuery( | ||
activeGenomeId, | ||
{ | ||
skip: !activeGenomeId | ||
} | ||
); | ||
|
||
if (isFetching) { | ||
return <CircleLoader />; | ||
} | ||
|
||
const ftpLinks = ftpLinksResponse || []; | ||
const linkSections: Record<string, string> = {}; | ||
|
||
for (const link of ftpLinks) { | ||
linkSections[link.dataset] = link.url; | ||
} | ||
|
||
return ( | ||
<div> | ||
{linkSections.assembly && ( | ||
<section> | ||
<div className={styles.sectionHead}>Assembly</div> | ||
<SpeciesFtpLink title="DNA sequence" link={linkSections.assembly}> | ||
FASTA | ||
</SpeciesFtpLink> | ||
</section> | ||
)} | ||
<section> | ||
<div className={styles.sectionHead}>Annotation</div> | ||
{linkSections.genebuild && ( | ||
<SpeciesFtpLink | ||
title="Genes, cDNA, ncRNA, proteins" | ||
link={linkSections.genebuild} | ||
> | ||
FASTA/GTF/GFF3 | ||
</SpeciesFtpLink> | ||
)} | ||
{linkSections.variation && ( | ||
<SpeciesFtpLink title="Variation" link={linkSections.variation}> | ||
VCF | ||
</SpeciesFtpLink> | ||
)} | ||
{linkSections.homologies && ( | ||
<SpeciesFtpLink title="Homologies" link={linkSections.homologies}> | ||
TSV | ||
</SpeciesFtpLink> | ||
)} | ||
{linkSections.regulation && ( | ||
<SpeciesFtpLink title="Regulation" link={linkSections.regulation}> | ||
BigBED/TSV/GFF3/BigWig | ||
</SpeciesFtpLink> | ||
)} | ||
</section> | ||
</div> | ||
); | ||
}; | ||
|
||
const SpeciesFtpLink = (props: { | ||
title: string; | ||
link: string; | ||
children: React.ReactNode; | ||
}) => { | ||
return ( | ||
<div className={styles.SpeciesFtpLink}> | ||
<div className={styles.SpeciesFtpLinkTitle}>{props.title}</div> | ||
<ExternalLink to={props.link}>{props.children}</ExternalLink> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SpeciesSidebarDownloads; |
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