Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/sync-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Sync develop with main

on:
push:
branches:
- main

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Merge main into develop
run: |
git config user.name "TrackGeekBot"
git config user.email "256638171+TrackGeekBot@users.noreply.github.com"
git checkout develop
git merge origin/main --no-ff -m "chore: sync develop with main"
git push origin develop
env:
GITHUB_TOKEN: ${{ secrets.GHT }}
2 changes: 1 addition & 1 deletion src/components/pages/user/reviews-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function UserReviewsTab({
coverURL={reviewMediaImage(contentType, review)}
reviewText={review.summary ?? ""}
notes={review.notes}
story={review.story}
story={mediaContent.hasStory ? review.story : undefined}
routeName={mediaContent.routeName}
entityId={entityId}
date={new Date(review.createdAt)}
Expand Down
2 changes: 2 additions & 0 deletions src/components/shared/modals/episodic-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ export function EpisodicContentModal({
id="rewatches"
type="number"
min={0}
max={999}
step={1}
placeholder="0"
className="bg-background"
{...progressForm.register("watchCount")}
Expand Down
21 changes: 10 additions & 11 deletions src/components/shared/modals/game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function createProgressSchema(t: TFunction) {
return z.object({
status: z.string(),
completion: z.string(),
progress: z.string(),
hoursPlayed: z.string(),
playCount: z.string(),
startDate: z.date().optional(),
finishDate: z.date().optional(),
Expand Down Expand Up @@ -85,7 +85,7 @@ interface GameProgressData {
status: ProgressStatus;
playCount: number | null;
completion: string | null;
progress: number | null;
hoursPlayed: number | null;
notes: string | null;
startedAt: string | null;
completedAt: string | null;
Expand Down Expand Up @@ -129,7 +129,7 @@ export function GameModal({ gameId, onClose }: GameModalProps) {
defaultValues: {
status: "",
completion: "",
progress: "",
hoursPlayed: "",
playCount: "",
startDate: undefined,
finishDate: undefined,
Expand Down Expand Up @@ -220,7 +220,7 @@ export function GameModal({ gameId, onClose }: GameModalProps) {
progressForm.reset({
status: ENUM_TO_STATUS[progress.status] ?? "",
completion: progress.completion ?? "",
progress: progress.progress != null ? String(progress.progress) : "",
hoursPlayed: progress.hoursPlayed != null ? String(progress.hoursPlayed) : "",
playCount: progress.playCount != null ? String(progress.playCount) : "",
notes: progress.notes ?? "",
startDate: progress.startedAt ? new Date(progress.startedAt) : undefined,
Expand Down Expand Up @@ -258,7 +258,7 @@ export function GameModal({ gameId, onClose }: GameModalProps) {
status,
playCount: data.playCount ? Number(data.playCount) : undefined,
completion: data.completion || undefined,
progress: data.progress ? Number(data.progress) : undefined,
hoursPlayed: data.hoursPlayed ? Number(data.hoursPlayed) : undefined,
notes: data.notes.trim() || undefined,
startedAt: data.startDate ?? undefined,
completedAt: status === "Completed" ? (data.finishDate ?? new Date()) : (data.finishDate ?? undefined),
Expand Down Expand Up @@ -476,20 +476,19 @@ export function GameModal({ gameId, onClose }: GameModalProps) {
</Field>

<Field>
<FieldLabel htmlFor="progress" className="text-sm font-medium">
{t("feed:progress")}
<FieldLabel htmlFor="hoursPlayed" className="text-sm font-medium">
{t("feed:hoursPlayed")}
</FieldLabel>
<InputGroup className="bg-background">
<InputGroupInput
id="progress"
id="hoursPlayed"
type="number"
min={0}
max={100}
placeholder="0"
{...progressForm.register("progress")}
{...progressForm.register("hoursPlayed")}
/>
<InputGroupAddon align="inline-end">
<InputGroupText>%</InputGroupText>
<InputGroupText>h</InputGroupText>
</InputGroupAddon>
</InputGroup>
</Field>
Expand Down
31 changes: 28 additions & 3 deletions src/components/shared/modals/movie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type ReviewFormData = z.infer<ReturnType<typeof createReviewSchema>>;
interface MovieProgressData {
id: string;
status: ProgressStatus;
watchCount: number | null;
}

interface MovieModalProps {
Expand All @@ -73,6 +74,7 @@ export function MovieModal({ movieId, onClose }: MovieModalProps) {
const enabled = !!userId && !!movieId;

const [selectedStatus, setSelectedStatus] = useState<string>("");
const [rewatchCount, setRewatchCount] = useState<string>("");
const [newListInput, setNewListInput] = useState<string | null>(null);
const [confirmDeleteOpen, setConfirmDeleteOpen] = useState(false);

Expand Down Expand Up @@ -147,6 +149,7 @@ export function MovieModal({ movieId, onClose }: MovieModalProps) {
if (!progress) return;

setSelectedStatus(ENUM_TO_STATUS[progress.status] ?? "");
setRewatchCount(progress.watchCount != null ? String(progress.watchCount) : "");
}, [progressQuery.data]);

useEffect(() => {
Expand All @@ -171,10 +174,11 @@ export function MovieModal({ movieId, onClose }: MovieModalProps) {
};

const saveProgressMutation = useMutation({
mutationFn: (status: string) =>
mutationFn: (data: { status: string; watchCount?: number }) =>
api.post(apiEndpoints.movieProgress, {
movieId,
status: STATUS_TO_ENUM[status],
status: STATUS_TO_ENUM[data.status],
watchCount: data.watchCount,
}),
onSuccess: invalidateProgress,
});
Expand Down Expand Up @@ -263,7 +267,10 @@ export function MovieModal({ movieId, onClose }: MovieModalProps) {
}

try {
await saveProgressMutation.mutateAsync(selectedStatus);
await saveProgressMutation.mutateAsync({
status: selectedStatus,
watchCount: rewatchCount ? Number(rewatchCount) : undefined,
});

const review = reviewForm.getValues();

Expand Down Expand Up @@ -309,6 +316,24 @@ export function MovieModal({ movieId, onClose }: MovieModalProps) {
</SelectContent>
</Select>
</Field>

<Field className="mt-3">
<FieldLabel htmlFor="rewatches" className="text-sm font-medium">
{t("feed:totalRewatches")}
</FieldLabel>
<Input
id="rewatches"
type="number"
min={0}
max={999}
step={1}
placeholder="0"
className="bg-background"
value={rewatchCount}
onChange={(e) => setRewatchCount(e.target.value)}
aria-label={t("feed:totalRewatches")}
/>
</Field>
</div>

<div className="bg-muted/30 rounded-lg p-4 border border-border/50 flex flex-col">
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
import { api, apiEndpoints } from "@/lib/api.ts";

interface GameProgress {
progress: number;
hoursPlayed: number;
status: string | null;
completionStatus: string | null;
replays: number;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
import type { FavoriteItem } from "@/components/pages/user/overview-tab/favorite-card";
import { type ApiTypes, api, apiEndpoints } from "@/lib/api.ts";

const ITEMS_PER_PAGE = 18;
const ITEMS_PER_PAGE = 200;

type ProgressStatsKey = keyof ApiTypes.User["progressStats"];

Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/locales/en-US/feed.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
},
"totalRereads": "Total Rereads",
"totalReplays": "Total Replays",
"hoursPlayed": "Hours Played",
"completionStatus": {
"label": "Completion Status",
"select": "Select a completion status",
Expand Down