Skip to content

Commit

Permalink
Link to CC0
Browse files Browse the repository at this point in the history
At the moment solution is hacky.
It looks for part of translation to create link of it

Fixes #217
  • Loading branch information
starsep committed Mar 15, 2024
1 parent 0899973 commit fee40ba
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/components/sidebar/photoUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ interface DefibrillatorDetailsProps {
closeSidebar: () => void;
}

// TODO: consider splitting cc0 part from translation
const LicenceInfoBlock: FC = () => {
const { t } = useTranslation();
const cc0 = "Creative Commons Zero (CC0 v1.0)";
const licenseInfoText = t("photo.license");
if (!licenseInfoText.includes(cc0)) {
return <p className="block">{licenseInfoText}</p>;
}
const [before, after] = licenseInfoText.split(cc0);
return (
<p className="block">
{before}
<a href="https://creativecommons.org/publicdomain/zero/1.0/">{cc0}</a>
{after}
</p>
);
};

const PhotoUpload: FC<DefibrillatorDetailsProps> = (props) => {
const { t } = useTranslation();
const { data, closeSidebar } = props;
Expand All @@ -29,7 +47,6 @@ const PhotoUpload: FC<DefibrillatorDetailsProps> = (props) => {
const accessText = data.tags.access
? ` - ${t(`access.${data.tags.access}`)}`
: "";

return (
<div className="sidebar" id="sidebar-div">
<Card>
Expand Down Expand Up @@ -63,7 +80,7 @@ const PhotoUpload: FC<DefibrillatorDetailsProps> = (props) => {
<Icon path={mdiArrowLeftBold} size={0.8} className="icon" />
<span>{t("footer.cancel")}</span>
</Button>
<p className="block">{t("photo.license")}</p>
<LicenceInfoBlock />
<p className="block">{t("photo.license_short_description")}</p>
{(selectedImage !== null && (
<div>
Expand Down

0 comments on commit fee40ba

Please sign in to comment.