feat(characters): use local character catalog

This commit is contained in:
2026-07-17 16:03:18 +08:00
parent a210a98d98
commit b3ebd5cf3b
96 changed files with 1023 additions and 522 deletions
+7 -6
View File
@@ -5,8 +5,8 @@ import { signOut } from "next-auth/react";
import { BackButton } from "@/app/_components";
import { MobileShell } from "@/app/_components/core";
import { ROUTES } from "@/router/routes";
import { useAppNavigator } from "@/router/use-app-navigator";
import { useActiveCharacterRoutes } from "@/providers/character-provider";
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
import { useUserDispatch, useUserState } from "@/stores/user/user-context";
@@ -19,6 +19,7 @@ import styles from "./components/sidebar-screen.module.css";
export function SidebarScreen() {
const navigator = useAppNavigator();
const characterRoutes = useActiveCharacterRoutes();
const user = useUserState();
const userDispatch = useUserDispatch();
const auth = useAuthState();
@@ -31,7 +32,7 @@ export function SidebarScreen() {
userDispatch({ type: "UserClearLocal" });
authDispatch({ type: "AuthLogoutSubmitted" });
void signOut({ redirect: false });
navigator.replace(ROUTES.splash, { scroll: false });
navigator.replace(characterRoutes.splash, { scroll: false });
};
const view = getSidebarViewModel({
@@ -47,7 +48,7 @@ export function SidebarScreen() {
<div className={styles.topBar}>
<BackButton
href={ROUTES.chat}
href={characterRoutes.chat}
variant="soft"
analyticsKey="sidebar.back_to_chat"
/>
@@ -59,7 +60,7 @@ export function SidebarScreen() {
name={view.name}
avatarUrl={view.avatarUrl}
isLoading={view.isInitializingUser}
onLoginClick={() => navigator.openAuth(ROUTES.sidebar)}
onLoginClick={() => navigator.openAuth(characterRoutes.sidebar)}
/>
</section>
@@ -91,7 +92,7 @@ export function SidebarScreen() {
},
})
}
onRulesClick={() => navigator.push(ROUTES.coinsRules)}
onRulesClick={() => navigator.push(characterRoutes.coinsRules)}
/>
</section>
@@ -104,7 +105,7 @@ export function SidebarScreen() {
data-analytics-key="sidebar.open_feedback"
data-analytics-label="Open feedback"
className={`${styles.logoutCard} ${styles.feedbackCard}`}
onClick={() => navigator.push(ROUTES.feedback)}
onClick={() => navigator.push(characterRoutes.feedback)}
>
<span
className={`${styles.logoutIcon} ${styles.feedbackIcon}`}