refactor(app): move route screens out of components

Exclude test and spec files from generated barrels so page imports do not load test modules at runtime.
This commit is contained in:
2026-06-17 14:13:42 +08:00
parent cda76a1651
commit 287affa34a
16 changed files with 53 additions and 47 deletions
+7
View File
@@ -1,4 +1,11 @@
{
"exclude": [
"__tests__",
"\\.test\\.ts$",
"\\.test\\.tsx$",
"\\.spec\\.ts$",
"\\.spec\\.tsx$"
],
"directory": [
"./src/data/repositories",
"./src/data/repositories/interfaces",
@@ -7,15 +7,13 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { MobileShell } from "@/app/_components/core/mobile-shell";
import { MobileShell } from "@/app/_components/core";
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
import { useUserDispatch } from "@/stores/user/user-context";
import { ROUTES } from "@/router/routes";
import styles from "./auth-screen.module.css";
import { AuthBackground } from "./auth-background";
import { AuthPanel } from "./auth-panel";
import { AuthBackground, AuthPanel } from "./components";
import styles from "./components/auth-screen.module.css";
export function AuthScreen() {
const state = useAuthState();
-2
View File
@@ -11,11 +11,9 @@ export * from "./auth-legal-text";
export * from "./auth-other-options-dialog";
export * from "./auth-panel";
export * from "./auth-primary-button";
export * from "./auth-screen";
export * from "./auth-social-button";
export * from "./auth-social-buttons";
export * from "./auth-text-field";
export * from "./auth-validators";
export * from "./email-login-form";
export * from "./email-register-form";
export * from "./__tests__/auth-validators.test";
+1 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { AuthScreen } from "@/app/auth/components/auth-screen";
import { AuthScreen } from "@/app/auth/auth-screen";
export default function AuthPage() {
return <AuthScreen />;
@@ -30,15 +30,17 @@ import type { LoginStatus } from "@/models/auth/login-status";
import { AuthStorage } from "@/data/storage/auth/auth_storage";
import { useChatDispatch, useChatState } from "@/stores/chat/chat-context";
import { MobileShell } from "@/app/_components/core/mobile-shell";
import { MobileShell } from "@/app/_components/core";
import { BrowserHintOverlay } from "./browser-hint-overlay";
import { ChatArea } from "./chat-area";
import { ChatHeader } from "./chat-header";
import { ChatInputBar } from "./chat-input-bar";
import { ChatQuotaExhaustedBanner } from "./chat-quota-exhausted-banner";
import { PwaInstallOverlay } from "./pwa-install-overlay";
import styles from "./chat-screen.module.css";
import {
BrowserHintOverlay,
ChatArea,
ChatHeader,
ChatInputBar,
ChatQuotaExhaustedBanner,
PwaInstallOverlay,
} from "./components";
import styles from "./components/chat-screen.module.css";
/**
-1
View File
@@ -9,7 +9,6 @@ export * from "./chat-header";
export * from "./chat-input-bar";
export * from "./chat-input-text-field";
export * from "./chat-quota-exhausted-banner";
export * from "./chat-screen";
export * from "./chat-send-button";
export * from "./date-header";
export * from "./fullscreen-image-viewer";
+1 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { ChatScreen } from "@/app/chat/components/chat-screen";
import { ChatScreen } from "@/app/chat/chat-screen";
export default function ChatPage() {
return <ChatScreen />;
-1
View File
@@ -3,7 +3,6 @@
*/
export * from "./back-bar";
export * from "./sidebar-screen";
export * from "./user-header";
export * from "./vip-benefits-card";
export * from "./voice-package-card";
+1 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { SidebarScreen } from "@/app/sidebar/components/sidebar-screen";
import { SidebarScreen } from "@/app/sidebar/sidebar-screen";
export default function SidebarPage() {
return <SidebarScreen />;
@@ -3,18 +3,20 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { MobileShell } from "@/app/_components/core/mobile-shell";
import { SettingsSection } from "@/app/_components/core/settings-section";
import { MobileShell, SettingsSection } from "@/app/_components/core";
import { ROUTES } from "@/router/routes";
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
import { useUserDispatch, useUserState } from "@/stores/user/user-context";
import { BackBar } from "./back-bar";
import { UserHeader, type SidebarUserState } from "./user-header";
import { VipBenefitsCard } from "./vip-benefits-card";
import { VoicePackageCard } from "./voice-package-card";
import {
BackBar,
UserHeader,
type SidebarUserState,
VipBenefitsCard,
VoicePackageCard,
} from "./components";
import styles from "./sidebar-screen.module.css";
import styles from "./components/sidebar-screen.module.css";
const FALLBACK_USERNAME = "User name";
-1
View File
@@ -8,4 +8,3 @@ export * from "./splash-content";
export * from "./splash-loading";
export * from "./splash-logo";
export * from "./splash-progress";
export * from "./splash-screen";
+1 -1
View File
@@ -1,4 +1,4 @@
import { SplashScreen } from "@/app/splash/components/splash-screen";
import { SplashScreen } from "@/app/splash/splash-screen";
export default function SplashPage() {
return <SplashScreen />;
@@ -3,18 +3,20 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { MobileShell } from "@/app/_components/core/mobile-shell";
import { MobileShell } from "@/app/_components/core";
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
import { useUserDispatch } from "@/stores/user/user-context";
import { AuthStorage } from "@/data/storage/auth/auth_storage";
import { ROUTES } from "@/router/routes";
import { pwaUtil } from "@/utils/pwa";
import { SplashBackground } from "./splash-background";
import { SplashLogo } from "./splash-logo";
import { SplashContent } from "./splash-content";
import { SplashButton } from "./splash-button";
import styles from "./splash-screen.module.css";
import {
SplashBackground,
SplashButton,
SplashContent,
SplashLogo,
} from "./components";
import styles from "./components/splash-screen.module.css";
// 尽量早地缓存 beforeinstallprompt,避免用户停留 splash 时浏览器事件已触发并丢失。
if (typeof window !== "undefined") {
-1
View File
@@ -9,5 +9,4 @@ export * from "./subscription-checkout-button";
export * from "./subscription-cta-button";
export * from "./subscription-manage-button";
export * from "./subscription-plan-card";
export * from "./subscription-screen";
export * from "./subscription-user-row";
+1 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { SubscriptionScreen } from "@/app/subscription/components/subscription-screen";
import { SubscriptionScreen } from "@/app/subscription/subscription-screen";
export default function SubscriptionPage() {
return <SubscriptionScreen />;
@@ -16,8 +16,7 @@
*/
import { useState } from "react";
import { Checkbox } from "@/app/_components/core/checkbox";
import { MobileShell } from "@/app/_components/core/mobile-shell";
import { Checkbox, MobileShell } from "@/app/_components/core";
import { AppConstants } from "@/core/app_constants";
import {
SUBSCRIPTION_PLANS,
@@ -26,14 +25,16 @@ import {
import { VIP_BENEFITS } from "@/data/constants/vip-benefits";
import { useUserState } from "@/stores/user/user-context";
import { SubscriptionBackLink } from "./subscription-back-link";
import { SubscriptionBanner } from "./subscription-banner";
import { SubscriptionBenefitsCard } from "./subscription-benefits-card";
import { SubscriptionCheckoutButton } from "./subscription-checkout-button";
import { SubscriptionManageButton } from "./subscription-manage-button";
import { SubscriptionPlanCard } from "./subscription-plan-card";
import { SubscriptionUserRow } from "./subscription-user-row";
import styles from "./subscription-screen.module.css";
import {
SubscriptionBackLink,
SubscriptionBanner,
SubscriptionBenefitsCard,
SubscriptionCheckoutButton,
SubscriptionManageButton,
SubscriptionPlanCard,
SubscriptionUserRow,
} from "./components";
import styles from "./components/subscription-screen.module.css";
const FALLBACK_USERNAME = "User name";