From d1970bd44be9dcd25721eb5deb9b91988a3e2f61 Mon Sep 17 00:00:00 2001 From: CI Test Date: Tue, 7 Jul 2026 11:04:30 +0800 Subject: [PATCH] fix: prettier formatting for voice material module files --- apps/web/src/api/assets.ts | 5 +- apps/web/src/pages/generate/GeneratePage.tsx | 4 +- .../voice-materials/VoiceMaterialLibrary.tsx | 67 +++++++++++++------ 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/apps/web/src/api/assets.ts b/apps/web/src/api/assets.ts index bf1468cb6..964f82bd7 100644 --- a/apps/web/src/api/assets.ts +++ b/apps/web/src/api/assets.ts @@ -119,7 +119,10 @@ export const ensureDefaultLibrary = async (data: { project_id: string; kind: "video" | "voice" | "image"; }): Promise => { - const response = await apiClient.post("/asset-libraries/ensure-default", data); + const response = await apiClient.post( + "/asset-libraries/ensure-default", + data, + ); return response.data; }; diff --git a/apps/web/src/pages/generate/GeneratePage.tsx b/apps/web/src/pages/generate/GeneratePage.tsx index f27c83122..90c06365a 100644 --- a/apps/web/src/pages/generate/GeneratePage.tsx +++ b/apps/web/src/pages/generate/GeneratePage.tsx @@ -759,7 +759,9 @@ const GeneratePage: React.FC = () => { }} role="button" tabIndex={0} - aria-pressed={voiceMode === "preset" && selectedVoice === v.voice_id} + aria-pressed={ + voiceMode === "preset" && selectedVoice === v.voice_id + } onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); diff --git a/apps/web/src/pages/voice-materials/VoiceMaterialLibrary.tsx b/apps/web/src/pages/voice-materials/VoiceMaterialLibrary.tsx index 69dc05126..e232889e5 100644 --- a/apps/web/src/pages/voice-materials/VoiceMaterialLibrary.tsx +++ b/apps/web/src/pages/voice-materials/VoiceMaterialLibrary.tsx @@ -8,7 +8,13 @@ * - 编辑元信息(名称、描述、性别、风格标签) * - 删除素材 */ -import React, { useState, useRef, useCallback, useEffect, useMemo } from "react"; +import React, { + useState, + useRef, + useCallback, + useEffect, + useMemo, +} from "react"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; import { AudioOutlined, @@ -63,7 +69,11 @@ const STYLE_TAGS = [ ]; /** 性别选项 */ -const GENDER_OPTIONS: { value: VoiceGender; label: string; icon: React.ReactNode }[] = [ +const GENDER_OPTIONS: { + value: VoiceGender; + label: string; + icon: React.ReactNode; +}[] = [ { value: "male", label: "男声", icon: }, { value: "female", label: "女声", icon: }, { value: "child", label: "童声", icon: }, @@ -102,7 +112,7 @@ const mapAssetToMaterial = (asset: AssetItem): VoiceMaterial => { id: asset.id, name: asset.name, description: (meta.description as string) || "", - gender: ((meta.gender as VoiceGender) || "neutral"), + gender: (meta.gender as VoiceGender) || "neutral", tags, fileName: asset.storage_key?.split("/").pop() || asset.name, fileSize: asset.file_size || 0, @@ -180,7 +190,9 @@ const getAudioDuration = (file: File): Promise => { interface MaterialFormProps { initial?: VoiceMaterial; - onSubmit: (data: Omit & { file?: File }) => void; + onSubmit: ( + data: Omit & { file?: File }, + ) => void; onCancel: () => void; loading?: boolean; } @@ -193,8 +205,12 @@ const MaterialForm: React.FC = ({ }) => { const [name, setName] = useState(initial?.name ?? ""); const [description, setDescription] = useState(initial?.description ?? ""); - const [gender, setGender] = useState(initial?.gender ?? "female"); - const [selectedTags, setSelectedTags] = useState(initial?.tags ?? []); + const [gender, setGender] = useState( + initial?.gender ?? "female", + ); + const [selectedTags, setSelectedTags] = useState( + initial?.tags ?? [], + ); const [file, setFile] = useState(undefined); const fileInputRef = useRef(null); @@ -390,7 +406,9 @@ const VoiceMaterialCard: React.FC = ({ material.duration > 0 ? (currentTime / material.duration) * 100 : 0; return ( -
+
{/* 操作按钮 */}
- {isPlaying ? formatDuration(currentTime) : formatDuration(material.duration)} + {isPlaying + ? formatDuration(currentTime) + : formatDuration(material.duration)}
@@ -523,7 +543,9 @@ const VoiceMaterialRow: React.FC = ({ material.duration > 0 ? (currentTime / material.duration) * 100 : 0; return ( -
+
{/* 播放按钮 */}
- - 共 {filtered.length} 个素材 - + 共 {filtered.length} 个素材