From eaf97b8279a9d651f1187a12a5a12c942f0527f5 Mon Sep 17 00:00:00 2001 From: goddonebianu Date: Mon, 2 Feb 2026 23:57:01 +0800 Subject: [PATCH] ... --- src/app/(features)/alphabet/AlphabetCard.tsx | 4 ++-- src/app/(features)/alphabet/MemoryCard.tsx | 4 ++-- src/app/(features)/alphabet/page.tsx | 4 ++-- .../(features)/dictionary/DictionaryEntry.tsx | 2 +- src/app/(features)/dictionary/SearchResult.tsx | 4 ++-- src/app/(features)/dictionary/page.tsx | 6 +++--- src/app/(features)/dictionary/utils.ts | 4 ++-- src/app/(features)/memorize/FolderSelector.tsx | 2 +- src/app/(features)/memorize/Memorize.tsx | 2 +- src/app/(features)/memorize/page.tsx | 6 +++--- .../srt-player/VideoPlayer/SubtitleDisplay.tsx | 2 +- .../srt-player/VideoPlayer/VideoPanel.tsx | 4 ++-- .../srt-player/components/atoms/FileInput.tsx | 2 +- .../srt-player/components/atoms/PlayButton.tsx | 2 +- .../srt-player/components/atoms/SeekBar.tsx | 2 +- .../components/atoms/SpeedControl.tsx | 2 +- .../components/atoms/SubtitleText.tsx | 2 +- .../components/atoms/VideoElement.tsx | 2 +- .../components/compounds/ControlBar.tsx | 6 +++--- .../components/compounds/SubtitleArea.tsx | 4 ++-- .../components/compounds/UploadZone.tsx | 2 +- .../components/compounds/VideoPlayer.tsx | 4 ++-- src/app/(features)/srt-player/page.tsx | 10 +++++----- src/app/(features)/text-speaker/SaveList.tsx | 4 ++-- src/app/(features)/text-speaker/page.tsx | 6 +++--- src/app/(features)/translator/page.tsx | 6 +++--- src/app/auth/AuthForm.tsx | 8 ++++---- src/app/auth/page.tsx | 2 +- src/app/folders/FoldersClient.tsx | 10 +++++----- .../folders/[folder_id]/AddTextPairModal.tsx | 4 ++-- src/app/folders/[folder_id]/InFolder.tsx | 12 ++++++------ src/app/folders/[folder_id]/TextPairCard.tsx | 7 ++++--- .../[folder_id]/UpdateTextPairModal.tsx | 6 +++--- src/app/folders/[folder_id]/page.tsx | 4 ++-- src/app/folders/page.tsx | 2 +- src/app/profile/LogoutButton.tsx | 2 +- src/app/profile/page.tsx | 6 +++--- src/auth.ts | 2 +- src/components/LanguageSettings.tsx | 4 ++-- src/components/layout/Navbar.tsx | 4 ++-- src/components/ui/Button.tsx | 2 +- src/components/ui/CardList.tsx | 2 +- src/components/ui/Container.tsx | 2 +- src/components/ui/Input.tsx | 2 +- src/components/ui/PageHeader.tsx | 2 +- src/components/ui/PageLayout.tsx | 2 +- src/components/ui/buttons/index.tsx | 2 +- src/config/images.ts | 2 +- src/hooks/useFileUpload.ts | 2 +- src/lib/bigmodel/dictionary/index.ts | 18 ------------------ src/lib/bigmodel/translator/index.ts | 2 -- src/lib/db.ts | 2 +- src/modules/auth/index.ts | 1 - .../dictionary/dictionary-action-dto.ts | 2 +- .../dictionary/dictionary-repository-dto.ts | 2 +- .../dictionary/dictionary-repository.ts | 2 +- .../dictionary/dictionary-service-dto.ts | 2 +- src/modules/dictionary/dictionary-service.ts | 2 +- src/modules/dictionary/index.ts | 2 -- src/modules/folder/folder-repository.ts | 2 +- src/modules/folder/index.ts | 2 -- src/modules/translator/index.ts | 2 -- .../translator/translator-action-dto.ts | 2 +- .../translator/translator-repository.ts | 2 +- .../translator/translator-service-dto.ts | 2 +- src/modules/translator/translator-service.ts | 2 +- src/shared/index.ts | 2 -- 67 files changed, 106 insertions(+), 134 deletions(-) delete mode 100644 src/lib/bigmodel/dictionary/index.ts delete mode 100644 src/lib/bigmodel/translator/index.ts delete mode 100644 src/modules/auth/index.ts delete mode 100644 src/modules/dictionary/index.ts delete mode 100644 src/modules/folder/index.ts delete mode 100644 src/modules/translator/index.ts delete mode 100644 src/shared/index.ts diff --git a/src/app/(features)/alphabet/AlphabetCard.tsx b/src/app/(features)/alphabet/AlphabetCard.tsx index fd14856..963d8fd 100644 --- a/src/app/(features)/alphabet/AlphabetCard.tsx +++ b/src/app/(features)/alphabet/AlphabetCard.tsx @@ -4,7 +4,7 @@ import { useState, useEffect, useCallback } from "react"; import { useTranslations } from "next-intl"; import { Letter, SupportedAlphabets } from "@/lib/interfaces"; import { IconClick } from "@/components/ui/buttons"; -import IMAGES from "@/config/images"; +import { IMAGES } from "@/config/images"; import { ChevronLeft, ChevronRight } from "lucide-react"; interface AlphabetCardProps { @@ -13,7 +13,7 @@ interface AlphabetCardProps { onBack: () => void; } -export default function AlphabetCard({ alphabet, alphabetType, onBack }: AlphabetCardProps) { +export function AlphabetCard({ alphabet, alphabetType, onBack }: AlphabetCardProps) { const t = useTranslations("alphabet"); const [currentIndex, setCurrentIndex] = useState(0); const [showIPA, setShowIPA] = useState(true); diff --git a/src/app/(features)/alphabet/MemoryCard.tsx b/src/app/(features)/alphabet/MemoryCard.tsx index a14bf8a..8b29e41 100644 --- a/src/app/(features)/alphabet/MemoryCard.tsx +++ b/src/app/(features)/alphabet/MemoryCard.tsx @@ -1,6 +1,6 @@ import { LightButton } from "@/components/ui/buttons"; import { IconClick } from "@/components/ui/buttons"; -import IMAGES from "@/config/images"; +import { IMAGES } from "@/config/images"; import { Letter, SupportedAlphabets } from "@/lib/interfaces"; import { Dispatch, @@ -12,7 +12,7 @@ import { } from "react"; import { useTranslations } from "next-intl"; -export default function MemoryCard({ +export function MemoryCard({ alphabet, setChosenAlphabet, }: { diff --git a/src/app/(features)/alphabet/page.tsx b/src/app/(features)/alphabet/page.tsx index b38131f..e437d7a 100644 --- a/src/app/(features)/alphabet/page.tsx +++ b/src/app/(features)/alphabet/page.tsx @@ -3,9 +3,9 @@ import { useState, useEffect } from "react"; import { useTranslations } from "next-intl"; import { Letter, SupportedAlphabets } from "@/lib/interfaces"; -import Container from "@/components/ui/Container"; +import { Container } from "@/components/ui/Container"; import { LightButton } from "@/components/ui/buttons"; -import AlphabetCard from "./AlphabetCard"; +import { AlphabetCard } from "./AlphabetCard"; export default function Alphabet() { const t = useTranslations("alphabet"); diff --git a/src/app/(features)/dictionary/DictionaryEntry.tsx b/src/app/(features)/dictionary/DictionaryEntry.tsx index 5d09954..bbf28a3 100644 --- a/src/app/(features)/dictionary/DictionaryEntry.tsx +++ b/src/app/(features)/dictionary/DictionaryEntry.tsx @@ -1,4 +1,4 @@ -import { TSharedEntry } from "@/shared"; +import { TSharedEntry } from "@/shared/dictionary-type"; interface DictionaryEntryProps { entry: TSharedEntry; diff --git a/src/app/(features)/dictionary/SearchResult.tsx b/src/app/(features)/dictionary/SearchResult.tsx index 9c6846b..c8328cd 100644 --- a/src/app/(features)/dictionary/SearchResult.tsx +++ b/src/app/(features)/dictionary/SearchResult.tsx @@ -4,9 +4,9 @@ import { authClient } from "@/lib/auth-client"; import { DictionaryEntry } from "./DictionaryEntry"; import { useTranslations } from "next-intl"; import { performDictionaryLookup } from "./utils"; -import { TSharedItem } from "@/shared"; +import { TSharedItem } from "@/shared/dictionary-type"; import { TSharedFolder } from "@/shared/folder-type"; -import { actionCreatePair } from "@/modules/folder"; +import { actionCreatePair } from "@/modules/folder/folder-aciton"; interface SearchResultProps { searchResult: TSharedItem; diff --git a/src/app/(features)/dictionary/page.tsx b/src/app/(features)/dictionary/page.tsx index 877b887..21f71a3 100644 --- a/src/app/(features)/dictionary/page.tsx +++ b/src/app/(features)/dictionary/page.tsx @@ -1,15 +1,15 @@ "use client"; import { useState, useEffect } from "react"; -import Container from "@/components/ui/Container"; +import { Container } from "@/components/ui/Container"; import { authClient } from "@/lib/auth-client"; import { SearchForm } from "./SearchForm"; import { SearchResult } from "./SearchResult"; import { useTranslations } from "next-intl"; import { POPULAR_LANGUAGES } from "./constants"; import { performDictionaryLookup } from "./utils"; -import { TSharedItem } from "@/shared"; -import { actionGetFoldersByUserId } from "@/modules/folder"; +import { TSharedItem } from "@/shared/dictionary-type"; +import { actionGetFoldersByUserId } from "@/modules/folder/folder-aciton"; import { TSharedFolder } from "@/shared/folder-type"; import { toast } from "sonner"; diff --git a/src/app/(features)/dictionary/utils.ts b/src/app/(features)/dictionary/utils.ts index ab7bde2..385fe6e 100644 --- a/src/app/(features)/dictionary/utils.ts +++ b/src/app/(features)/dictionary/utils.ts @@ -1,7 +1,7 @@ import { toast } from "sonner"; import { actionLookUpDictionary } from "@/modules/dictionary/dictionary-action"; -import { ActionInputLookUpDictionary, ActionOutputLookUpDictionary } from "@/modules/dictionary"; -import { TSharedItem } from "@/shared"; +import { ActionInputLookUpDictionary, ActionOutputLookUpDictionary } from "@/modules/dictionary/dictionary-action-dto"; +import { TSharedItem } from "@/shared/dictionary-type"; export async function performDictionaryLookup( options: ActionInputLookUpDictionary, diff --git a/src/app/(features)/memorize/FolderSelector.tsx b/src/app/(features)/memorize/FolderSelector.tsx index 3ea25cd..ebaddd0 100644 --- a/src/app/(features)/memorize/FolderSelector.tsx +++ b/src/app/(features)/memorize/FolderSelector.tsx @@ -93,4 +93,4 @@ const FolderSelector: React.FC = ({ folders }) => { ); }; -export default FolderSelector; +export { FolderSelector }; diff --git a/src/app/(features)/memorize/Memorize.tsx b/src/app/(features)/memorize/Memorize.tsx index 9de8838..a97aa35 100644 --- a/src/app/(features)/memorize/Memorize.tsx +++ b/src/app/(features)/memorize/Memorize.tsx @@ -208,4 +208,4 @@ const Memorize: React.FC = ({ textPairs }) => { ); }; -export default Memorize; +export { Memorize }; diff --git a/src/app/(features)/memorize/page.tsx b/src/app/(features)/memorize/page.tsx index e24a201..52a84e1 100644 --- a/src/app/(features)/memorize/page.tsx +++ b/src/app/(features)/memorize/page.tsx @@ -1,11 +1,11 @@ import { redirect } from "next/navigation"; import { getTranslations } from "next-intl/server"; import { isNonNegativeInteger } from "@/utils/random"; -import FolderSelector from "./FolderSelector"; -import Memorize from "./Memorize"; +import { FolderSelector } from "./FolderSelector"; +import { Memorize } from "./Memorize"; import { auth } from "@/auth"; import { headers } from "next/headers"; -import { actionGetFoldersWithTotalPairsByUserId, actionGetPairsByFolderId } from "@/modules/folder"; +import { actionGetFoldersWithTotalPairsByUserId, actionGetPairsByFolderId } from "@/modules/folder/folder-aciton"; export default async function MemorizePage({ searchParams, diff --git a/src/app/(features)/srt-player/VideoPlayer/SubtitleDisplay.tsx b/src/app/(features)/srt-player/VideoPlayer/SubtitleDisplay.tsx index 566f1d2..373a24a 100644 --- a/src/app/(features)/srt-player/VideoPlayer/SubtitleDisplay.tsx +++ b/src/app/(features)/srt-player/VideoPlayer/SubtitleDisplay.tsx @@ -1,4 +1,4 @@ -export default function SubtitleDisplay({ subtitle }: { subtitle: string }) { +export function SubtitleDisplay({ subtitle }: { subtitle: string }) { const words = subtitle.match(/\b[\w']+(?:-[\w']+)*\b/g) || []; let i = 0; return ( diff --git a/src/app/(features)/srt-player/VideoPlayer/VideoPanel.tsx b/src/app/(features)/srt-player/VideoPlayer/VideoPanel.tsx index 5c1e469..a9bfdfe 100644 --- a/src/app/(features)/srt-player/VideoPlayer/VideoPanel.tsx +++ b/src/app/(features)/srt-player/VideoPlayer/VideoPanel.tsx @@ -1,5 +1,5 @@ import { useState, useRef, forwardRef, useEffect, useCallback } from "react"; -import SubtitleDisplay from "./SubtitleDisplay"; +import { SubtitleDisplay } from "./SubtitleDisplay"; import { LightButton } from "@/components/ui/buttons"; import { getIndex, parseSrt, getNearistIndex } from "../subtitle"; import { useTranslations } from "next-intl"; @@ -213,4 +213,4 @@ const VideoPanel = forwardRef( VideoPanel.displayName = "VideoPanel"; -export default VideoPanel; +export { VideoPanel }; diff --git a/src/app/(features)/srt-player/components/atoms/FileInput.tsx b/src/app/(features)/srt-player/components/atoms/FileInput.tsx index 10935b5..191fcfc 100644 --- a/src/app/(features)/srt-player/components/atoms/FileInput.tsx +++ b/src/app/(features)/srt-player/components/atoms/FileInput.tsx @@ -7,7 +7,7 @@ interface FileInputComponentProps extends FileInputProps { children: React.ReactNode; } -export default function FileInput({ accept, onFileSelect, disabled, className, children }: FileInputComponentProps) { +export function FileInput({ accept, onFileSelect, disabled, className, children }: FileInputComponentProps) { const inputRef = useRef(null); const handleClick = React.useCallback(() => { diff --git a/src/app/(features)/srt-player/components/atoms/PlayButton.tsx b/src/app/(features)/srt-player/components/atoms/PlayButton.tsx index c9bb4d3..e967859 100644 --- a/src/app/(features)/srt-player/components/atoms/PlayButton.tsx +++ b/src/app/(features)/srt-player/components/atoms/PlayButton.tsx @@ -5,7 +5,7 @@ import { useTranslations } from "next-intl"; import { LightButton } from "@/components/ui/buttons"; import { PlayButtonProps } from "../../types/player"; -export default function PlayButton({ isPlaying, onToggle, disabled, className }: PlayButtonProps) { +export function PlayButton({ isPlaying, onToggle, disabled, className }: PlayButtonProps) { const t = useTranslations("srt_player"); return ( diff --git a/src/app/(features)/srt-player/components/atoms/SeekBar.tsx b/src/app/(features)/srt-player/components/atoms/SeekBar.tsx index 68eff7d..ff8203f 100644 --- a/src/app/(features)/srt-player/components/atoms/SeekBar.tsx +++ b/src/app/(features)/srt-player/components/atoms/SeekBar.tsx @@ -3,7 +3,7 @@ import React from "react"; import { SeekBarProps } from "../../types/player"; -export default function SeekBar({ value, max, onChange, disabled, className }: SeekBarProps) { +export function SeekBar({ value, max, onChange, disabled, className }: SeekBarProps) { const handleChange = React.useCallback((event: React.ChangeEvent) => { const newValue = parseInt(event.target.value); onChange(newValue); diff --git a/src/app/(features)/srt-player/components/atoms/SpeedControl.tsx b/src/app/(features)/srt-player/components/atoms/SpeedControl.tsx index 36644f1..3664557 100644 --- a/src/app/(features)/srt-player/components/atoms/SpeedControl.tsx +++ b/src/app/(features)/srt-player/components/atoms/SpeedControl.tsx @@ -5,7 +5,7 @@ import { LightButton } from "@/components/ui/buttons"; import { SpeedControlProps } from "../../types/player"; import { getPlaybackRateOptions, getPlaybackRateLabel } from "../../utils/timeUtils"; -export default function SpeedControl({ playbackRate, onPlaybackRateChange, disabled, className }: SpeedControlProps) { +export function SpeedControl({ playbackRate, onPlaybackRateChange, disabled, className }: SpeedControlProps) { const speedOptions = getPlaybackRateOptions(); const handleSpeedChange = React.useCallback(() => { diff --git a/src/app/(features)/srt-player/components/atoms/SubtitleText.tsx b/src/app/(features)/srt-player/components/atoms/SubtitleText.tsx index ce8065c..a45f8b4 100644 --- a/src/app/(features)/srt-player/components/atoms/SubtitleText.tsx +++ b/src/app/(features)/srt-player/components/atoms/SubtitleText.tsx @@ -3,7 +3,7 @@ import React from "react"; import { SubtitleTextProps } from "../../types/subtitle"; -export default function SubtitleText({ text, onWordClick, style, className }: SubtitleTextProps) { +export function SubtitleText({ text, onWordClick, style, className }: SubtitleTextProps) { const handleWordClick = React.useCallback((word: string) => { onWordClick?.(word); }, [onWordClick]); diff --git a/src/app/(features)/srt-player/components/atoms/VideoElement.tsx b/src/app/(features)/srt-player/components/atoms/VideoElement.tsx index 4dcbe0c..10a000c 100644 --- a/src/app/(features)/srt-player/components/atoms/VideoElement.tsx +++ b/src/app/(features)/srt-player/components/atoms/VideoElement.tsx @@ -46,4 +46,4 @@ const VideoElement = forwardRef( VideoElement.displayName = "VideoElement"; -export default VideoElement; \ No newline at end of file +export { VideoElement }; \ No newline at end of file diff --git a/src/app/(features)/srt-player/components/compounds/ControlBar.tsx b/src/app/(features)/srt-player/components/compounds/ControlBar.tsx index 91f946d..75276db 100644 --- a/src/app/(features)/srt-player/components/compounds/ControlBar.tsx +++ b/src/app/(features)/srt-player/components/compounds/ControlBar.tsx @@ -5,10 +5,10 @@ import { useTranslations } from "next-intl"; import { ChevronLeft, ChevronRight, RotateCcw, Pause } from "lucide-react"; import { LightButton } from "@/components/ui/buttons"; import { ControlBarProps } from "../../types/controls"; -import PlayButton from "../atoms/PlayButton"; -import SpeedControl from "../atoms/SpeedControl"; +import { PlayButton } from "../atoms/PlayButton"; +import { SpeedControl } from "../atoms/SpeedControl"; -export default function ControlBar({ +export function ControlBar({ isPlaying, onPlayPause, onPrevious, diff --git a/src/app/(features)/srt-player/components/compounds/SubtitleArea.tsx b/src/app/(features)/srt-player/components/compounds/SubtitleArea.tsx index a10ac03..278c5a0 100644 --- a/src/app/(features)/srt-player/components/compounds/SubtitleArea.tsx +++ b/src/app/(features)/srt-player/components/compounds/SubtitleArea.tsx @@ -2,9 +2,9 @@ import React from "react"; import { SubtitleDisplayProps } from "../../types/subtitle"; -import SubtitleText from "../atoms/SubtitleText"; +import { SubtitleText } from "../atoms/SubtitleText"; -export default function SubtitleArea({ subtitle, onWordClick, settings, className }: SubtitleDisplayProps) { +export function SubtitleArea({ subtitle, onWordClick, settings, className }: SubtitleDisplayProps) { const handleWordClick = React.useCallback((word: string) => { // 打开有道词典页面查询单词 window.open( diff --git a/src/app/(features)/srt-player/components/compounds/UploadZone.tsx b/src/app/(features)/srt-player/components/compounds/UploadZone.tsx index 7f7d9b7..45b063b 100644 --- a/src/app/(features)/srt-player/components/compounds/UploadZone.tsx +++ b/src/app/(features)/srt-player/components/compounds/UploadZone.tsx @@ -8,7 +8,7 @@ import { LightButton } from "@/components/ui/buttons"; import { FileUploadProps } from "../../types/controls"; import { useFileUpload } from "../../hooks/useFileUpload"; -export default function UploadZone({ onVideoUpload, onSubtitleUpload, className }: FileUploadProps) { +export function UploadZone({ onVideoUpload, onSubtitleUpload, className }: FileUploadProps) { const t = useTranslations("srt_player"); const { uploadVideo, uploadSubtitle } = useFileUpload(); diff --git a/src/app/(features)/srt-player/components/compounds/VideoPlayer.tsx b/src/app/(features)/srt-player/components/compounds/VideoPlayer.tsx index 5ea05f7..d72048a 100644 --- a/src/app/(features)/srt-player/components/compounds/VideoPlayer.tsx +++ b/src/app/(features)/srt-player/components/compounds/VideoPlayer.tsx @@ -2,7 +2,7 @@ import React, { forwardRef } from "react"; import { VideoElementProps } from "../../types/player"; -import VideoElement from "../atoms/VideoElement"; +import { VideoElement } from "../atoms/VideoElement"; interface VideoPlayerComponentProps extends VideoElementProps { children?: React.ReactNode; @@ -38,4 +38,4 @@ const VideoPlayer = forwardRef( VideoPlayer.displayName = "VideoPlayer"; -export default VideoPlayer; \ No newline at end of file +export { VideoPlayer }; \ No newline at end of file diff --git a/src/app/(features)/srt-player/page.tsx b/src/app/(features)/srt-player/page.tsx index bc1add3..ef8afed 100644 --- a/src/app/(features)/srt-player/page.tsx +++ b/src/app/(features)/srt-player/page.tsx @@ -9,11 +9,11 @@ import { useSubtitleSync } from "./hooks/useSubtitleSync"; import { useKeyboardShortcuts, createSrtPlayerShortcuts } from "./hooks/useKeyboardShortcuts"; import { useFileUpload } from "./hooks/useFileUpload"; import { loadSubtitle } from "./utils/subtitleParser"; -import VideoPlayer from "./components/compounds/VideoPlayer"; -import SubtitleArea from "./components/compounds/SubtitleArea"; -import ControlBar from "./components/compounds/ControlBar"; -import UploadZone from "./components/compounds/UploadZone"; -import SeekBar from "./components/atoms/SeekBar"; +import { VideoPlayer } from "./components/compounds/VideoPlayer"; +import { SubtitleArea } from "./components/compounds/SubtitleArea"; +import { ControlBar } from "./components/compounds/ControlBar"; +import { UploadZone } from "./components/compounds/UploadZone"; +import { SeekBar } from "./components/atoms/SeekBar"; import { LightButton } from "@/components/ui/buttons"; export default function SrtPlayerPage() { diff --git a/src/app/(features)/text-speaker/SaveList.tsx b/src/app/(features)/text-speaker/SaveList.tsx index e67d065..15282f8 100644 --- a/src/app/(features)/text-speaker/SaveList.tsx +++ b/src/app/(features)/text-speaker/SaveList.tsx @@ -7,7 +7,7 @@ import { TextSpeakerItemSchema, } from "@/lib/interfaces"; import { IconClick } from "@/components/ui/buttons"; -import IMAGES from "@/config/images"; +import { IMAGES } from "@/config/images"; import { useTranslations } from "next-intl"; import { getLocalStorageOperator } from "@/lib/browser/localStorageOperators"; @@ -50,7 +50,7 @@ interface SaveListProps { show?: boolean; handleUse: (item: z.infer) => void; } -export default function SaveList({ show = false, handleUse }: SaveListProps) { +export function SaveList({ show = false, handleUse }: SaveListProps) { const t = useTranslations("text_speaker"); const { get: getFromLocalStorage, set: setIntoLocalStorage } = getLocalStorageOperator( diff --git a/src/app/(features)/text-speaker/page.tsx b/src/app/(features)/text-speaker/page.tsx index bd3e539..0c73e27 100644 --- a/src/app/(features)/text-speaker/page.tsx +++ b/src/app/(features)/text-speaker/page.tsx @@ -2,7 +2,7 @@ import { LightButton } from "@/components/ui/buttons"; import { IconClick } from "@/components/ui/buttons"; -import IMAGES from "@/config/images"; +import { IMAGES } from "@/config/images"; import { useAudioPlayer } from "@/hooks/useAudioPlayer"; import { TextSpeakerArraySchema, @@ -10,13 +10,13 @@ import { } from "@/lib/interfaces"; import { ChangeEvent, useEffect, useRef, useState } from "react"; import z from "zod"; -import SaveList from "./SaveList"; +import { SaveList } from "./SaveList"; import { useTranslations } from "next-intl"; import { getLocalStorageOperator } from "@/lib/browser/localStorageOperators"; import { genIPA, genLanguage } from "@/modules/translator/translator-action"; import { logger } from "@/lib/logger"; -import PageLayout from "@/components/ui/PageLayout"; +import { PageLayout } from "@/components/ui/PageLayout"; import { getTTSUrl, TTS_SUPPORTED_LANGUAGES } from "@/lib/bigmodel/tts"; export default function TextSpeakerPage() { diff --git a/src/app/(features)/translator/page.tsx b/src/app/(features)/translator/page.tsx index 0f90065..ceba474 100644 --- a/src/app/(features)/translator/page.tsx +++ b/src/app/(features)/translator/page.tsx @@ -2,14 +2,14 @@ import { LightButton } from "@/components/ui/buttons"; import { IconClick } from "@/components/ui/buttons"; -import IMAGES from "@/config/images"; +import { IMAGES } from "@/config/images"; import { useAudioPlayer } from "@/hooks/useAudioPlayer"; import { useTranslations } from "next-intl"; import { useRef, useState } from "react"; -import { actionTranslateText } from "@/modules/translator"; +import { actionTranslateText } from "@/modules/translator/translator-action"; import { toast } from "sonner"; import { getTTSUrl, TTS_SUPPORTED_LANGUAGES } from "@/lib/bigmodel/tts"; -import { TSharedTranslationResult } from "@/shared"; +import { TSharedTranslationResult } from "@/shared/translator-type"; export default function TranslatorPage() { const t = useTranslations("translator"); diff --git a/src/app/auth/AuthForm.tsx b/src/app/auth/AuthForm.tsx index b79c29a..7dfc380 100644 --- a/src/app/auth/AuthForm.tsx +++ b/src/app/auth/AuthForm.tsx @@ -2,17 +2,17 @@ import { useState, useActionState, startTransition } from "react"; import { useTranslations } from "next-intl"; -import Container from "@/components/ui/Container"; -import Input from "@/components/ui/Input"; +import { Container } from "@/components/ui/Container"; +import { Input } from "@/components/ui/Input"; import { LightButton } from "@/components/ui/buttons"; import { authClient } from "@/lib/auth-client"; -import { signInAction, signUpAction, SignUpState } from "@/modules/auth"; +import { signInAction, signUpAction, SignUpState } from "@/modules/auth/auth-action"; interface AuthFormProps { redirectTo?: string; } -export default function AuthForm({ redirectTo }: AuthFormProps) { +export function AuthForm({ redirectTo }: AuthFormProps) { const t = useTranslations("auth"); const [mode, setMode] = useState<'signin' | 'signup'>('signin'); const [clearSignIn, setClearSignIn] = useState(false); diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx index 0c12e7c..81f0286 100644 --- a/src/app/auth/page.tsx +++ b/src/app/auth/page.tsx @@ -1,7 +1,7 @@ import { auth } from "@/auth"; import { headers } from "next/headers"; import { redirect } from "next/navigation"; -import AuthForm from "./AuthForm"; +import { AuthForm } from "./AuthForm"; export default async function AuthPage( props: { diff --git a/src/app/folders/FoldersClient.tsx b/src/app/folders/FoldersClient.tsx index 000e781..04a59db 100644 --- a/src/app/folders/FoldersClient.tsx +++ b/src/app/folders/FoldersClient.tsx @@ -11,10 +11,10 @@ import { useEffect, useState } from "react"; import { useRouter } from "next/navigation"; import { useTranslations } from "next-intl"; import { toast } from "sonner"; -import PageLayout from "@/components/ui/PageLayout"; -import PageHeader from "@/components/ui/PageHeader"; -import CardList from "@/components/ui/CardList"; -import { actionCreateFolder, actionDeleteFolderById, actionGetFoldersWithTotalPairsByUserId, actionRenameFolderById } from "@/modules/folder"; +import { PageLayout } from "@/components/ui/PageLayout"; +import { PageHeader } from "@/components/ui/PageHeader"; +import { CardList } from "@/components/ui/CardList"; +import { actionCreateFolder, actionDeleteFolderById, actionGetFoldersWithTotalPairsByUserId, actionRenameFolderById } from "@/modules/folder/folder-aciton"; import { TSharedFolderWithTotalPairs } from "@/shared/folder-type"; interface FolderProps { @@ -97,7 +97,7 @@ const FolderCard = ({ folder, refresh }: FolderProps) => { ); }; -export default function FoldersClient({ userId }: { userId: string; }) { +export function FoldersClient({ userId }: { userId: string; }) { const t = useTranslations("folders"); const [folders, setFolders] = useState( [], diff --git a/src/app/folders/[folder_id]/AddTextPairModal.tsx b/src/app/folders/[folder_id]/AddTextPairModal.tsx index 01be030..9491dd8 100644 --- a/src/app/folders/[folder_id]/AddTextPairModal.tsx +++ b/src/app/folders/[folder_id]/AddTextPairModal.tsx @@ -1,5 +1,5 @@ import { LightButton } from "@/components/ui/buttons"; -import Input from "@/components/ui/Input"; +import { Input } from "@/components/ui/Input"; import { LocaleSelector } from "@/components/ui/LocaleSelector"; import { X } from "lucide-react"; import { useRef, useState } from "react"; @@ -16,7 +16,7 @@ interface AddTextPairModalProps { ) => void; } -export default function AddTextPairModal({ +export function AddTextPairModal({ isOpen, onClose, onAdd, diff --git a/src/app/folders/[folder_id]/InFolder.tsx b/src/app/folders/[folder_id]/InFolder.tsx index 68901f5..fff6276 100644 --- a/src/app/folders/[folder_id]/InFolder.tsx +++ b/src/app/folders/[folder_id]/InFolder.tsx @@ -3,19 +3,19 @@ import { ArrowLeft, Plus } from "lucide-react"; import { useEffect, useState } from "react"; import { redirect, useRouter } from "next/navigation"; -import AddTextPairModal from "./AddTextPairModal"; -import TextPairCard from "./TextPairCard"; +import { AddTextPairModal } from "./AddTextPairModal"; +import { TextPairCard } from "./TextPairCard"; import { useTranslations } from "next-intl"; -import PageLayout from "@/components/ui/PageLayout"; +import { PageLayout } from "@/components/ui/PageLayout"; import { GreenButton } from "@/components/ui/buttons"; import { IconButton } from "@/components/ui/buttons"; -import CardList from "@/components/ui/CardList"; -import { actionCreatePair, actionDeletePairById, actionGetPairsByFolderId } from "@/modules/folder"; +import { CardList } from "@/components/ui/CardList"; +import { actionCreatePair, actionDeletePairById, actionGetPairsByFolderId } from "@/modules/folder/folder-aciton"; import { TSharedPair } from "@/shared/folder-type"; import { toast } from "sonner"; -export default function InFolder({ folderId }: { folderId: number; }) { +export function InFolder({ folderId }: { folderId: number; }) { const [textPairs, setTextPairs] = useState([]); const [loading, setLoading] = useState(true); const [openAddModal, setAddModal] = useState(false); diff --git a/src/app/folders/[folder_id]/TextPairCard.tsx b/src/app/folders/[folder_id]/TextPairCard.tsx index a23ac90..b9c699c 100644 --- a/src/app/folders/[folder_id]/TextPairCard.tsx +++ b/src/app/folders/[folder_id]/TextPairCard.tsx @@ -1,9 +1,10 @@ import { Edit, Trash2 } from "lucide-react"; import { useState } from "react"; -import UpdateTextPairModal from "./UpdateTextPairModal"; +import { UpdateTextPairModal } from "./UpdateTextPairModal"; import { useTranslations } from "next-intl"; import { TSharedPair } from "@/shared/folder-type"; -import { actionUpdatePairById, ActionInputUpdatePairById } from "@/modules/folder"; +import { actionUpdatePairById } from "@/modules/folder/folder-aciton"; +import { ActionInputUpdatePairById } from "@/modules/folder/folder-action-dto"; import { toast } from "sonner"; interface TextPairCardProps { @@ -12,7 +13,7 @@ interface TextPairCardProps { refreshTextPairs: () => void; } -export default function TextPairCard({ +export function TextPairCard({ textPair, onDel, refreshTextPairs, diff --git a/src/app/folders/[folder_id]/UpdateTextPairModal.tsx b/src/app/folders/[folder_id]/UpdateTextPairModal.tsx index 6a4be55..5f77d2b 100644 --- a/src/app/folders/[folder_id]/UpdateTextPairModal.tsx +++ b/src/app/folders/[folder_id]/UpdateTextPairModal.tsx @@ -1,11 +1,11 @@ import { LightButton } from "@/components/ui/buttons"; -import Input from "@/components/ui/Input"; +import { Input } from "@/components/ui/Input"; import { LocaleSelector } from "@/components/ui/LocaleSelector"; import { X } from "lucide-react"; import { useRef, useState } from "react"; import { useTranslations } from "next-intl"; import { TSharedPair } from "@/shared/folder-type"; -import { ActionInputUpdatePairById } from "@/modules/folder"; +import { ActionInputUpdatePairById } from "@/modules/folder/folder-action-dto"; interface UpdateTextPairModalProps { isOpen: boolean; @@ -14,7 +14,7 @@ interface UpdateTextPairModalProps { onUpdate: (id: number, tp: ActionInputUpdatePairById) => void; } -export default function UpdateTextPairModal({ +export function UpdateTextPairModal({ isOpen, onClose, onUpdate, diff --git a/src/app/folders/[folder_id]/page.tsx b/src/app/folders/[folder_id]/page.tsx index 3e75005..d8b4a16 100644 --- a/src/app/folders/[folder_id]/page.tsx +++ b/src/app/folders/[folder_id]/page.tsx @@ -1,9 +1,9 @@ import { redirect } from "next/navigation"; import { getTranslations } from "next-intl/server"; -import InFolder from "./InFolder"; +import { InFolder } from "./InFolder"; import { auth } from "@/auth"; import { headers } from "next/headers"; -import { actionGetUserIdByFolderId } from "@/modules/folder"; +import { actionGetUserIdByFolderId } from "@/modules/folder/folder-aciton"; export default async function FoldersPage({ params, }: { diff --git a/src/app/folders/page.tsx b/src/app/folders/page.tsx index 9bde786..1377292 100644 --- a/src/app/folders/page.tsx +++ b/src/app/folders/page.tsx @@ -1,5 +1,5 @@ import { auth } from "@/auth"; -import FoldersClient from "./FoldersClient"; +import { FoldersClient } from "./FoldersClient"; import { redirect } from "next/navigation"; import { headers } from "next/headers"; diff --git a/src/app/profile/LogoutButton.tsx b/src/app/profile/LogoutButton.tsx index 02511df..db5d052 100644 --- a/src/app/profile/LogoutButton.tsx +++ b/src/app/profile/LogoutButton.tsx @@ -5,7 +5,7 @@ import { authClient } from "@/lib/auth-client"; import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; -export default function LogoutButton() { +export function LogoutButton() { const t = useTranslations("profile"); const router = useRouter(); return { diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx index c7d4bc3..cabeea7 100644 --- a/src/app/profile/page.tsx +++ b/src/app/profile/page.tsx @@ -1,11 +1,11 @@ import Image from "next/image"; -import PageLayout from "@/components/ui/PageLayout"; -import PageHeader from "@/components/ui/PageHeader"; +import { PageLayout } from "@/components/ui/PageLayout"; +import { PageHeader } from "@/components/ui/PageHeader"; import { auth } from "@/auth"; import { getTranslations } from "next-intl/server"; import { redirect } from "next/navigation"; import { headers } from "next/headers"; -import LogoutButton from "./LogoutButton"; +import { LogoutButton } from "./LogoutButton"; export default async function ProfilePage() { const t = await getTranslations("profile"); diff --git a/src/auth.ts b/src/auth.ts index 1445ac6..dbf458c 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,7 +1,7 @@ import { betterAuth } from "better-auth"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { nextCookies } from "better-auth/next-js"; -import prisma from "./lib/db"; +import { prisma } from "./lib/db"; export const auth = betterAuth({ database: prismaAdapter(prisma, { diff --git a/src/components/LanguageSettings.tsx b/src/components/LanguageSettings.tsx index cf9beab..a551364 100644 --- a/src/components/LanguageSettings.tsx +++ b/src/components/LanguageSettings.tsx @@ -1,10 +1,10 @@ "use client"; -import IMAGES from "@/config/images"; +import { IMAGES } from "@/config/images"; import { IconClick, GhostButton } from "./ui/buttons"; import { useState } from "react"; -export default function LanguageSettings() { +export function LanguageSettings() { const [showLanguageMenu, setShowLanguageMenu] = useState(false); const handleLanguageClick = () => { setShowLanguageMenu((prev) => !prev); diff --git a/src/components/layout/Navbar.tsx b/src/components/layout/Navbar.tsx index 05781ca..8502626 100644 --- a/src/components/layout/Navbar.tsx +++ b/src/components/layout/Navbar.tsx @@ -1,7 +1,7 @@ import Image from "next/image"; -import IMAGES from "@/config/images"; +import { IMAGES } from "@/config/images"; import { Folder, Home, User } from "lucide-react"; -import LanguageSettings from "../LanguageSettings"; +import { LanguageSettings } from "../LanguageSettings"; import { auth } from "@/auth"; import { headers } from "next/headers"; import { getTranslations } from "next-intl/server"; diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx index e11b8fc..921a5c5 100644 --- a/src/components/ui/Button.tsx +++ b/src/components/ui/Button.tsx @@ -34,7 +34,7 @@ export interface ButtonProps { href?: string; } -export default function Button({ +export function Button({ variant = "secondary", size = "md", selected = false, diff --git a/src/components/ui/CardList.tsx b/src/components/ui/CardList.tsx index 40b1e35..3150df1 100644 --- a/src/components/ui/CardList.tsx +++ b/src/components/ui/CardList.tsx @@ -21,7 +21,7 @@ interface CardListProps { className?: string; } -export default function CardList({ children, className = "" }: CardListProps) { +export function CardList({ children, className = "" }: CardListProps) { return (
{children} diff --git a/src/components/ui/Container.tsx b/src/components/ui/Container.tsx index 36344b5..acf51ac 100644 --- a/src/components/ui/Container.tsx +++ b/src/components/ui/Container.tsx @@ -3,7 +3,7 @@ interface ContainerProps { className?: string; } -export default function Container({ children, className }: ContainerProps) { +export function Container({ children, className }: ContainerProps) { return (

diff --git a/src/components/ui/PageLayout.tsx b/src/components/ui/PageLayout.tsx index aa18d47..5babdfa 100644 --- a/src/components/ui/PageLayout.tsx +++ b/src/components/ui/PageLayout.tsx @@ -20,7 +20,7 @@ interface PageLayoutProps { className?: string; } -export default function PageLayout({ children, className = "" }: PageLayoutProps) { +export function PageLayout({ children, className = "" }: PageLayoutProps) { return (
diff --git a/src/components/ui/buttons/index.tsx b/src/components/ui/buttons/index.tsx index fee0a4a..ad8e61c 100644 --- a/src/components/ui/buttons/index.tsx +++ b/src/components/ui/buttons/index.tsx @@ -1,7 +1,7 @@ // 向后兼容的按钮组件包装器 // 这些组件将新 Button 组件包装,以保持向后兼容 -import Button from "../Button"; +import { Button } from "../Button"; // LightButton: 次要按钮,支持 selected 状态 export const LightButton = (props: any) =>