mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-28 06:51:17 -07:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
@@ -10,11 +10,10 @@ export default function Component({ service }) {
|
||||
const { widget } = service;
|
||||
const { data: librariesData, error: librariesError } = useWidgetAPI(widget, "libraries");
|
||||
|
||||
|
||||
if (librariesError) {
|
||||
return <Container service={service} error={librariesError} />;
|
||||
}
|
||||
|
||||
|
||||
if (!librariesData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
@@ -25,9 +24,9 @@ export default function Component({ service }) {
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
const podcastLibraries = librariesData.filter(l => l.mediaType === "podcast");
|
||||
const bookLibraries = librariesData.filter(l => l.mediaType === "book");
|
||||
|
||||
const podcastLibraries = librariesData.filter((l) => l.mediaType === "podcast");
|
||||
const bookLibraries = librariesData.filter((l) => l.mediaType === "book");
|
||||
|
||||
const totalPodcasts = podcastLibraries.reduce((total, pL) => parseInt(pL.stats?.totalItems, 10) + total, 0);
|
||||
const totalBooks = bookLibraries.reduce((total, bL) => parseInt(bL.stats?.totalItems, 10) + total, 0);
|
||||
@@ -38,9 +37,25 @@ export default function Component({ service }) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="audiobookshelf.podcasts" value={t("common.number", { value: totalPodcasts })} />
|
||||
<Block label="audiobookshelf.podcastsDuration" value={t("common.number", { value: totalPodcastsDuration / 60, maximumFractionDigits: 0, style: "unit", unit: "minute" })} />
|
||||
<Block
|
||||
label="audiobookshelf.podcastsDuration"
|
||||
value={t("common.number", {
|
||||
value: totalPodcastsDuration / 60,
|
||||
maximumFractionDigits: 0,
|
||||
style: "unit",
|
||||
unit: "minute",
|
||||
})}
|
||||
/>
|
||||
<Block label="audiobookshelf.books" value={t("common.number", { value: totalBooks })} />
|
||||
<Block label="audiobookshelf.booksDuration" value={t("common.number", { value: totalBooksDuration / 60, maximumFractionDigits: 0, style: "unit", unit: "minute" })} />
|
||||
<Block
|
||||
label="audiobookshelf.booksDuration"
|
||||
value={t("common.number", {
|
||||
value: totalBooksDuration / 60,
|
||||
maximumFractionDigits: 0,
|
||||
style: "unit",
|
||||
unit: "minute",
|
||||
})}
|
||||
/>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user