Skip to content

Commit

Permalink
Disable relation data download if relations are unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
cmil committed Dec 4, 2020
1 parent c0b0559 commit 4d71d24
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
52 changes: 32 additions & 20 deletions src/components/DownloadLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,38 @@ const DownloadLinks = ({play}) => {
<img src={svgGraphML}/>
</a>
</span>
<p>
Relation data (as described{' '}
<a href="https://github.com/dracor-org/gerdracor#character-relations">
here
</a>):
</p>
<span className={cx('formats')}>
<a
href={csvRelationsUrl}
download={`${play.id}-${play.name}.csv`}
>
<img src={svgCSV}/>
</a>
<a
href={gexfRelationsUrl}
download={`${play.id}-${play.name}.gexf`}
>
<img src={svgGEXF}/>
</a>
</span>
{play.relations ? (
<>
<p>
Relation data (as described{' '}
<a href="https://github.com/dracor-org/gerdracor#character-relations">
here
</a>):
</p>
<span className={cx('formats')}>
<a
href={csvRelationsUrl}
download={`${play.id}-${play.name}.csv`}
>
<img src={svgCSV}/>
</a>
<a
href={gexfRelationsUrl}
download={`${play.id}-${play.name}.gexf`}
>
<img src={svgGEXF}/>
</a>
</span>
</>
) : (
<>
<p>Relation data not yet available.</p>
<span className={cx('formats')}>
<img disabled src={svgCSV}/>
<img disabled src={svgGEXF}/>
</span>
</>
)}
</span>
<span>
<h4>Spoken text</h4>
Expand Down
4 changes: 4 additions & 0 deletions src/components/DownloadLinks.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
&:focus {
opacity: 0.85;
}

&[disabled] {
opacity: .5;
}
}
}
}
Expand Down

0 comments on commit 4d71d24

Please sign in to comment.