From 3efcb3bba6c32290195ddde0f0978cb4a3cc9ed2 Mon Sep 17 00:00:00 2001
From: JiaJun <2394389886@qq.com>
Date: Tue, 2 Jun 2026 14:31:49 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E5=A4=9A?=
=?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=92=8C=E8=B5=B0=E9=A9=AC=E7=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 删除 src/locales/en-US/common.ts 文件中的所有国际化文案
- 删除 src/locales/id-ID/common.ts 文件中的所有国际化文案
- 移除与游戏、认证、UI组件相关的多语言配置项
- 清理导航、游戏大厅、语言选择等界面的翻译内容
- 移除登录注册表单、验证规则等认证相关文案
- 删除支付、提款、钱包记录等财务功能翻译项
---
package.json | 2 +
pnpm-lock.yaml | 40 ++++++
.../components/desktop/desktop-animal.tsx | 8 +-
.../game/components/desktop/desktop-title.tsx | 132 ++++++++++++++----
src/i18n/index.ts | 16 +--
src/locales/{en-US/common.ts => en-US.ts} | 0
src/locales/{id-ID/common.ts => id-ID.ts} | 0
src/locales/{ms-MY/common.ts => ms-MY.ts} | 0
src/locales/{zh-CN/common.ts => zh-CN.ts} | 0
src/style/index.css | 18 ---
10 files changed, 155 insertions(+), 61 deletions(-)
rename src/locales/{en-US/common.ts => en-US.ts} (100%)
rename src/locales/{id-ID/common.ts => id-ID.ts} (100%)
rename src/locales/{ms-MY/common.ts => ms-MY.ts} (100%)
rename src/locales/{zh-CN/common.ts => zh-CN.ts} (100%)
diff --git a/package.json b/package.json
index 6ffcc25..fc48557 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,8 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dayjs": "^1.11.20",
+ "embla-carousel-auto-scroll": "^8.6.0",
+ "embla-carousel-react": "^8.6.0",
"i18next": "^26.0.5",
"ky": "^2.0.1",
"lottie-web": "^5.13.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c9374d7..e1c0e60 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -38,6 +38,12 @@ importers:
dayjs:
specifier: ^1.11.20
version: 1.11.20
+ embla-carousel-auto-scroll:
+ specifier: ^8.6.0
+ version: 8.6.0(embla-carousel@8.6.0)
+ embla-carousel-react:
+ specifier: ^8.6.0
+ version: 8.6.0(react@19.2.5)
i18next:
specifier: ^26.0.5
version: 26.0.5(typescript@6.0.2)
@@ -2234,6 +2240,24 @@ packages:
electron-to-chromium@1.5.338:
resolution: {integrity: sha512-KVQQ3xko9/coDX3qXLUEEbqkKT8L+1DyAovrtu0Khtrt9wjSZ+7CZV4GVzxFy9Oe1NbrIU1oVXCwHJruIA1PNg==}
+ embla-carousel-auto-scroll@8.6.0:
+ resolution: {integrity: sha512-WT9fWhNXFpbQ6kP+aS07oF5IHYLZ1Dx4DkwgCY8Hv2ZyYd2KMCPfMV1q/cA3wFGuLO7GMgKiySLX90/pQkcOdQ==}
+ peerDependencies:
+ embla-carousel: 8.6.0
+
+ embla-carousel-react@8.6.0:
+ resolution: {integrity: sha512-0/PjqU7geVmo6F734pmPqpyHqiM99olvyecY7zdweCw+6tKEXnrE90pBiBbMMU8s5tICemzpQ3hi5EpxzGW+JA==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.1 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
+
+ embla-carousel-reactive-utils@8.6.0:
+ resolution: {integrity: sha512-fMVUDUEx0/uIEDM0Mz3dHznDhfX+znCCDCeIophYb1QGVM7YThSWX+wz11zlYwWFOr74b4QLGg0hrGPJeG2s4A==}
+ peerDependencies:
+ embla-carousel: 8.6.0
+
+ embla-carousel@8.6.0:
+ resolution: {integrity: sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==}
+
emoji-regex@10.6.0:
resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==}
@@ -5888,6 +5912,22 @@ snapshots:
electron-to-chromium@1.5.338: {}
+ embla-carousel-auto-scroll@8.6.0(embla-carousel@8.6.0):
+ dependencies:
+ embla-carousel: 8.6.0
+
+ embla-carousel-react@8.6.0(react@19.2.5):
+ dependencies:
+ embla-carousel: 8.6.0
+ embla-carousel-reactive-utils: 8.6.0(embla-carousel@8.6.0)
+ react: 19.2.5
+
+ embla-carousel-reactive-utils@8.6.0(embla-carousel@8.6.0):
+ dependencies:
+ embla-carousel: 8.6.0
+
+ embla-carousel@8.6.0: {}
+
emoji-regex@10.6.0: {}
emoji-regex@8.0.0: {}
diff --git a/src/features/game/components/desktop/desktop-animal.tsx b/src/features/game/components/desktop/desktop-animal.tsx
index 484731c..524ea0f 100644
--- a/src/features/game/components/desktop/desktop-animal.tsx
+++ b/src/features/game/components/desktop/desktop-animal.tsx
@@ -16,8 +16,8 @@ import { useGameRoundStore } from '@/store/game'
const SETTLEMENT_REVEAL_RANDOM_DURATION_MS = 3_200
const SETTLEMENT_REVEAL_SETTLE_DURATION_MS = 800
const SETTLEMENT_REVEAL_RESULT_HOLD_MS = 1_000
-const SETTLEMENT_REVEAL_MIN_STEP_MS = 90
-const SETTLEMENT_REVEAL_MAX_STEP_MS = 480
+const SETTLEMENT_REVEAL_MIN_STEP_MS = 180
+const SETTLEMENT_REVEAL_MAX_STEP_MS = 960
function getRandomAnimalId(ids: number[], currentId: number | null) {
if (ids.length === 0) {
@@ -436,12 +436,12 @@ export function DesktopAnimal({
= 8) {
+ return 2
+ }
+
+ if (titleCount >= 5) {
+ return 3
+ }
+
+ if (titleCount >= 3) {
+ return 5
+ }
+
+ return 8
+}
function formatWinAmount(value: string) {
const amount = Number(value)
@@ -16,22 +34,77 @@ export function DesktopTitle() {
const jackpotBroadcasts = useGameSessionStore(
(state) => state.jackpotBroadcasts,
)
- const titles =
- jackpotBroadcasts.length > 0
- ? jackpotBroadcasts.map((broadcast) => ({
- id: broadcast.id,
- message: `Player ${broadcast.nickname} won ${formatWinAmount(
- broadcast.totalWin,
- )}`,
- }))
- : [{ id: 'empty', message: '' }]
- const marqueeTitles =
- jackpotBroadcasts.length > 0
- ? [
- ...titles.map((title) => ({ ...title, id: `${title.id}:first` })),
- ...titles.map((title) => ({ ...title, id: `${title.id}:second` })),
- ]
- : titles
+ const hasBroadcasts = jackpotBroadcasts.length > 0
+ const titles = useMemo(
+ () =>
+ hasBroadcasts
+ ? jackpotBroadcasts.map((broadcast) => ({
+ id: broadcast.id,
+ message: `Player ${broadcast.nickname} won ${formatWinAmount(
+ broadcast.totalWin,
+ )}`,
+ }))
+ : [{ id: 'empty', message: '' }],
+ [hasBroadcasts, jackpotBroadcasts],
+ )
+ const carouselTitles = useMemo(
+ () =>
+ hasBroadcasts
+ ? Array.from(
+ { length: getDesktopTitleCarouselCycleCount(titles.length) },
+ (_, cycleIndex) =>
+ titles.map((title) => ({
+ ...title,
+ cycleIndex,
+ id: `${title.id}:cycle-${cycleIndex}`,
+ })),
+ ).flat()
+ : titles.map((title) => ({ ...title, cycleIndex: 0 })),
+ [hasBroadcasts, titles],
+ )
+ const carouselTitleCount = carouselTitles.length
+ const autoScrollPlugin = useMemo(
+ () =>
+ AutoScroll({
+ playOnInit: hasBroadcasts,
+ speed: 0.7,
+ startDelay: 0,
+ stopOnFocusIn: false,
+ stopOnInteraction: false,
+ stopOnMouseEnter: false,
+ }),
+ [hasBroadcasts],
+ )
+ const [emblaRef, emblaApi] = useEmblaCarousel(
+ {
+ align: 'start',
+ dragFree: true,
+ loop: hasBroadcasts,
+ watchDrag: false,
+ },
+ [autoScrollPlugin],
+ )
+
+ useEffect(() => {
+ if (!emblaApi) {
+ return
+ }
+
+ if (carouselTitleCount === 0) {
+ return
+ }
+
+ emblaApi.reInit()
+ const autoScroll = emblaApi.plugins().autoScroll
+
+ if (!hasBroadcasts) {
+ autoScroll?.stop()
+ return
+ }
+
+ autoScroll?.reset()
+ autoScroll?.play()
+ }, [emblaApi, hasBroadcasts, carouselTitleCount])
return (
@@ -41,21 +114,18 @@ export function DesktopTitle() {
src={broadcast}
/>
-
0
- ? 'desktop-title-horizontal-marquee'
- : ''
- }
- >
- {marqueeTitles.map((title) => (
-
- {title.message}
-
- ))}
+
+
+ {carouselTitles.map((title) => (
+
0}
+ className="flex h-design-28 min-w-0 shrink-0 items-center whitespace-nowrap !text-[#FF970F]"
+ key={title.id}
+ >
+ {title.message}
+
+ ))}
+
diff --git a/src/i18n/index.ts b/src/i18n/index.ts
index 3d457da..1587008 100644
--- a/src/i18n/index.ts
+++ b/src/i18n/index.ts
@@ -2,10 +2,10 @@ import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import { DEFAULT_APP_LANGUAGE, SUPPORTED_LANGUAGES } from '@/constants/system'
-import enUSCommon from '@/locales/en-US/common'
-import idIDCommon from '@/locales/id-ID/common'
-import msMYCommon from '@/locales/ms-MY/common'
-import zhCNCommon from '@/locales/zh-CN/common'
+import enUS from '@/locales/en-US'
+import idID from '@/locales/id-ID'
+import msMY from '@/locales/ms-MY'
+import zhCN from '@/locales/zh-CN'
import { getStoredAppLanguage, setStoredAppLanguage } from '@/store/auth'
export type AppLanguage = (typeof SUPPORTED_LANGUAGES)[number]
@@ -53,16 +53,16 @@ void i18n.use(initReactI18next).init({
},
resources: {
'zh-CN': {
- common: zhCNCommon,
+ common: zhCN,
},
'en-US': {
- common: enUSCommon,
+ common: enUS,
},
'ms-MY': {
- common: msMYCommon,
+ common: msMY,
},
'id-ID': {
- common: idIDCommon,
+ common: idID,
},
},
defaultNS: 'common',
diff --git a/src/locales/en-US/common.ts b/src/locales/en-US.ts
similarity index 100%
rename from src/locales/en-US/common.ts
rename to src/locales/en-US.ts
diff --git a/src/locales/id-ID/common.ts b/src/locales/id-ID.ts
similarity index 100%
rename from src/locales/id-ID/common.ts
rename to src/locales/id-ID.ts
diff --git a/src/locales/ms-MY/common.ts b/src/locales/ms-MY.ts
similarity index 100%
rename from src/locales/ms-MY/common.ts
rename to src/locales/ms-MY.ts
diff --git a/src/locales/zh-CN/common.ts b/src/locales/zh-CN.ts
similarity index 100%
rename from src/locales/zh-CN/common.ts
rename to src/locales/zh-CN.ts
diff --git a/src/style/index.css b/src/style/index.css
index 83d2c90..761decc 100644
--- a/src/style/index.css
+++ b/src/style/index.css
@@ -525,24 +525,6 @@
display: none;
}
- .desktop-title-horizontal-marquee {
- display: flex;
- width: max-content;
- gap: calc(var(--design-unit) * 80);
- animation: desktop-title-marquee-x 16s linear infinite;
- will-change: transform;
- }
-
- @keyframes desktop-title-marquee-x {
- from {
- transform: translateX(0);
- }
-
- to {
- transform: translateX(-50%);
- }
- }
-
@property --gold-angle {
syntax: "
";
inherits: false;