feat(settings): redesign video transcoding settings into dedicated cards and rename team AI settings (#441)

* feat(settings): redesign video transcoding settings into dedicated cards and rename team AI settings

* feat(settings): rename Video Strategy to MP4 Transcoding with sub-description
This commit is contained in:
Yiling-J
2026-10-01 21:19:25 +08:00
committed by GitHub
parent a21a0c9655
commit 4e4da595a6
6 changed files with 224 additions and 126 deletions
+11 -3
View File
@@ -13,6 +13,7 @@
"personal_settings": "Personal Settings",
"team_settings": "Team Settings",
"ai_settings": "AI Settings",
"team_ai_settings": "Team AI Settings",
"welcome_back": "Welcome Back",
"create_account": "Create Account",
"select_a_team": "Select a Team",
@@ -246,11 +247,18 @@
"failed_update_profile": "Failed to update profile",
"failed_load_settings": "Failed to load settings.",
"media_processing": "Media Processing",
"media_processing_description": "Manage your team's media transcoding configurations.",
"media_processing": "Video Transcoding",
"media_processing_description": "Manage your team's video transcoding configurations.",
"video_transcoding": "Video Transcoding",
"video_transcoding_description": "Manage your team's video transcoding configurations.",
"transcode_policy": "Transcode Policy",
"transcode_policy_description": "When HLS is disabled, both playback and download use MP4. When HLS is enabled, playback uses HLS streaming while download uses MP4. Note that enabling HLS may significantly increase storage usage.",
"transcode_settings": "Transcode Settings",
"transcode_description": "Manage your team's media transcoding configurations.",
"transcode_description": "Manage your team's video transcoding configurations.",
"transcode_strategy_note": "Strategy: We select the best resolution from your list that supports the input quality. Content is never upscaled.",
"hardware_acceleration_section_description": "Configure hardware-accelerated video encoding to offload workloads to GPUs, or use CPU software encoding.",
"mp4_transcoding": "MP4 Transcoding",
"mp4_transcoding_description": "Generate web-compatible MP4 files for file downloads and standard video playback.",
"video_strategy": "Video Strategy",
"best_match": "Best match",
"best_match_description": "Generates a single optimal resolution matching the source quality.",
+11 -3
View File
@@ -13,6 +13,7 @@
"personal_settings": "个人设置",
"team_settings": "团队设置",
"ai_settings": "AI 设置",
"team_ai_settings": "团队 AI 设置",
"welcome_back": "欢迎回来",
"create_account": "创建账户",
"select_a_team": "选择团队",
@@ -246,11 +247,18 @@
"failed_update_profile": "更新个人资料失败",
"failed_load_settings": "加载设置失败。",
"media_processing": "媒体处理",
"media_processing_description": "管理团队的媒体转码配置。",
"media_processing": "视频转码",
"media_processing_description": "管理团队的视频转码配置。",
"video_transcoding": "视频转码",
"video_transcoding_description": "管理团队的视频转码配置。",
"transcode_policy": "转码策略",
"transcode_policy_description": "未启用 HLS 时,播放和下载均使用 MP4。启用 HLS 后,播放将使用 HLS 自适应流,而下载使用 MP4。请注意,启用 HLS 可能会显著增加存储空间占用。",
"transcode_settings": "转码设置",
"transcode_description": "管理团队的媒体转码配置。",
"transcode_description": "管理团队的视频转码配置。",
"transcode_strategy_note": "策略:我们会从您的列表中选择支持输入质量的最佳分辨率。内容不会被放大。",
"hardware_acceleration_section_description": "配置硬件加速视频编码以将工作负载分流至 GPU,或使用 CPU 软件编码。",
"mp4_transcoding": "MP4 转码",
"mp4_transcoding_description": "生成适用于文件下载和标准视频播放的 Web 兼容 MP4 文件。",
"video_strategy": "视频策略",
"best_match": "最佳匹配",
"best_match_description": "生成与源质量匹配的单一最优分辨率。",
@@ -593,7 +593,7 @@ export function TeamSettingsPage() {
)}
>
<Film className="w-5 h-5" />
{m.media_processing()}
{m.video_transcoding()}
{activeTab === 'transcode' && (
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
)}
@@ -653,7 +653,7 @@ export function TeamSettingsPage() {
{me?.role === 'owner' && (
<>
<div className="mt-6 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border">
{m.ai_settings()}
{m.team_ai_settings()}
</div>
<button
@@ -763,7 +763,7 @@ export function TeamSettingsPage() {
<div>
<h2 className="text-2xl font-bold text-foreground">
{activeTab === 'general' && m.general_settings()}
{activeTab === 'transcode' && m.media_processing()}
{activeTab === 'transcode' && m.video_transcoding()}
{activeTab === 'quotas' && m.resource_quotas()}
{activeTab === 'appearance' && m.appearance_settings()}
{activeTab === 'email' && m.email_notifications()}
@@ -778,7 +778,7 @@ export function TeamSettingsPage() {
</h2>
<p className="text-sm text-muted-foreground mt-1">
{activeTab === 'general' && m.general_settings_description()}
{activeTab === 'transcode' && m.transcode_description()}
{activeTab === 'transcode' && m.video_transcoding_description()}
{activeTab === 'quotas' && m.resource_quotas_description()}
{activeTab === 'appearance' && m.appearance_settings_description()}
{activeTab === 'email' && m.email_notifications_description()}
@@ -926,19 +926,22 @@ export function TeamSettingsPage() {
)}
{activeTab === 'transcode' && (
<div className="h-full overflow-y-auto pr-1 pb-8">
<div className="h-full overflow-y-auto space-y-6 pr-1 pb-8">
{/* Transcode Policy Card */}
<Card>
<CardHeader>
<CardTitle>{m.transcode_settings()}</CardTitle>
<CardDescription>
<span className="block mb-2">{m.transcode_description()}</span>
<span className="block">{m.transcode_strategy_note()}</span>
</CardDescription>
<CardTitle>{m.transcode_policy()}</CardTitle>
<CardDescription>{m.transcode_policy_description()}</CardDescription>
</CardHeader>
<CardContent className="space-y-6">
{/* Video Strategy */}
<div className="space-y-3">
<h3 className="text-lg font-medium">{m.video_strategy()}</h3>
{/* MP4 Transcoding */}
<div className="space-y-4">
<div className="space-y-0.5">
<h3 className="text-lg font-medium">{m.mp4_transcoding()}</h3>
<p className="text-sm text-muted-foreground">
{m.mp4_transcoding_description()}
</p>
</div>
<div className="space-y-3">
<div
className={cn(
@@ -1012,81 +1015,6 @@ export function TeamSettingsPage() {
</div>
</div>
{/* Hardware Acceleration */}
<div className="space-y-3 pt-6 border-t border-border">
<h3 className="text-lg font-medium">{m.hardware_acceleration()}</h3>
<div className="space-y-3">
<div
className={cn(
'cursor-pointer rounded-lg border p-4 transition-all hover:border-primary',
currentHardwareAcceleration === HardwareAcceleration.off
? 'border-primary bg-primary/5'
: 'border-border',
)}
onClick={() =>
handleHardwareAccelerationChange(HardwareAcceleration.off)
}
>
<div className="font-semibold">{m.hardware_acceleration_off()}</div>
<div className="text-sm text-muted-foreground">
{m.hardware_acceleration_off_description()}
</div>
</div>
<div
className={cn(
'cursor-pointer rounded-lg border p-4 transition-all hover:border-primary',
currentHardwareAcceleration === HardwareAcceleration.auto
? 'border-primary bg-primary/5'
: 'border-border',
)}
onClick={() =>
handleHardwareAccelerationChange(HardwareAcceleration.auto)
}
>
<div className="font-semibold">{m.hardware_acceleration_auto()}</div>
<div className="text-sm text-muted-foreground">
{m.hardware_acceleration_auto_description()}
</div>
</div>
</div>
</div>
{/* FFmpeg Threads */}
<div className="space-y-4 pt-6 border-t border-border">
<div className="flex items-center justify-between">
<div>
<h3 className="text-lg font-medium">{m.ffmpeg_threads()}</h3>
<p className="text-sm text-muted-foreground">
{m.ffmpeg_threads_description()}
</p>
</div>
<span className="font-mono text-sm font-semibold px-2.5 py-1 rounded bg-muted text-foreground border border-border">
{currentThreads === 0
? m.threads_auto()
: m.threads_count({ count: currentThreads })}
</span>
</div>
<div className="pt-2 px-1">
<Slider
value={[currentThreads]}
min={0}
max={32}
step={1}
onValueChange={([val]) => setLocalThreads(val)}
onValueCommit={([val]) => {
setLocalThreads(val)
handleThreadsChange(val)
}}
/>
<div className="flex justify-between text-xs text-muted-foreground mt-2">
<span>{m.threads_auto()} (0)</span>
<span>16</span>
<span>32</span>
</div>
</div>
</div>
{/* HLS Streaming */}
<div className="space-y-4 pt-6 border-t border-border">
<div className="flex items-center justify-between">
@@ -1139,6 +1067,86 @@ export function TeamSettingsPage() {
</div>
</CardContent>
</Card>
{/* Hardware Acceleration Card */}
<Card>
<CardHeader>
<CardTitle>{m.hardware_acceleration()}</CardTitle>
<CardDescription>
{m.hardware_acceleration_section_description()}
</CardDescription>
</CardHeader>
<CardContent className="space-y-3">
<div
className={cn(
'cursor-pointer rounded-lg border p-4 transition-all hover:border-primary',
currentHardwareAcceleration === HardwareAcceleration.off
? 'border-primary bg-primary/5'
: 'border-border',
)}
onClick={() => handleHardwareAccelerationChange(HardwareAcceleration.off)}
>
<div className="font-semibold">{m.hardware_acceleration_off()}</div>
<div className="text-sm text-muted-foreground">
{m.hardware_acceleration_off_description()}
</div>
</div>
<div
className={cn(
'cursor-pointer rounded-lg border p-4 transition-all hover:border-primary',
currentHardwareAcceleration === HardwareAcceleration.auto
? 'border-primary bg-primary/5'
: 'border-border',
)}
onClick={() => handleHardwareAccelerationChange(HardwareAcceleration.auto)}
>
<div className="font-semibold">{m.hardware_acceleration_auto()}</div>
<div className="text-sm text-muted-foreground">
{m.hardware_acceleration_auto_description()}
</div>
</div>
</CardContent>
</Card>
{/* FFmpeg Threads Card */}
<Card>
<CardHeader>
<div className="flex items-center justify-between">
<div>
<CardTitle>{m.ffmpeg_threads()}</CardTitle>
<CardDescription className="mt-1.5">
{m.ffmpeg_threads_description()}
</CardDescription>
</div>
<span className="font-mono text-sm font-semibold px-2.5 py-1 rounded bg-muted text-foreground border border-border">
{currentThreads === 0
? m.threads_auto()
: m.threads_count({ count: currentThreads })}
</span>
</div>
</CardHeader>
<CardContent>
<div className="pt-2 px-1">
<Slider
value={[currentThreads]}
min={0}
max={32}
step={1}
onValueChange={([val]) => setLocalThreads(val)}
onValueCommit={([val]) => {
setLocalThreads(val)
handleThreadsChange(val)
}}
/>
<div className="flex justify-between text-xs text-muted-foreground mt-2">
<span>{m.threads_auto()} (0)</span>
<span>16</span>
<span>32</span>
</div>
</div>
</CardContent>
</Card>
</div>
)}
@@ -519,4 +519,41 @@ describe('TeamSettingsPage Transcode Settings', () => {
const lastPatch = patchCalls[patchCalls.length - 1]
expect(lastPatch.json.value).toEqual(['1080p', '1440p', '2160p'])
})
it('renders individual cards for Transcode Policy, Hardware Acceleration, and FFmpeg Threads with updated labels', async () => {
render(
<QueryClientProvider client={queryClient}>
<TeamSettingsPage />
</QueryClientProvider>,
)
await waitFor(() => {
expect(screen.getByRole('heading', { level: 2, name: /Video Transcoding/i })).toBeDefined()
})
// Sidebar navigation
expect(screen.getByText('Team AI Settings')).toBeDefined()
expect(screen.getByRole('button', { name: /Video Transcoding/i })).toBeDefined()
// Cards
expect(screen.getByText('Transcode Policy')).toBeDefined()
expect(
screen.getByText(
'When HLS is disabled, both playback and download use MP4. When HLS is enabled, playback uses HLS streaming while download uses MP4. Note that enabling HLS may significantly increase storage usage.',
),
).toBeDefined()
expect(screen.getByText('Hardware Acceleration')).toBeDefined()
expect(screen.getByText('FFmpeg Threads')).toBeDefined()
// MP4 Transcoding sub-section
expect(screen.getByText('MP4 Transcoding')).toBeDefined()
expect(
screen.getByText(
'Generate web-compatible MP4 files for file downloads and standard video playback.',
),
).toBeDefined()
// Redundant "Transcode Settings" card title should not be rendered
expect(screen.queryByRole('heading', { level: 3, name: 'Transcode Settings' })).toBeNull()
})
})