Skip to content

Commit

Permalink
Add BloomPUB Viewer download link
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-polk committed May 21, 2024
1 parent b3f2edd commit 6a59eb5
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/BloomPUBViewerDownloadLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import useAxios from "@use-hooks/axios";
import { FormattedMessage } from "react-intl";
import { BlorgLink } from "./BlorgLink";

export const BloomPUBViewerDownloadLink: React.FunctionComponent<{
channel: string;
}> = (props) => {
const versionRequest = useAxios({
url: `https://bloomlibrary.org/assets/bloomPUBViewerInstallerInfo.json`,
method: "GET",
trigger: "true",
});

const versionNumber = versionRequest?.response?.data.versionNumber;
const downloadUrl = versionRequest?.response?.data.downloadUrl;
return versionNumber && downloadUrl ? (
<BlorgLink href={downloadUrl}>
<FormattedMessage
id="download.version"
defaultMessage="Download version {versionNumber}."
values={{ versionNumber }}
/>
</BlorgLink>
) : null;
};
6 changes: 6 additions & 0 deletions src/components/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ export const Routes: React.FunctionComponent<{}> = (props) => {
>
<Redirect to="/page/create/downloads" />
</Route>
<Route exact path={["/bloom-reader"]}>
<Redirect to="/page/create/page/bloom-reader" />
</Route>
<Route exact path={["/bloompub-viewer"]}>
<Redirect to="/page/create/page/bloompub-viewer" />
</Route>
{/* Alias from legacy blorg */}
<Redirect from={"/browse/detail/:id"} to="/book/:id" />
{/* Alias from legacy blorg */}
Expand Down
2 changes: 2 additions & 0 deletions src/components/markdown/BlorgMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Columns, Column } from "./Columns";
import { Button } from "./Button";
import { AllBloomInstallers } from "./AllBloomInstallers";
import { ContentfulImage, StoryImage } from "./ContentfulImage";
import { BloomPUBViewerDownloadLink } from "../BloomPUBViewerDownloadLink";

export enum TwoColumn {
leftColumn,
Expand All @@ -33,6 +34,7 @@ export const BlorgMarkdown: React.FunctionComponent<{
WindowsInstallerDownload,
WindowsInstallerLink,
BloomReaderVersionNumber,
BloomPUBViewerDownloadLink,
FeatureMatrix: { component: FeatureMatrixCodeSplit },
Feature: { component: FeatureCodeSplit },
FeatureGroup: { component: FeatureGroupCodeSplit },
Expand Down
4 changes: 4 additions & 0 deletions src/localization/Code Strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@
"message": "Version {versionNumber} {date}",
"description": "Describes the version of the Bloom software to be downloaded. \"versionNumber\" is the version number of Bloom, e.g. 4.8.3. \"date\" is the date that version was created, e.g. 2020-11-24."
},
"download.version": {
"message": "Download version {versionNumber}.",
"description": "{versionNumber} will be replaced by the version number of the software. For example, 'Download version 1.1.0.'"
},
"sponsorshipHeading": {
"message": "This project was supported by",
"description": "Example, see the bottom of https://bloomlibrary.org/kyrgyzstan-OkuuKeremet"
Expand Down

0 comments on commit 6a59eb5

Please sign in to comment.