fix: eslint unused-disable + prettier formatting
CI/CD Pipeline / Build Production Runtime Images (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Staging E2E Tests (push) Failing after 65h49m33s
CI/CD Pipeline / Deploy Staging (push) Failing after 65h51m39s
CI/CD Pipeline / Frontend Lint (push) Failing after 65h53m10s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 65h54m47s

- Remove unused eslint-disable in MainLayout.tsx (react-refresh/only-export-components)
- Format client.ts, ClipPropertiesPanel.tsx, TimelinePanel.tsx, EditingPlanner.tsx with prettier
This commit is contained in:
灵应
2026-07-06 18:59:10 +08:00
parent 4fe9fc0c95
commit 6e30a96f6d
5 changed files with 36 additions and 28 deletions
+12 -6
View File
@@ -59,7 +59,11 @@ apiClient.interceptors.response.use(
};
// 401 → 尝试刷新 Token
if (error.response?.status === 401 && originalRequest && !originalRequest._retry) {
if (
error.response?.status === 401 &&
originalRequest &&
!originalRequest._retry
) {
const refreshToken = useAuthStore.getState().refreshToken;
// 无 refresh_token → 直接登出
@@ -90,11 +94,13 @@ apiClient.interceptors.response.use(
const newRefreshToken = data.refresh_token ?? refreshToken;
// 更新 Zustand + localStorage
useAuthStore.getState().setAuth(
useAuthStore.getState().user!,
newAccessToken,
newRefreshToken,
);
useAuthStore
.getState()
.setAuth(
useAuthStore.getState().user!,
newAccessToken,
newRefreshToken,
);
// 处理排队的请求
processQueue(null, newAccessToken);
@@ -16,7 +16,6 @@ import Sidebar from "./Sidebar";
import "./MainLayout.css";
/** 侧边栏上下文 —— 子组件可读取折叠状态 */
// eslint-disable-next-line react-refresh/only-export-components
export interface SidebarContextValue {
collapsed: boolean;
}
@@ -25,10 +25,7 @@ import {
generateFromTemplate,
MODE_LABELS,
} from "@/api/editingPlanner";
import type {
EditPlanGeneration,
MediaAsset,
} from "@/api/editPlans";
import type { EditPlanGeneration, MediaAsset } from "@/api/editPlans";
import {
getMediaAssets,
getEditPlanGenerations,
@@ -206,7 +203,9 @@ const EditingPlanner: React.FC = () => {
const mapped: ClipData[] = tpl.segments.map((seg, idx) => ({
id: seg.id || `seg-${idx}`,
template_segment_id: seg.id || `seg-${idx}`,
type: (seg.material_type === "voiceover" ? "voice" : "pip") as ClipType,
type: (seg.material_type === "voiceover"
? "voice"
: "pip") as ClipType,
duration: (seg.duration_min + seg.duration_max) / 2,
startOffset: 0,
script_text: "",
@@ -136,7 +136,10 @@ function getActivePreset(settings: TitleSettings): string | null {
/** 片段类型图标/标签 */
const CLIP_TYPE_ICONS: Record<ClipType, string> = { voice: "🎙️", pip: "🖼️" };
const CLIP_TYPE_LABELS: Record<ClipType, string> = { voice: "口播", pip: "画中画" };
const CLIP_TYPE_LABELS: Record<ClipType, string> = {
voice: "口播",
pip: "画中画",
};
const ClipPropertiesPanel: React.FC<ClipPropertiesPanelProps> = ({
selectedClip,
@@ -457,8 +460,7 @@ const ClipPropertiesPanel: React.FC<ClipPropertiesPanelProps> = ({
className={`ep-clip-type-btn${selectedClip.type === t ? " active" : ""}${disabled ? " disabled" : ""}`}
disabled={disabled}
onClick={() =>
!disabled &&
onClipUpdate(selectedClip.id, { type: t })
!disabled && onClipUpdate(selectedClip.id, { type: t })
}
>
{CLIP_TYPE_ICONS[t]} {CLIP_TYPE_LABELS[t]}
@@ -480,7 +482,10 @@ const ClipPropertiesPanel: React.FC<ClipPropertiesPanelProps> = ({
value={selectedClip.duration}
onChange={(e) =>
onClipUpdate(selectedClip.id, {
duration: Math.max(1, Math.min(120, Number(e.target.value) || 1)),
duration: Math.max(
1,
Math.min(120, Number(e.target.value) || 1),
),
})
}
/>
@@ -502,7 +507,10 @@ const ClipPropertiesPanel: React.FC<ClipPropertiesPanelProps> = ({
value={selectedClip.startOffset}
onChange={(e) =>
onClipUpdate(selectedClip.id, {
startOffset: Math.max(0, Math.min(9999, Number(e.target.value) || 0)),
startOffset: Math.max(
0,
Math.min(9999, Number(e.target.value) || 0),
),
})
}
/>
@@ -156,9 +156,7 @@ const TimelinePanel: React.FC<TimelinePanelProps> = ({
{/* 一镜到底提示 */}
{currentMode === "one_take" && (
<div className="ep-one-take-hint">
🎥
</div>
<div className="ep-one-take-hint">🎥 </div>
)}
{/* 时间标尺 */}
@@ -188,16 +186,11 @@ const TimelinePanel: React.FC<TimelinePanelProps> = ({
{/* 水平片段轨道 */}
{currentMode !== "one_take" && (
<div
className="ep-clip-track"
onDragOver={handleEmptyDragOver}
>
<div className="ep-clip-track" onDragOver={handleEmptyDragOver}>
{clips.length === 0 ? (
<div className="ep-track-empty">
<div className="ep-track-empty-icon">🎬</div>
<div className="ep-track-empty-text">
+
</div>
<div className="ep-track-empty-text"> + </div>
</div>
) : (
clips.map((clip, idx) => (
@@ -286,7 +279,10 @@ const TimelinePanel: React.FC<TimelinePanelProps> = ({
</div>
{/* 确认按钮 */}
<button className="ep-add-clip-confirm-btn" onClick={handleConfirmAdd}>
<button
className="ep-add-clip-confirm-btn"
onClick={handleConfirmAdd}
>
</button>
</div>