Skip to content

Commit dd5727a

Browse files
committed
ui update
1 parent daa91db commit dd5727a

7 files changed

Lines changed: 121 additions & 20 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"devDependencies": {
3636
"@eslint/js": "^9.39.4",
3737
"@openapitools/openapi-generator-cli": "^2.32.0",
38+
"@tailwindcss/typography": "^0.5.20",
3839
"@tauri-apps/cli": "2.10.0",
3940
"@types/react": "^19.2.14",
4041
"@types/react-dom": "^19.2.3",

pnpm-lock.yaml

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Card.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@ import { ReactNode } from "react";
44
type CardProps = {
55
title: string;
66
className?: string;
7+
surfaceClassName?: string;
78
children: ReactNode;
89
};
910

10-
export default function Card({ title, children, className }: CardProps) {
11+
export default function Card({
12+
title,
13+
children,
14+
className,
15+
surfaceClassName = "bg-zinc-100 dark:bg-zinc-800",
16+
}: CardProps) {
1117
return (
12-
<div className="overflow-hidden rounded-lg dark:bg-zinc-800 bg-zinc-100 shadow-sm mb-4">
18+
<div
19+
className={
20+
"overflow-hidden rounded-lg shadow-sm mb-4 " +
21+
surfaceClassName
22+
}
23+
>
1324
<div className="px-4 pt-5 sm:px-6">
1425
<Subheading>{title}</Subheading>
1526
</div>

src/components/MarkdownContent.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import clsx from "clsx";
2+
import Markdown from "react-markdown";
3+
4+
type MarkdownContentProps = {
5+
content: string;
6+
className?: string;
7+
};
8+
9+
export default function MarkdownContent({
10+
content,
11+
className,
12+
}: MarkdownContentProps) {
13+
return (
14+
<div
15+
className={clsx(
16+
"prose prose-sm prose-zinc max-w-none dark:prose-invert",
17+
className,
18+
)}
19+
>
20+
<Markdown>{content}</Markdown>
21+
</div>
22+
);
23+
}

src/components/news/NewsDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
DialogBody,
55
DialogTitle,
66
} from "@/components/tailwind/dialog";
7+
import MarkdownContent from "@/components/MarkdownContent";
78
import { Button } from "@tw/button";
89
import { useEffect, useState } from "react";
9-
import Markdown from "react-markdown";
1010
import { useNews } from "../../hooks/useNews";
1111

1212
interface NewsDialogProps {
@@ -76,7 +76,7 @@ export function NewsDialog({ onClose }: NewsDialogProps) {
7676
</div>
7777
<DialogBody className="pt-4 max-h-[70vh] overflow-y-auto min-h-[420px]">
7878
{hasErr && <div className="mb-4 text-sm text-rose-500">{hasErr}</div>}
79-
<Markdown>{content}</Markdown>
79+
<MarkdownContent content={content} />
8080
</DialogBody>
8181
<DialogActions>
8282
<Button type="button" onClick={onClose} color="zinc">

src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import "tailwindcss";
2+
@plugin "@tailwindcss/typography";
23

34
@layer theme, base, components, utilities;
45
@import "tailwindcss/theme.css" layer(theme);

src/pages/GameView.tsx

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { GamevaultGame } from "@/api/models/GamevaultGame";
22
import { Progress, ProgressStateEnum } from "@/api/models/Progress";
33
import { Media } from "@/components/Media";
44
import MediaSlider from "@/components/MediaSlider";
5+
import MarkdownContent from "@/components/MarkdownContent";
56
import { useAuth } from "@/context/AuthContext";
67
import { useAlertDialog } from "@/context/AlertDialogContext";
78
import { Button } from "@tw/button";
@@ -35,7 +36,6 @@ import {
3536
HashtagIcon,
3637
} from "@heroicons/react/24/outline";
3738
import clsx from "clsx";
38-
import Markdown from "react-markdown";
3939
import {
4040
Dropdown,
4141
DropdownButton,
@@ -479,6 +479,17 @@ export default function GameView() {
479479
game?.metadata?.average_playtime ||
480480
(game as any)?.metadata?.average_playtime ||
481481
null;
482+
const floatingIconButtonClassName =
483+
"h-9 w-9 p-0 flex items-center justify-center border-white/35 bg-white/60 shadow-sm backdrop-blur-md hover:bg-white/78 dark:border-white/20 dark:bg-zinc-950/58 dark:hover:bg-zinc-900/72";
484+
const glassPanelClassName =
485+
"border border-white/35 bg-white/[0.42] backdrop-blur-md dark:border-white/10 dark:bg-zinc-950/72 dark:backdrop-blur-md";
486+
const darkGlassInsetClassName =
487+
"dark:border dark:border-white/10 dark:bg-zinc-950/68 dark:backdrop-blur-md";
488+
const progressSelectClassName = clsx(
489+
"rounded-lg before:bg-white/60 before:backdrop-blur-md before:shadow-sm",
490+
"dark:before:hidden",
491+
darkGlassInsetClassName,
492+
);
482493

483494
// Derive additional metadata fields
484495
const releaseYear = game?.release_date
@@ -619,7 +630,7 @@ export default function GameView() {
619630
<Button
620631
outline
621632
onClick={() => setSettingsOpen(true)}
622-
className="h-9 w-9 p-0 flex items-center justify-center border-white/20 bg-zinc-900/40 text-white shadow-sm backdrop-blur-sm hover:bg-zinc-800/60 dark:border-white/20 dark:bg-zinc-700/50 dark:hover:bg-zinc-600/60"
633+
className={floatingIconButtonClassName}
623634
title="Settings"
624635
>
625636
<Cog8ToothIcon className="w-5 h-5" />
@@ -633,7 +644,7 @@ export default function GameView() {
633644
"disabled:opacity-50 disabled:cursor-not-allowed shadow-sm",
634645
bookmarked
635646
? "bg-yellow-400/20 border-yellow-400 text-yellow-400"
636-
: "bg-zinc-900/40 dark:bg-zinc-700/50 border-white/20 hover:bg-zinc-800/60 dark:hover:bg-zinc-600/60 text-white",
647+
: "border-white/35 bg-white/60 text-zinc-700 hover:bg-white/78 dark:border-white/20 dark:bg-zinc-950/58 dark:text-zinc-100 dark:hover:bg-zinc-900/72",
637648
)}
638649
title={bookmarked ? "Remove bookmark" : "Add bookmark"}
639650
aria-pressed={bookmarked}
@@ -647,7 +658,7 @@ export default function GameView() {
647658
<Button
648659
outline
649660
onClick={handleShare}
650-
className="h-9 w-9 p-0 flex items-center justify-center border-white/20 bg-zinc-900/40 text-white shadow-sm backdrop-blur-sm hover:bg-zinc-800/60 dark:border-white/20 dark:bg-zinc-700/50 dark:hover:bg-zinc-600/60"
661+
className={floatingIconButtonClassName}
651662
title="Copy link"
652663
>
653664
<ShareIcon className="w-5 h-5" />
@@ -688,7 +699,12 @@ export default function GameView() {
688699
{/* Right Column Row 1: Stats + Progress State */}
689700
<div className="flex flex-col gap-6 xl:col-start-2 xl:row-start-1 min-w-0">
690701
<div className="grid grid-cols-3 gap-2 text-center text-xs">
691-
<div className="p-3 rounded-lg bg-zinc-100 dark:bg-zinc-800">
702+
<div
703+
className={clsx(
704+
"rounded-lg bg-zinc-100 p-3",
705+
darkGlassInsetClassName,
706+
)}
707+
>
692708
<div className="text-[10px] uppercase tracking-wide text-zinc-500 dark:text-zinc-400">
693709
Playtime
694710
</div>
@@ -698,7 +714,12 @@ export default function GameView() {
698714
: `${playtimeMinutes} m`}
699715
</div>
700716
</div>
701-
<div className="p-3 rounded-lg bg-zinc-100 dark:bg-zinc-800">
717+
<div
718+
className={clsx(
719+
"rounded-lg bg-zinc-100 p-3",
720+
darkGlassInsetClassName,
721+
)}
722+
>
702723
<div className="text-[10px] uppercase tracking-wide text-zinc-500 dark:text-zinc-400">
703724
Last Played
704725
</div>
@@ -709,7 +730,12 @@ export default function GameView() {
709730
{lastPlayed}
710731
</div>
711732
</div>
712-
<div className="p-3 rounded-lg bg-zinc-100 dark:bg-zinc-800">
733+
<div
734+
className={clsx(
735+
"rounded-lg bg-zinc-100 p-3",
736+
darkGlassInsetClassName,
737+
)}
738+
>
713739
<div className="text-[10px] uppercase tracking-wide text-zinc-500 dark:text-zinc-400">
714740
Avg Playtime
715741
</div>
@@ -729,7 +755,7 @@ export default function GameView() {
729755
value={progressState || "UNPLAYED"}
730756
onChange={(v: any) => updateProgressState(v)}
731757
disabled={!user || progressUpdating}
732-
className="rounded-lg before:bg-zinc-900/40 before:backdrop-blur-sm before:shadow-none dark:bg-zinc-700/50 dark:before:hidden"
758+
className={progressSelectClassName}
733759
>
734760
{progressStateOptions.map((o) => (
735761
<ListboxOption key={o.key} value={o.key}>
@@ -756,7 +782,11 @@ export default function GameView() {
756782
</div>
757783
)}
758784
<div ref={detailsCardRef} className="contents">
759-
<Card title="Details" className="!mb-0">
785+
<Card
786+
title="Details"
787+
className="!mb-0"
788+
surfaceClassName={glassPanelClassName}
789+
>
760790
<div className="flex border-b border-zinc-300/40 dark:border-zinc-700/50 mb-4 gap-6 text-sm">
761791
<button
762792
onClick={() => setDetailsTab("description")}
@@ -795,19 +825,15 @@ export default function GameView() {
795825
<div className="text-sm leading-relaxed space-y-4 min-h-[180px]">
796826
{detailsTab === "description" &&
797827
(description ? (
798-
<p className="whitespace-pre-line text-zinc-700 dark:text-zinc-300">
799-
{description}
800-
</p>
828+
<MarkdownContent content={description} />
801829
) : (
802830
<p className="italic text-zinc-500">
803831
No description available.
804832
</p>
805833
))}
806834
{detailsTab === "notes" &&
807835
(notes ? (
808-
<div className="prose prose-sm dark:prose-invert max-w-none">
809-
<Markdown>{notes}</Markdown>
810-
</div>
836+
<MarkdownContent content={notes} />
811837
) : (
812838
<p className="italic text-zinc-500">No notes.</p>
813839
))}
@@ -840,6 +866,7 @@ export default function GameView() {
840866
<Card
841867
title="Additional Metadata"
842868
className="min-h-[160px] h-full"
869+
surfaceClassName={glassPanelClassName}
843870
>
844871
<ul className="space-y-4 text-sm">
845872
<li className="flex items-start gap-3">
@@ -966,7 +993,11 @@ export default function GameView() {
966993
isXL && detailsHeight ? { height: detailsHeight } : undefined
967994
}
968995
>
969-
<Card title="Activity" className="!mb-0 h-full">
996+
<Card
997+
title="Activity"
998+
className="!mb-0 h-full"
999+
surfaceClassName={glassPanelClassName}
1000+
>
9701001
{(() => {
9711002
const progresses: Progress[] =
9721003
(game as any)?.progresses || [];

0 commit comments

Comments
 (0)