import { type Navigate, type RouteState } from "../routing"; import { AccountDetailPage } from "./AccountDetailPage"; import { AccountRatingDetailPage } from "./AccountRatingDetailPage"; import { AccountRatingsPage } from "./AccountRatingsPage"; import { AccountsPage } from "./AccountsPage"; import { CollectibleUsernameDetailPage } from "./CollectibleUsernameDetailPage"; import { CollectibleUsernamesPage } from "./CollectibleUsernamesPage"; import { ChannelDetailPage } from "./ChannelDetailPage"; import { ChannelsPage } from "./ChannelsPage"; import { BotDetailPage } from "./BotDetailPage"; import { BotsPage } from "./BotsPage"; import { Dashboard } from "./Dashboard"; import { GroupMessageDetailPage } from "./GroupMessageDetailPage"; import { GroupMessagesPage } from "./GroupMessagesPage"; import { MessageDetailPage } from "./MessageDetailPage"; import { MessagesPage } from "./MessagesPage"; import { GiftsPage } from "./GiftsPage"; import { StickerSetsPage } from "./StickerSetsPage"; import { GiveGiftsPage } from "./GiveGiftsPage"; import { ModerationCaseDetailPage } from "./ModerationCaseDetailPage"; import { ModerationCasesPage } from "./ModerationCasesPage"; import { StoragePage } from "./StoragePage"; import { BotVerificationPage } from "./BotVerificationPage"; import { BotVerificationRequestPage } from "./BotVerificationRequestPage"; import { VerificationDetailPage } from "./VerificationDetailPage"; import { VerificationPage } from "./VerificationPage"; import { PermissionGate, permissionBotVerificationReview, permissionVerificationReview } from "../permissions"; export function Routes({ route, navigate }: { route: RouteState; navigate: Navigate }) { const accountID = route.path.match(/^\/accounts\/(\d+)$/)?.[1]; const channelID = route.path.match(/^\/channels\/(\d+)$/)?.[1]; const botID = route.path.match(/^\/bots\/(\d+)$/)?.[1]; const moderationCaseID = route.path.match(/^\/moderation\/(\d+)$/)?.[1]; // int64 ids stay strings so large values never lose precision. const collectibleUsernameID = route.path.match(/^\/collectible-usernames\/(\d+)$/)?.[1]; const ratingUserID = route.path.match(/^\/account-ratings\/(\d+)$/)?.[1]; const verificationID = route.path.match(/^\/verification\/(\d+)$/)?.[1]; // Third-party verification: a separate section with its own rights, matched before // the official one so neither prefix can shadow the other. const botVerificationRequestID = route.path.match(/^\/bot-verification\/(\d+)$/)?.[1]; if (botVerificationRequestID) { return ( ); } if (route.path === "/bot-verification") { return ( ); } // The detail match has to be tested before the exact "/verification" branch, and // the whole section is wrapped in the permission gate so a direct URL explains // itself instead of rendering an empty queue. if (verificationID) { return ( ); } if (route.path === "/verification") { return ( ); } if (collectibleUsernameID) { return ; } if (ratingUserID) { return ; } if (route.path === "/collectible-usernames") { return ; } if (route.path === "/account-ratings") { return ; } if (route.path === "/storage") { return ; } if (accountID) { return ; } if (channelID) { return ; } if (botID) { return ; } if (moderationCaseID) { return ; } if (route.path === "/accounts") { return ; } if (route.path === "/channels") { return ; } if (route.path === "/bots") { return ; } if (route.path === "/moderation") { return ; } if (route.path === "/emoji") { return ; } if (route.path === "/gifts") { return ; } if (route.path === "/stickers") { return ; } if (route.path === "/give-gifts") { return ; } if (route.path === "/messages/detail" || route.path === "/messages/private/detail") { return ( ); } if (route.path === "/messages/groups/detail") { return ( ); } if (route.path === "/messages/groups") { return ; } if (route.path === "/messages" || route.path === "/messages/private") { return ; } return ; }