Admin console additions (Layer 228): - Give Gifts: dedicated tab with sorted Lottie/TGS gift picker + inline form; grant any catalog gift to a user/channel from 777000 (no charge) - Upgraded/collectible delivery: mint a unique gift with admin-selected model/pattern/backdrop and custom number, or random/auto (DB FK + UNIQUE(gift_id,num) enforce invariants) - SCAM/FAKE flags for users/channels (migration 0136) with configurable profile warning (TELESRV_SCAM_WARNING/TELESRV_FAKE_WARNING) - Support toggle, force channel settings incl. gigagroup (migration 0137), username management, cosmetic color/emoji-status - Emoji admin tab (custom emoji list + document IDs + Lottie/TGS preview) - Bot management; soft UI / dark theme Wired through Router -> admin.Service -> adminapi -> BFF -> React panel (en/zh/ru).
39 lines
1.6 KiB
TypeScript
39 lines
1.6 KiB
TypeScript
import type { TFunction } from "./i18n";
|
|
|
|
export type Navigate = (href: string) => void;
|
|
|
|
export type RouteState = {
|
|
href: string;
|
|
path: string;
|
|
search: URLSearchParams;
|
|
};
|
|
|
|
export function currentRoute(): RouteState {
|
|
return {
|
|
href: `${window.location.pathname}${window.location.search}`,
|
|
path: window.location.pathname,
|
|
search: new URLSearchParams(window.location.search)
|
|
};
|
|
}
|
|
|
|
export function routeTitle(pathname: string, t: TFunction): string {
|
|
if (pathname.startsWith("/accounts")) return t("route.accounts");
|
|
if (pathname.startsWith("/channels")) return t("route.channels");
|
|
if (pathname.startsWith("/bots")) return t("route.bots");
|
|
if (pathname.startsWith("/emoji")) return t("route.emoji");
|
|
if (pathname.startsWith("/messages")) return t("route.messages");
|
|
if (pathname.startsWith("/give-gifts")) return t("route.giveGifts");
|
|
if (pathname.startsWith("/gifts")) return t("route.gifts");
|
|
return t("route.dashboard");
|
|
}
|
|
|
|
export function routeSubtitle(pathname: string, t: TFunction): string {
|
|
if (pathname.startsWith("/accounts")) return t("route.accountsSubtitle");
|
|
if (pathname.startsWith("/channels")) return t("route.channelsSubtitle");
|
|
if (pathname.startsWith("/bots")) return t("route.botsSubtitle");
|
|
if (pathname.startsWith("/emoji")) return t("route.emojiSubtitle");
|
|
if (pathname.startsWith("/messages")) return t("route.messagesSubtitle");
|
|
if (pathname.startsWith("/give-gifts")) return t("route.giveGiftsSubtitle");
|
|
if (pathname.startsWith("/gifts")) return t("route.giftsSubtitle");
|
|
return t("route.dashboardSubtitle");
|
|
}
|