收口 Makelore 客户端变更
This commit is contained in:
@@ -15,11 +15,21 @@ const moduleSelectionContent: Record<AiModuleId, { label: string; image: string;
|
||||
learning: { label: 'Learning 学习', image: moduleLearningImage, imageAlt: '数学科技宇宙' },
|
||||
};
|
||||
|
||||
export function ModuleSelection() {
|
||||
export function ModuleSelection({ authRequired = true }: { authRequired?: boolean }) {
|
||||
const navigate = useNavigate();
|
||||
const authUser = useAuthStore((state) => state.user);
|
||||
const authenticated = useAuthStore((state) => state.isAuthenticated());
|
||||
const userDisplayName = getAuthUserDisplayName(authUser);
|
||||
|
||||
const openModule = (route: string | null) => {
|
||||
if (!route) return;
|
||||
if (authRequired && !authenticated) {
|
||||
navigate('/login');
|
||||
return;
|
||||
}
|
||||
navigate(route);
|
||||
};
|
||||
|
||||
return (
|
||||
<main data-testid="ai-module-selection-page" className="relative min-h-[100dvh] overflow-auto bg-background px-4 py-6 text-foreground sm:px-8 sm:py-10">
|
||||
<div className="mx-auto flex min-h-[calc(100dvh-3rem)] max-w-6xl flex-col">
|
||||
@@ -47,9 +57,7 @@ export function ModuleSelection() {
|
||||
type="button"
|
||||
data-testid={`ai-module-option-${module.id}`}
|
||||
disabled={!module.enabled}
|
||||
onClick={() => {
|
||||
if (module.route) navigate(module.route);
|
||||
}}
|
||||
onClick={() => openModule(module.route)}
|
||||
aria-label={`${content.label}:${module.description}`}
|
||||
className={cn(
|
||||
'module-option-card group motion-press flex h-[254px] w-full max-w-[190px] flex-col justify-end rounded-lg border border-transparent bg-transparent p-0 text-left shadow-none disabled:cursor-not-allowed disabled:bg-transparent disabled:text-muted-foreground/70 disabled:opacity-75',
|
||||
|
||||
Reference in New Issue
Block a user