Skip to content

Commit 6db71fb

Browse files
committed
refactor(ui): redesign game card UI with gradient overlay and typography
1 parent 4513b6b commit 6db71fb

6 files changed

Lines changed: 46 additions & 46 deletions

File tree

src/components/Cards/CardItem.tsx

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import RemoveCircleIcon from "@mui/icons-material/RemoveCircle";
33
import Box from "@mui/material/Box";
44
import Card from "@mui/material/Card";
55
import CardActionArea from "@mui/material/CardActionArea";
6-
import CardMedia from "@mui/material/CardMedia";
76
import IconButton from "@mui/material/IconButton";
87
import Tooltip from "@mui/material/Tooltip";
8+
import Typography from "@mui/material/Typography";
99
import { forwardRef, memo } from "react";
1010
import { useStore } from "@/store/appStore";
1111
import { getGameCover, getGameNsfwStatus } from "@/utils/game";
@@ -90,26 +90,50 @@ export const CardItem = memo(
9090
{...handlers}
9191
className={`
9292
duration-100
93-
hover:shadow-lg hover:scale-105
93+
hover:shadow-lg
9494
active:shadow-sm active:scale-95
9595
${isOverlay ? "shadow-lg scale-105" : ""}
9696
`}
9797
>
98-
<CardMedia
99-
component="img"
100-
className="h-auto aspect-[3/4] object-cover"
101-
image={coverImage}
102-
alt="Card Image"
103-
draggable="false"
104-
loading="lazy"
105-
/>
106-
<div
107-
className={`flex items-center justify-center h-8 px-1 w-full ${isActive ? "font-semibold text-[--mui-palette-primary-main]" : ""}`}
108-
>
109-
<span className="text-base truncate max-w-full">
110-
{displayName}
111-
</span>
112-
</div>
98+
<Box className="relative aspect-[3/4] overflow-hidden">
99+
<Box
100+
component="img"
101+
src={coverImage}
102+
alt={displayName}
103+
draggable="false"
104+
loading="lazy"
105+
className="h-full w-full object-cover"
106+
sx={{
107+
filter: "saturate(0.92) contrast(0.98)",
108+
}}
109+
/>
110+
{/* 未来悬浮文本(例如游玩时间、日期等)的占位符 */}
111+
{/*<Box
112+
className="absolute inset-x-0 bottom-0 px-2.5 pt-6 pb-1.5"
113+
sx={{
114+
background:
115+
"linear-gradient(to bottom, transparent 0%, rgba(15,23,32,0.3) 50%, rgba(15,23,32,0.85) 100%)",
116+
color: "white",
117+
}}
118+
/>*/}
119+
</Box>
120+
<Box className="px-3 py-2.5 text-center">
121+
<Tooltip title={displayName} placement="top" arrow>
122+
<Typography
123+
variant="subtitle2"
124+
sx={{
125+
fontWeight: 700,
126+
color: isActive ? "primary.main" : "text.primary",
127+
overflow: "hidden",
128+
textOverflow: "ellipsis",
129+
whiteSpace: "nowrap",
130+
textAlign: "center",
131+
}}
132+
>
133+
{displayName}
134+
</Typography>
135+
</Tooltip>
136+
</Box>
113137
</CardActionArea>
114138
</Card>
115139
);

src/components/Collection/EntityCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const EntityCard = memo<EntityCardProps>(
133133
position: "absolute",
134134
top: 8,
135135
right: 8,
136-
bgcolor: "background.paper",
136+
zIndex: 2,
137137
"&:hover": {
138138
bgcolor: "error.light",
139139
color: "error.contrastText",

src/locales/en-US.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@
208208
"selectBtn": "Select File",
209209
"title": "Magpie Software Path"
210210
},
211-
"saveBtn": "Save",
212211
"saveError": "Failed to save path settings: {{error}}",
213212
"savePath": {
214213
"moveBackupWarning": "Backup path saved, but failed to migrate old backups: {{error}}",
@@ -218,8 +217,6 @@
218217
"selectBtn": "Select Directory",
219218
"title": "Game Save Backup Path"
220219
},
221-
"saveSuccess": "Path settings saved",
222-
"saving": "Saving...",
223220
"selectFileError": "Failed to select file: {{error}}",
224221
"selectFolderError": "Failed to select directory: {{error}}",
225222
"title": "Path Settings"
@@ -604,7 +601,6 @@
604601
"reloginRequired": "Bangumi login has expired. Please log in again.",
605602
"saveErrorWithDetail": "Failed to save BGM Token: {{error}}",
606603
"saveSuccess": "BGM Token saved successfully",
607-
"saveToken": "Save",
608604
"tokenExpiresAt": "Token expires at: {{date}}",
609605
"tokenExpiryUnknown": "Token expiry unknown",
610606
"tokenLogin": "Access Token login",
@@ -676,7 +672,6 @@
676672
"helperText": "For example: wine, /usr/bin/wine, ~/scripts/run-game.sh",
677673
"note": "Note: You need to restart the game for this setting to take effect.",
678674
"resetTooltip": "Reset to default (wine)",
679-
"saveBtn": "Save",
680675
"saveError": "Save failed",
681676
"saveSuccess": "Linux launch command saved",
682677
"title": "Linux Launch Command"
@@ -702,7 +697,7 @@
702697
"title": "NSFW Settings"
703698
},
704699
"pathSettings": {
705-
"note": "Configure paths for game save backups, LE region software, Magpie software, database backups, etc.",
700+
"note": "Configure paths for game save backups, database backups, LE region software, Magpie software, etc.",
706701
"openModal": "Open Path Settings",
707702
"title": "Path Settings"
708703
},
@@ -712,7 +707,6 @@
712707
"title": "Network Proxy Settings",
713708
"url": "Proxy Server Address"
714709
},
715-
"saveBtn": "Save",
716710
"sections": {
717711
"about": "About",
718712
"aboutDescription": "View version, update status, documentation, and feedback links.",

src/locales/ja-JP.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@
201201
"selectBtn": "ファイルを選択",
202202
"title": "Magpieソフトウェアパス"
203203
},
204-
"saveBtn": "保存",
205204
"saveError": "パス設定の保存に失敗しました:{{error}}",
206205
"savePath": {
207206
"moveBackupWarning": "バックアップパスは保存されましたが、古いバックアップの移行に失敗しました:{{error}}",
@@ -211,8 +210,6 @@
211210
"selectBtn": "ディレクトリを選択",
212211
"title": "ゲームセーブバックアップパス"
213212
},
214-
"saveSuccess": "パス設定を保存しました",
215-
"saving": "保存中...",
216213
"selectFileError": "ファイルの選択に失敗しました:{{error}}",
217214
"selectFolderError": "ディレクトリの選択に失敗しました:{{error}}",
218215
"title": "パス設定"
@@ -591,7 +588,6 @@
591588
"reloginRequired": "Bangumi のログインが無効になりました。再度ログインしてください。",
592589
"saveErrorWithDetail": "BGM Token の保存に失敗しました: {{error}}",
593590
"saveSuccess": "BGM Token の保存が成功しました",
594-
"saveToken": "保存",
595591
"tokenExpiresAt": "Token 有効期限: {{date}}",
596592
"tokenExpiryUnknown": "Token 有効期限不明",
597593
"tokenLogin": "Access Token ログイン",
@@ -663,7 +659,6 @@
663659
"helperText": "例: wine, /usr/bin/wine, ~/scripts/run-game.sh",
664660
"note": "注意: この設定を変更した後は、ゲームを再起動すると有効になります。",
665661
"resetTooltip": "デフォルト値 (wine) にリセット",
666-
"saveBtn": "保存",
667662
"saveError": "保存に失敗しました",
668663
"saveSuccess": "Linux 起動コマンドを保存しました",
669664
"title": "Linux 起動コマンド"
@@ -689,7 +684,7 @@
689684
"title": "NSFWセット"
690685
},
691686
"pathSettings": {
692-
"note": "ゲームセーブバックアップ、LE地域ソフトウェア、Magpieソフトウェア、データベースバックアップなどのパスを設定します",
687+
"note": "ゲームセーブバックアップ、データベースバックアップ、LE地域ソフトウェア、Magpieソフトウェアなどのパスを設定します",
693688
"openModal": "パス設定を開く",
694689
"title": "パス設定"
695690
},
@@ -699,7 +694,6 @@
699694
"title": "ネットワークプロキシ設定",
700695
"url": "プロキシサーバーアドレス"
701696
},
702-
"saveBtn": "保存",
703697
"sections": {
704698
"about": "について",
705699
"aboutDescription": "バージョン、更新状態、ドキュメント、フィードバックリンクを確認します。",

src/locales/zh-CN.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@
201201
"selectBtn": "选择文件",
202202
"title": "Magpie软件路径"
203203
},
204-
"saveBtn": "保存",
205204
"saveError": "保存路径设置失败:{{error}}",
206205
"savePath": {
207206
"moveBackupWarning": "备份路径已保存,但迁移旧备份失败:{{error}}",
@@ -211,8 +210,6 @@
211210
"selectBtn": "选择目录",
212211
"title": "游戏存档备份路径"
213212
},
214-
"saveSuccess": "路径设置已保存",
215-
"saving": "保存中...",
216213
"selectFileError": "选择文件失败:{{error}}",
217214
"selectFolderError": "选择目录失败:{{error}}",
218215
"title": "路径设置"
@@ -591,7 +588,6 @@
591588
"reloginRequired": "Bangumi 登录已失效,请重新登录。",
592589
"saveErrorWithDetail": "BGM Token 保存失败: {{error}}",
593590
"saveSuccess": "BGM Token 保存成功",
594-
"saveToken": "保存",
595591
"tokenExpiresAt": "Token 有效期至: {{date}}",
596592
"tokenExpiryUnknown": "Token 有效期未知",
597593
"tokenLogin": "Access Token 登录",
@@ -663,7 +659,6 @@
663659
"helperText": "例如: wine, /usr/bin/wine, ~/scripts/run-game.sh",
664660
"note": "注意:更改此设置后,需要重新启动游戏才能生效。",
665661
"resetTooltip": "重置为默认值 (wine)",
666-
"saveBtn": "保存",
667662
"saveError": "保存失败",
668663
"saveSuccess": "Linux 启动命令已保存",
669664
"title": "Linux 启动命令"
@@ -689,7 +684,7 @@
689684
"title": "NSFW 设置"
690685
},
691686
"pathSettings": {
692-
"note": "配置游戏存档备份、LE转区软件、Magpie软件、数据库备份等路径",
687+
"note": "配置游戏存档备份、数据库备份、LE转区软件、Magpie软件等路径",
693688
"openModal": "打开路径设置",
694689
"title": "路径设置"
695690
},
@@ -699,7 +694,6 @@
699694
"title": "网络代理设置",
700695
"url": "代理服务器地址"
701696
},
702-
"saveBtn": "保存",
703697
"sections": {
704698
"about": "关于",
705699
"aboutDescription": "查看版本、更新状态、文档和反馈入口。",

src/locales/zh-TW.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@
201201
"selectBtn": "選擇文件",
202202
"title": "Magpie軟體路徑"
203203
},
204-
"saveBtn": "儲存",
205204
"saveError": "儲存路徑設定失敗:{{error}}",
206205
"savePath": {
207206
"moveBackupWarning": "備份路徑已儲存,但遷移舊備份失敗:{{error}}",
@@ -211,8 +210,6 @@
211210
"selectBtn": "選擇目錄",
212211
"title": "遊戲存檔備份路徑"
213212
},
214-
"saveSuccess": "路徑設定已儲存",
215-
"saving": "保存中...",
216213
"selectFileError": "選擇文件失敗:{{error}}",
217214
"selectFolderError": "選擇目錄失敗:{{error}}",
218215
"title": "路徑設置"
@@ -591,7 +588,6 @@
591588
"reloginRequired": "Bangumi 登入已失效,請重新登入。",
592589
"saveErrorWithDetail": "BGM Token 儲存失敗: {{error}}",
593590
"saveSuccess": "BGM Token 儲存成功",
594-
"saveToken": "儲存",
595591
"tokenExpiresAt": "Token 有效期至: {{date}}",
596592
"tokenExpiryUnknown": "Token 有效期未知",
597593
"tokenLogin": "Access Token 登入",
@@ -663,7 +659,6 @@
663659
"helperText": "例如: wine, /usr/bin/wine, ~/scripts/run-game.sh",
664660
"note": "注意:變更此設定後,需要重新啟動遊戲才能生效。",
665661
"resetTooltip": "重設為預設值 (wine)",
666-
"saveBtn": "儲存",
667662
"saveError": "儲存失敗",
668663
"saveSuccess": "Linux 啟動命令已儲存",
669664
"title": "Linux 啟動命令"
@@ -689,7 +684,7 @@
689684
"title": "NSFW設定"
690685
},
691686
"pathSettings": {
692-
"note": "配置遊戲存檔備份、LE轉區軟體、Magpie軟體、數據庫備份等路徑",
687+
"note": "配置遊戲存檔備份、數據庫備份、LE轉區軟體、Magpie軟體等路徑",
693688
"openModal": "打開路徑設置",
694689
"title": "路徑設置"
695690
},
@@ -699,7 +694,6 @@
699694
"title": "網路代理設定",
700695
"url": "代理伺服器位址"
701696
},
702-
"saveBtn": "儲存",
703697
"sections": {
704698
"about": "關於",
705699
"aboutDescription": "查看版本、更新狀態、文件與回饋入口。",

0 commit comments

Comments
 (0)