Skip to content

Commit 8208e25

Browse files
authored
Genre display (#930)
* refactor(frontend): extract genre display to component * feat(frontend): hardcode image in genre display * feat(frontend): add info about ryot pro gated feature * chore(*): remove refs to features page
1 parent b60bfa6 commit 8208e25

File tree

4 files changed

+53
-30
lines changed

4 files changed

+53
-30
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</div>
2222

2323
<p align="center">
24-
<a href="https://ryot.io/features" target="_blank">Pro features</a> •
24+
<a href="https://ryot.io" target="_blank">Pro features</a> •
2525
<a href="https://docs.ryot.io" target="_blank">Installation</a> •
2626
<a href="https://docs.ryot.io/configuration" target="_blank">Configuration</a> •
2727
<a href="https://pro.ryot.io/_s/acl_vUMPnPirkHlT" target="_blank">Hosted version</a>
@@ -36,7 +36,7 @@ hosted tracker you will ever need!
3636

3737
Ryot is available in two versions - community and pro. The pro version has additional
3838
features like profile sharing, recommendations, supercharged collections etc. Learn more
39-
about the pro version [here](https://ryot.io/features).
39+
about the pro version [here](https://ryot.io).
4040

4141
## 💻 Demo
4242

apps/backend/src/miscellaneous.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ impl MiscellaneousService {
15341534
docs_link: "https://docs.ryot.io".to_owned(),
15351535
backend_errors: BackendError::iter().collect(),
15361536
smtp_enabled: self.config.server.smtp.is_enabled(),
1537-
website_url: "https://ryot.io/features".to_owned(),
1537+
website_url: "https://ryot.io".to_owned(),
15381538
signup_allowed: self.config.users.allow_registration,
15391539
local_auth_disabled: self.config.users.disable_local_auth,
15401540
token_valid_for_days: self.config.users.token_valid_for_days,

apps/frontend/app/routes/_dashboard.media.genre.list.tsx

+49-26
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
Container,
66
Flex,
77
Group,
8+
Image,
89
Pagination,
9-
Paper,
1010
Stack,
1111
Text,
1212
Title,
@@ -17,15 +17,23 @@ import {
1717
type MetaArgs_SingleFetch,
1818
useLoaderData,
1919
} from "@remix-run/react";
20-
import { GenresListDocument } from "@ryot/generated/graphql/backend/graphql";
21-
import { truncate } from "@ryot/ts-utils";
20+
import {
21+
GenresListDocument,
22+
type GenresListQuery,
23+
} from "@ryot/generated/graphql/backend/graphql";
24+
import { getInitials, truncate } from "@ryot/ts-utils";
2225
import { $path } from "remix-routes";
2326
import { z } from "zod";
2427
import { zx } from "zodix";
25-
import { ApplicationGrid, DebouncedSearchInput } from "~/components/common";
28+
import {
29+
ApplicationGrid,
30+
DebouncedSearchInput,
31+
ProRequiredAlert,
32+
} from "~/components/common";
2633
import {
2734
useAppSearchParam,
2835
useCoreDetails,
36+
useFallbackImageUrl,
2937
useGetMantineColor,
3038
} from "~/lib/hooks";
3139
import {
@@ -60,7 +68,6 @@ export const meta = (_args: MetaArgs_SingleFetch<typeof loader>) => {
6068
export default function Page() {
6169
const loaderData = useLoaderData<typeof loader>();
6270
const coreDetails = useCoreDetails();
63-
const getMantineColor = useGetMantineColor();
6471
const [_, { setP }] = useAppSearchParam(loaderData.cookieName);
6572

6673
return (
@@ -84,27 +91,7 @@ export default function Page() {
8491
</Box>
8592
<ApplicationGrid>
8693
{loaderData.genresList.items.map((genre) => (
87-
<Paper key={genre.id}>
88-
<Group>
89-
<Box
90-
h={11}
91-
w={11}
92-
style={{ borderRadius: 2 }}
93-
bg={getMantineColor(genre.name)}
94-
/>
95-
<Box>
96-
<Anchor
97-
component={Link}
98-
to={$path("/media/genre/:id", { id: genre.id })}
99-
>
100-
{truncate(genre.name, { length: 13 })}
101-
</Anchor>
102-
<Text size="sm" c="dimmed">
103-
{genre.numItems} items
104-
</Text>
105-
</Box>
106-
</Group>
107-
</Paper>
94+
<DisplayGenre key={genre.id} genre={genre} />
10895
))}
10996
</ApplicationGrid>
11097
</>
@@ -127,3 +114,39 @@ export default function Page() {
127114
</Container>
128115
);
129116
}
117+
118+
type Genre = GenresListQuery["genresList"]["items"][number];
119+
120+
const DisplayGenre = (props: { genre: Genre }) => {
121+
const getMantineColor = useGetMantineColor();
122+
123+
return (
124+
<Anchor
125+
component={Link}
126+
to={$path("/media/genre/:id", { id: props.genre.id })}
127+
>
128+
<Stack gap={4}>
129+
<Box pos="relative">
130+
<Image
131+
radius="md"
132+
h={260}
133+
alt={props.genre.name}
134+
fallbackSrc={useFallbackImageUrl(getInitials(props.genre.name))}
135+
/>
136+
<Box pos="absolute" left={0} right={0} bottom={0}>
137+
<ProRequiredAlert tooltipLabel="Collage image using genre contents" />
138+
</Box>
139+
</Box>
140+
<Group justify="center">
141+
<Box
142+
h={11}
143+
w={11}
144+
style={{ borderRadius: 2 }}
145+
bg={getMantineColor(props.genre.name)}
146+
/>
147+
<Text>{truncate(props.genre.name, { length: 13 })}</Text>
148+
</Group>
149+
</Stack>
150+
</Anchor>
151+
);
152+
};

docs/content/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
If you would like to run the pro version, please check [below](#upgrading-to-pro). To see
44
the features of the pro version, check the [features page]({{extra.main_website_url
5-
}}/features).
5+
}}).
66

77
```yaml
88
services:

0 commit comments

Comments
 (0)