refactor(admin, draws, settlement): unify admin datetime display and tighten wallet write permission
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
|
||||
import { getAdminDashboard } from "@/api/admin-dashboard";
|
||||
import { useAsyncEffect } from "@/hooks/use-async-effect";
|
||||
import { useAdminDateTimeFormatter } from "@/hooks/use-admin-datetime-formatter";
|
||||
import { useTranslationRef } from "@/hooks/use-translation-ref";
|
||||
import { useCachedPlayTypeOptions } from "@/hooks/use-cached-play-type-options";
|
||||
import { useAdminCurrencyCatalog } from "@/hooks/use-admin-currency-catalog";
|
||||
@@ -50,6 +51,7 @@ import { LotteryApiBizError } from "@/types/api/errors";
|
||||
export function AgentDashboardConsole(): ReactElement {
|
||||
const { t, i18n } = useTranslation(["dashboard", "common", "agents"]);
|
||||
const tRef = useTranslationRef(["dashboard", "common"]);
|
||||
const formatDt = useAdminDateTimeFormatter();
|
||||
const profile = useAdminProfile();
|
||||
const agent = profile?.agent ?? null;
|
||||
const permissions = useMemo(() => profile?.permissions ?? [], [profile?.permissions]);
|
||||
@@ -252,7 +254,7 @@ export function AgentDashboardConsole(): ReactElement {
|
||||
<span>{t("agent.settlementCycle", { cycle: overview.settlement_cycle })}</span>
|
||||
<span>
|
||||
{overview.latest_bet_at
|
||||
? t("agent.latestBetAt", { time: new Date(overview.latest_bet_at).toLocaleString() })
|
||||
? t("agent.latestBetAt", { time: formatDt(overview.latest_bet_at) })
|
||||
: t("agent.noBetToday")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,9 @@ import { buttonVariants } from "@/components/ui/button";
|
||||
import { AdminNoResourceState } from "@/components/admin/admin-no-resource-state";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { useAdminDateTimeFormatter } from "@/hooks/use-admin-datetime-formatter";
|
||||
import { formatAdminInstantInTimeZone } from "@/lib/admin-datetime";
|
||||
import { getAdminRequestLocale } from "@/lib/admin-locale";
|
||||
import { LOTTERY_SCHEDULE_TIMEZONE } from "@/lib/lottery-schedule-timezone";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { DrawCurrentSnapshot } from "@/types/api/public-draw";
|
||||
|
||||
@@ -62,7 +64,11 @@ export function DashboardCurrentDrawCard({
|
||||
loading = false,
|
||||
}: DashboardCurrentDrawCardProps): ReactElement {
|
||||
const { t } = useTranslation(["dashboard", "draws"]);
|
||||
const formatDt = useAdminDateTimeFormatter();
|
||||
const formatDt = (iso: string | null | undefined): string =>
|
||||
formatAdminInstantInTimeZone(iso, {
|
||||
locale: getAdminRequestLocale(),
|
||||
timeZone: LOTTERY_SCHEDULE_TIMEZONE,
|
||||
});
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user