feat: enhance player panel and draw status handling
- Refactored PlayerPanel layout for improved title positioning and responsiveness. - Added new function to check if betting is blocked based on hall status. - Updated HallDrawPanel to utilize the new betting status check and display appropriate messages. - Enhanced i18n support with new notices for review and non-bettable states across multiple languages.
This commit is contained in:
@@ -53,17 +53,6 @@ const resources = {
|
||||
Record<(typeof namespaces)[number], Record<string, unknown>>
|
||||
>;
|
||||
|
||||
function resolveInitialLanguage(): AppLanguage {
|
||||
// SSR 始终使用默认语言,避免首屏渲染依赖浏览器状态
|
||||
if (typeof window === "undefined") {
|
||||
return DEFAULT_LANGUAGE;
|
||||
}
|
||||
|
||||
const stored = window.localStorage.getItem("i18nextLng");
|
||||
const preferred = normalizeLanguage(stored ?? window.navigator.language);
|
||||
return preferred;
|
||||
}
|
||||
|
||||
export function syncDocumentLanguage(lang: AppLanguage): void {
|
||||
if (typeof document === "undefined") return;
|
||||
|
||||
@@ -83,17 +72,15 @@ export function syncPreferredLanguage(): void {
|
||||
}
|
||||
|
||||
if (!i18n.isInitialized) {
|
||||
const initialLng = resolveInitialLanguage();
|
||||
|
||||
void i18n.use(initReactI18next).init({
|
||||
resources,
|
||||
fallbackLng: DEFAULT_LANGUAGE,
|
||||
supportedLngs: ["en", "ne", "zh"],
|
||||
defaultNS: "common",
|
||||
ns: [...namespaces],
|
||||
/** 始终先用默认语言完成 SSR / 首次 hydration,避免首屏文本不一致 */
|
||||
/** 与 SSR 一致:首屏固定默认语言,hydration 后再由 syncPreferredLanguage 切换 */
|
||||
load: "languageOnly",
|
||||
lng: initialLng,
|
||||
lng: DEFAULT_LANGUAGE,
|
||||
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
"hall": "Betting Hall",
|
||||
"noIssue": "No available issue. Please try again later.",
|
||||
"sealedNotice": "Closed. Please wait for the next issue.",
|
||||
"reviewNotice": "Draw results are pending admin review. The next issue opens after publish.",
|
||||
"notBettableNotice": "Betting is not available right now. Please try again later.",
|
||||
"status": {
|
||||
"pending": "Not started",
|
||||
"open": "Open",
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
"hall": "बेटिङ हल",
|
||||
"noIssue": "उपलब्ध इश्यू छैन। कृपया पछि प्रयास गर्नुहोस्।",
|
||||
"sealedNotice": "बन्द भयो। कृपया अर्को इश्यू पर्खनुहोस्।",
|
||||
"reviewNotice": "नतिजा प्रशासक समीक्षामा छ। प्रकाशन पछि अर्को इश्यू खुल्छ।",
|
||||
"notBettableNotice": "अहिले बाजी लगाउन मिल्दैन। कृपया पछि प्रयास गर्नुहोस्।",
|
||||
"status": {
|
||||
"pending": "सुरु भएको छैन",
|
||||
"open": "खुला",
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
"hall": "下注大厅",
|
||||
"noIssue": "暂无可用期号,请稍后再试",
|
||||
"sealedNotice": "已封盘,请等待下一期。",
|
||||
"reviewNotice": "开奖结果待后台审核发布,审核通过后将开启下一期。",
|
||||
"notBettableNotice": "当前不可下注,请稍后再试。",
|
||||
"status": {
|
||||
"pending": "未开始",
|
||||
"open": "可下注",
|
||||
|
||||
Reference in New Issue
Block a user