Skip to content

Commit 94df117

Browse files
authored
Minor fixes (#811)
* ci(frontend): add output for routes task * ci(ts): quote moon configs correctly * fix(backend): allow nullable media reason * fix(frontend): extract to vars * fix(frontend): type error * build(backend): bump version * fix(frontend): move loader correctly * fix(frontend): remove duplicated code
1 parent 6ed0f9a commit 94df117

File tree

11 files changed

+55
-77
lines changed

11 files changed

+55
-77
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ryot"
3-
version = "5.1.1"
3+
version = "5.1.2"
44
edition = "2021"
55
repository = "https://github.com/IgnisDa/ryot"
66
license = "GPL-3.0"

apps/backend/src/miscellaneous/resolver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2410,7 +2410,7 @@ impl MiscellaneousService {
24102410
title: String,
24112411
publish_year: Option<i32>,
24122412
images: Option<serde_json::Value>,
2413-
media_reason: Vec<UserToMediaReason>,
2413+
media_reason: Option<Vec<UserToMediaReason>>,
24142414
}
24152415

24162416
let count_select = Query::select()

apps/backend/src/models.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub mod media {
261261
pub struct MediaListItem {
262262
pub data: MetadataSearchItem,
263263
pub average_rating: Option<Decimal>,
264-
pub media_reason: Vec<UserToMediaReason>,
264+
pub media_reason: Option<Vec<UserToMediaReason>>,
265265
}
266266

267267
#[derive(Debug, Serialize, Deserialize, SimpleObject, Clone, FromQueryResult)]

apps/frontend/app/components/media.tsx

+17-29
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import {
6161
IconArrowBigUp,
6262
IconArrowsRight,
6363
IconBackpack,
64-
IconBookmarksFilled,
64+
IconBookmarks,
6565
IconCheck,
6666
IconCloudDownload,
6767
IconEdit,
@@ -468,7 +468,7 @@ export const BaseDisplayItem = (props: {
468468
highlightRightText?: string;
469469
children?: ReactNode;
470470
nameRight?: JSX.Element;
471-
mediaReason?: UserToMediaReason[];
471+
mediaReason?: UserToMediaReason[] | null;
472472
}) => {
473473
const colorScheme = useComputedColorScheme("dark");
474474

@@ -492,6 +492,10 @@ export const BaseDisplayItem = (props: {
492492
</Box>
493493
);
494494

495+
const reasons = props.mediaReason?.filter((r) =>
496+
[UserToMediaReason.Seen, UserToMediaReason.Watchlist].includes(r),
497+
);
498+
495499
const themeIconSurrounder = (idx: number, icon?: JSX.Element) => (
496500
<ThemeIcon variant="transparent" size="sm" color="lime" key={idx}>
497501
{icon}
@@ -505,7 +509,6 @@ export const BaseDisplayItem = (props: {
505509
justify="center"
506510
direction="column"
507511
>
508-
{props.topLeft}
509512
<SurroundingElement style={{ flex: "none" }} pos="relative">
510513
<Image
511514
src={props.imageLink}
@@ -527,29 +530,29 @@ export const BaseDisplayItem = (props: {
527530
getInitials(props.name),
528531
)}
529532
/>
533+
<Box pos="absolute" style={{ zIndex: 999 }} top={10} left={10}>
534+
{props.topLeft}
535+
</Box>
530536
<Box pos="absolute" top={5} right={5}>
531537
{props.topRight}
532538
</Box>
533-
{props.mediaReason ? (
539+
{reasons && reasons.length > 0 ? (
534540
<Group
535541
style={blackBgStyles}
536542
pos="absolute"
537543
bottom={5}
538544
left={5}
539-
gap="xs"
545+
gap={3}
540546
>
541-
{props.mediaReason
547+
{reasons
542548
.map((r) =>
543549
match(r)
544550
.with(UserToMediaReason.Seen, () => (
545551
<IconRosetteDiscountCheck />
546552
))
547-
.with(UserToMediaReason.Watchlist, () => (
548-
<IconBookmarksFilled />
549-
))
550-
.otherwise(() => undefined),
553+
.with(UserToMediaReason.Watchlist, () => <IconBookmarks />)
554+
.run(),
551555
)
552-
.filter(Boolean)
553556
.map((icon, idx) => themeIconSurrounder(idx, icon))}
554557
</Group>
555558
) : null}
@@ -605,7 +608,7 @@ export const MediaItemWithoutUpdateModal = (props: {
605608
noHref?: boolean;
606609
onClick?: (e: React.MouseEvent) => Promise<void>;
607610
nameRight?: JSX.Element;
608-
mediaReason?: UserToMediaReason[];
611+
mediaReason?: UserToMediaReason[] | null;
609612
}) => {
610613
const navigate = useNavigate();
611614
const id = props.item.identifier;
@@ -640,15 +643,7 @@ export const MediaItemWithoutUpdateModal = (props: {
640643
imagePlaceholder={getInitials(props.item?.title || "")}
641644
topLeft={
642645
props.imageOverlayForLoadingIndicator ? (
643-
<Loader
644-
pos="absolute"
645-
style={{ zIndex: 999 }}
646-
top={10}
647-
left={10}
648-
color="red"
649-
variant="bars"
650-
size="sm"
651-
/>
646+
<Loader color="red" variant="bars" size="sm" />
652647
) : null
653648
}
654649
mediaReason={props.mediaReason}
@@ -675,14 +670,7 @@ export const MediaItemWithoutUpdateModal = (props: {
675670
</Box>
676671
) : props.noRatingLink ? undefined : (
677672
<Box
678-
p={3}
679-
pos="absolute"
680-
top={5}
681-
right={5}
682-
style={{
683-
backgroundColor: "rgba(0, 0, 0, 0.75)",
684-
borderRadius: 3,
685-
}}
673+
style={blackBgStyles}
686674
onClick={(e) => {
687675
e.preventDefault();
688676
navigate(

apps/frontend/moon.yml

+12-17
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,29 @@ dependsOn:
33

44
fileGroups:
55
remix:
6-
- app/**/*
7-
- public/**/*
8-
- env.d.ts
9-
- remix.config.*
6+
- 'app/**/*'
7+
- 'public/**/*'
8+
- 'env.d.ts'
9+
- 'remix.config.*'
1010

1111
tasks:
1212
routes:
13-
command: remix-routes
14-
inputs:
15-
- '@group(remix)'
13+
command: 'remix-routes'
14+
inputs: ['@group(remix)']
15+
outputs: ['app/remix-routes.d.ts']
1616

1717
dev:
1818
command: 'remix vite:dev --port 3000 --host'
1919
local: true
20-
deps:
21-
- routes
20+
deps: ['~:routes']
2221

2322
build:
24-
deps:
25-
- routes
2623
command: 'remix vite:build'
27-
inputs:
28-
- '@group(remix)'
29-
outputs:
30-
- build
24+
inputs: ['@group(remix)']
25+
outputs: ['build']
26+
deps: ['~:routes']
3127
options:
3228
runDepsInParallel: false
3329

3430
typecheck:
35-
inputs:
36-
- '@group(remix)'
31+
inputs: ['@group(remix)']

apps/landing/moon.yml

+8-12
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ dependsOn:
33

44
fileGroups:
55
astro:
6-
- src/**/*
7-
- public/**/*
8-
- astro.config.*
9-
- tailwind.config.*
6+
- 'src/**/*'
7+
- 'public/**/*'
8+
- 'astro.config.*'
9+
- 'tailwind.config.*'
1010

1111
tasks:
1212
dev:
@@ -15,14 +15,10 @@ tasks:
1515

1616
check:
1717
command: 'astro check'
18-
inputs:
19-
- '@group(astro)'
18+
inputs: ['@group(astro)']
2019

2120
build:
2221
command: 'astro build'
23-
deps:
24-
- ~:check
25-
inputs:
26-
- '@group(astro)'
27-
outputs:
28-
- dist
22+
deps: ['~:check']
23+
inputs: ['@group(astro)']
24+
outputs: ['dist']

libs/generated/moon.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
type: library
1+
type: 'library'
22

33
tasks:
44
backend-graphql:
55
command:
6-
- graphql-codegen
6+
- 'graphql-codegen'
77
- '--config'
8-
- src/graphql/backend/codegen.ts
9-
outputs:
10-
- src/graphql/backend
8+
- 'src/graphql/backend/codegen.ts'
9+
outputs: ['src/graphql/backend']
1110
local: true
1211

1312
workspace:
1413
inheritedTasks:
1514
exclude:
16-
- build
17-
- lint
18-
- format
15+
- 'build'
16+
- 'lint'
17+
- 'format'

libs/generated/src/graphql/backend/graphql.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ export enum MediaGeneralFilter {
772772
export type MediaListItem = {
773773
averageRating?: Maybe<Scalars['Decimal']['output']>;
774774
data: MetadataSearchItem;
775-
mediaReason: Array<UserToMediaReason>;
775+
mediaReason?: Maybe<Array<UserToMediaReason>>;
776776
};
777777

778778
export type MediaListResults = {
@@ -2843,7 +2843,7 @@ export type MetadataListQueryVariables = Exact<{
28432843
}>;
28442844

28452845

2846-
export type MetadataListQuery = { metadataList: { details: { total: number, nextPage?: number | null }, items: Array<{ averageRating?: string | null, mediaReason: Array<UserToMediaReason>, data: { identifier: string, title: string, image?: string | null, publishYear?: number | null } }> } };
2846+
export type MetadataListQuery = { metadataList: { details: { total: number, nextPage?: number | null }, items: Array<{ averageRating?: string | null, mediaReason?: Array<UserToMediaReason> | null, data: { identifier: string, title: string, image?: string | null, publishYear?: number | null } }> } };
28472847

28482848
export type MetadataMainDetailsQueryVariables = Exact<{
28492849
metadataId: Scalars['Int']['input'];

libs/graphql/moon.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
type: library
1+
type: 'library'
22

33
workspace:
44
inheritedTasks:
55
exclude:
6-
- build
7-
- test
6+
- 'build'
7+
- 'test'

libs/ts-utils/moon.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
type: library
1+
type: 'library'
22

33
workspace:
44
inheritedTasks:
55
exclude:
6-
- build
6+
- 'build'

0 commit comments

Comments
 (0)