feat: integrate learning module
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
inman
2026-08-16 20:52:16 +08:00
parent 26b52d76e3
commit 01bee3188b
107 changed files with 6318 additions and 12063 deletions

View File

@@ -1,13 +1,17 @@
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import moduleCanvasImage from '@/assets/module-canvas-neon.jpg';
import moduleGameImage from '@/assets/module-game.jpg';
import moduleLearningImage from '@/assets/module-learning.jpg';
import moduleRobotImage from '@/assets/module-robot.jpg';
import logoWordmarkSource from '@/assets/makelore-wordmark-source.png';
import { UserProfileDialog } from '@/components/profile/UserProfileDialog';
import { useCurrentUserProfile } from '@/hooks/use-current-user-profile';
import { aiModules, type AiModuleId } from '@/lib/ai-modules';
import { getAuthUserDisplayName } from '@/lib/auth-user-display';
import { cn } from '@/lib/utils';
import { useAuthStore } from '@/stores/auth';
import { getUserProfileDisplayName } from '@/stores/user-profile';
const moduleSelectionContent: Record<AiModuleId, { label: string; image: string; imageAlt: string }> = {
programming: { label: 'Code 编程', image: moduleGameImage, imageAlt: '游戏创作工作台' },
@@ -20,7 +24,18 @@ export function ModuleSelection({ authRequired = true }: { authRequired?: boolea
const navigate = useNavigate();
const authUser = useAuthStore((state) => state.user);
const authenticated = useAuthStore((state) => state.isAuthenticated());
const userDisplayName = getAuthUserDisplayName(authUser);
const {
userProfile,
profileRequired,
profileSyncError,
} = useCurrentUserProfile(authRequired);
const [profileDialogOpen, setProfileDialogOpen] = useState(false);
const userDisplayName = getUserProfileDisplayName(userProfile) || getAuthUserDisplayName(authUser);
const [dismissedSyncError, setDismissedSyncError] = useState<string | null>(null);
const profileDialogShouldBeOpen = profileDialogOpen
|| profileRequired
|| Boolean(profileSyncError && dismissedSyncError !== profileSyncError);
const openModule = (route: string | null) => {
if (!route) return;
@@ -92,6 +107,20 @@ export function ModuleSelection({ authRequired = true }: { authRequired?: boolea
</section>
</div>
</div>
<UserProfileDialog
open={profileDialogShouldBeOpen}
required={profileRequired}
syncError={profileSyncError}
onOpenChange={(open) => {
if (open) {
setDismissedSyncError(null);
setProfileDialogOpen(true);
return;
}
if (profileSyncError) setDismissedSyncError(profileSyncError);
setProfileDialogOpen(false);
}}
/>
</main>
);
}