mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
fix settings page ui
This commit is contained in:
@@ -445,4 +445,3 @@ export function PublicShareManager({
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,174 +207,170 @@ function TeamPage() {
|
|||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<div className="flex flex-wrap items-center justify-between mb-4 gap-4">
|
<div className="flex flex-wrap items-center justify-between mb-4 gap-4">
|
||||||
<h1 className="text-2xl font-bold">Projects</h1>
|
<h1 className="text-2xl font-bold">Projects</h1>
|
||||||
<div className="flex flex-wrap items-center gap-4">
|
<div className="flex flex-wrap items-center gap-4">
|
||||||
<div
|
|
||||||
className="flex items-center -space-x-2 cursor-pointer hover:opacity-90"
|
|
||||||
onClick={() => setIsMembersDialogOpen(true)}
|
|
||||||
>
|
|
||||||
{safeMembers.slice(0, 3).map((member) => (
|
|
||||||
<Avatar key={member.id} className="border-2 border-background w-8 h-8">
|
|
||||||
<AvatarFallback className="text-[10px]">
|
|
||||||
{getInitials(member.name)}
|
|
||||||
</AvatarFallback>
|
|
||||||
</Avatar>
|
|
||||||
))}
|
|
||||||
{safeMembers.length > 3 && (
|
|
||||||
<div className="flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium">
|
|
||||||
+{safeMembers.length - 3}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<SortDropdown
|
|
||||||
sortBy={sortBy}
|
|
||||||
sortDirection={sortDirection}
|
|
||||||
onSortChange={handleSortChange}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
className="bg-orange-600 hover:bg-orange-700 text-white gap-2"
|
|
||||||
onClick={handleCreateProjectClick}
|
|
||||||
>
|
|
||||||
<PlusIcon className="w-4 h-4" />
|
|
||||||
Create Project
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-7 gap-4">
|
|
||||||
{projects.data?.map((project: ProjectInfo) => (
|
|
||||||
<div
|
|
||||||
key={project.id}
|
|
||||||
className={cn(
|
|
||||||
'shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out',
|
|
||||||
clickedProjectId === project.id ? 'scale-95' : 'scale-100',
|
|
||||||
)}
|
|
||||||
onClick={(e) => handleCardClick(project.id!, e)}
|
|
||||||
>
|
|
||||||
<div className="flex flex-col">
|
|
||||||
<div className="relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20">
|
|
||||||
{project.coverImage ? (
|
|
||||||
<img
|
|
||||||
src={project.coverImage}
|
|
||||||
alt={project.name}
|
|
||||||
className="w-full h-full object-cover rounded"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="text-center text-muted-foreground font-bold tracking-wider z-10">
|
|
||||||
<ShumaiLogo className="w-8 h-8 text-zinc-400" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0" />
|
|
||||||
<p className="absolute left-1 bottom-2 text-white">{project.name}</p>
|
|
||||||
</div>
|
|
||||||
<div className="px-2 h-10 flex justify-between items-center">
|
|
||||||
<p className="truncate pr-1 text-xs text-muted-foreground">
|
|
||||||
Updated {formatDateAgo((project.updatedAt as string) ?? '')}
|
|
||||||
</p>
|
|
||||||
<div onClick={(e) => e.stopPropagation()}>
|
|
||||||
<DropdownMenu modal={false}>
|
|
||||||
<DropdownMenuTrigger asChild>
|
|
||||||
<button className="hover:bg-muted outline-none flex px-1">
|
|
||||||
<MoreHorizontal className="w-5 h-5 text-muted-foreground" />
|
|
||||||
</button>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end">
|
|
||||||
<DropdownMenuItem
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
handleEditProjectClick(project)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Project Settings
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem
|
|
||||||
className="text-destructive focus:text-destructive"
|
|
||||||
onClick={() => handleDeleteProjectClick(project)}
|
|
||||||
>
|
|
||||||
Delete
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className="flex items-center -space-x-2 cursor-pointer hover:opacity-90"
|
||||||
'shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group',
|
onClick={() => setIsMembersDialogOpen(true)}
|
||||||
clickedProjectId === 'create' ? 'scale-95' : 'scale-100',
|
>
|
||||||
|
{safeMembers.slice(0, 3).map((member) => (
|
||||||
|
<Avatar key={member.id} className="border-2 border-background w-8 h-8">
|
||||||
|
<AvatarFallback className="text-[10px]">{getInitials(member.name)}</AvatarFallback>
|
||||||
|
</Avatar>
|
||||||
|
))}
|
||||||
|
{safeMembers.length > 3 && (
|
||||||
|
<div className="flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium">
|
||||||
|
+{safeMembers.length - 3}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
onClick={handleCreateCardClick}
|
</div>
|
||||||
|
<SortDropdown
|
||||||
|
sortBy={sortBy}
|
||||||
|
sortDirection={sortDirection}
|
||||||
|
onSortChange={handleSortChange}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
className="bg-orange-600 hover:bg-orange-700 text-white gap-2"
|
||||||
|
onClick={handleCreateProjectClick}
|
||||||
|
>
|
||||||
|
<PlusIcon className="w-4 h-4" />
|
||||||
|
Create Project
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-7 gap-4">
|
||||||
|
{projects.data?.map((project: ProjectInfo) => (
|
||||||
|
<div
|
||||||
|
key={project.id}
|
||||||
|
className={cn(
|
||||||
|
'shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out',
|
||||||
|
clickedProjectId === project.id ? 'scale-95' : 'scale-100',
|
||||||
|
)}
|
||||||
|
onClick={(e) => handleCardClick(project.id!, e)}
|
||||||
>
|
>
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<div className="relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors">
|
<div className="relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20">
|
||||||
<PlusIcon className="w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors" />
|
{project.coverImage ? (
|
||||||
|
<img
|
||||||
|
src={project.coverImage}
|
||||||
|
alt={project.name}
|
||||||
|
className="w-full h-full object-cover rounded"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="text-center text-muted-foreground font-bold tracking-wider z-10">
|
||||||
|
<ShumaiLogo className="w-8 h-8 text-zinc-400" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0" />
|
||||||
|
<p className="absolute left-1 bottom-2 text-white">{project.name}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors">
|
<div className="px-2 h-10 flex justify-between items-center">
|
||||||
<p className="text-sm text-muted-foreground group-hover:text-orange-600 transition-colors">
|
<p className="truncate pr-1 text-xs text-muted-foreground">
|
||||||
Create Project
|
Updated {formatDateAgo((project.updatedAt as string) ?? '')}
|
||||||
</p>
|
</p>
|
||||||
|
<div onClick={(e) => e.stopPropagation()}>
|
||||||
|
<DropdownMenu modal={false}>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<button className="hover:bg-muted outline-none flex px-1">
|
||||||
|
<MoreHorizontal className="w-5 h-5 text-muted-foreground" />
|
||||||
|
</button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end">
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
handleEditProjectClick(project)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Project Settings
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem
|
||||||
|
className="text-destructive focus:text-destructive"
|
||||||
|
onClick={() => handleDeleteProjectClick(project)}
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
))}
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
'shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group',
|
||||||
|
clickedProjectId === 'create' ? 'scale-95' : 'scale-100',
|
||||||
|
)}
|
||||||
|
onClick={handleCreateCardClick}
|
||||||
|
>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<div className="relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors">
|
||||||
|
<PlusIcon className="w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors" />
|
||||||
|
</div>
|
||||||
|
<div className="px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors">
|
||||||
|
<p className="text-sm text-muted-foreground group-hover:text-orange-600 transition-colors">
|
||||||
|
Create Project
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ProjectDialog
|
|
||||||
open={isProjectDialogOpen}
|
|
||||||
onOpenChange={setIsProjectDialogOpen}
|
|
||||||
mode={projectDialogMode}
|
|
||||||
teamId={teamId}
|
|
||||||
project={selectedProject}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
|
|
||||||
<AlertDialogContent>
|
|
||||||
<AlertDialogHeader>
|
|
||||||
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
||||||
<AlertDialogDescription>
|
|
||||||
This action cannot be undone. This will permanently delete the project "
|
|
||||||
{projectToDelete?.name}" and all its assets.
|
|
||||||
<div className="mt-4 flex flex-col gap-2 text-foreground">
|
|
||||||
<span className="text-sm font-medium">
|
|
||||||
Type <strong>delete</strong> to confirm:
|
|
||||||
</span>
|
|
||||||
<Input
|
|
||||||
value={deleteConfirmText}
|
|
||||||
onChange={(e) => setDeleteConfirmText(e.target.value)}
|
|
||||||
placeholder="delete"
|
|
||||||
className="h-9"
|
|
||||||
autoFocus
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</AlertDialogDescription>
|
|
||||||
</AlertDialogHeader>
|
|
||||||
<AlertDialogFooter>
|
|
||||||
<AlertDialogCancel disabled={deleteProjectMutation.isPending}>
|
|
||||||
Cancel
|
|
||||||
</AlertDialogCancel>
|
|
||||||
<AlertDialogAction
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault()
|
|
||||||
handleConfirmDelete()
|
|
||||||
}}
|
|
||||||
disabled={deleteConfirmText !== 'delete' || deleteProjectMutation.isPending}
|
|
||||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
|
||||||
>
|
|
||||||
{deleteProjectMutation.isPending ? 'Deleting...' : 'Delete'}
|
|
||||||
</AlertDialogAction>
|
|
||||||
</AlertDialogFooter>
|
|
||||||
</AlertDialogContent>
|
|
||||||
</AlertDialog>
|
|
||||||
|
|
||||||
<MembersDialog
|
|
||||||
open={isMembersDialogOpen}
|
|
||||||
onOpenChange={setIsMembersDialogOpen}
|
|
||||||
title="Team Members"
|
|
||||||
members={safeMembers}
|
|
||||||
isOwner={me?.role === 'owner'}
|
|
||||||
onInvite={handleInvite}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ProjectDialog
|
||||||
|
open={isProjectDialogOpen}
|
||||||
|
onOpenChange={setIsProjectDialogOpen}
|
||||||
|
mode={projectDialogMode}
|
||||||
|
teamId={teamId}
|
||||||
|
project={selectedProject}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
|
||||||
|
<AlertDialogContent>
|
||||||
|
<AlertDialogHeader>
|
||||||
|
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
||||||
|
<AlertDialogDescription>
|
||||||
|
This action cannot be undone. This will permanently delete the project "
|
||||||
|
{projectToDelete?.name}" and all its assets.
|
||||||
|
<div className="mt-4 flex flex-col gap-2 text-foreground">
|
||||||
|
<span className="text-sm font-medium">
|
||||||
|
Type <strong>delete</strong> to confirm:
|
||||||
|
</span>
|
||||||
|
<Input
|
||||||
|
value={deleteConfirmText}
|
||||||
|
onChange={(e) => setDeleteConfirmText(e.target.value)}
|
||||||
|
placeholder="delete"
|
||||||
|
className="h-9"
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</AlertDialogDescription>
|
||||||
|
</AlertDialogHeader>
|
||||||
|
<AlertDialogFooter>
|
||||||
|
<AlertDialogCancel disabled={deleteProjectMutation.isPending}>Cancel</AlertDialogCancel>
|
||||||
|
<AlertDialogAction
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
handleConfirmDelete()
|
||||||
|
}}
|
||||||
|
disabled={deleteConfirmText !== 'delete' || deleteProjectMutation.isPending}
|
||||||
|
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||||
|
>
|
||||||
|
{deleteProjectMutation.isPending ? 'Deleting...' : 'Delete'}
|
||||||
|
</AlertDialogAction>
|
||||||
|
</AlertDialogFooter>
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialog>
|
||||||
|
|
||||||
|
<MembersDialog
|
||||||
|
open={isMembersDialogOpen}
|
||||||
|
onOpenChange={setIsMembersDialogOpen}
|
||||||
|
title="Team Members"
|
||||||
|
members={safeMembers}
|
||||||
|
isOwner={me?.role === 'owner'}
|
||||||
|
onInvite={handleInvite}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
|
import { ImageTranscodeStrategy, VideoTranscodeStrategy } from '@/dtos/team'
|
||||||
import { client } from '@/ui/api/client'
|
import { client } from '@/ui/api/client'
|
||||||
import { VideoTranscodeStrategy, ImageTranscodeStrategy } from '@/dtos/team'
|
import { AgentsSettings } from '@/ui/components/settings/AgentsSettings'
|
||||||
|
import { ProvidersSettings } from '@/ui/components/settings/ProvidersSettings'
|
||||||
|
import { SandboxSettings } from '@/ui/components/settings/SandboxSettings'
|
||||||
|
import { SkillsConfigCard } from '@/ui/components/settings/SkillsConfigCard'
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
|
||||||
import { Switch } from '@/ui/components/ui/switch'
|
import { Switch } from '@/ui/components/ui/switch'
|
||||||
import { useQueryClient, useQuery, useMutation } from '@tanstack/react-query'
|
|
||||||
import { createFileRoute } from '@tanstack/react-router'
|
|
||||||
import { Loader2, User, Film, Cpu, Puzzle } from 'lucide-react'
|
|
||||||
import { cn } from '@/ui/lib/utils'
|
import { cn } from '@/ui/lib/utils'
|
||||||
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||||
|
import { createFileRoute } from '@tanstack/react-router'
|
||||||
|
import { Bot, Cpu, Film, Loader2, Puzzle, Shield, User } from 'lucide-react'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { ProvidersSettings } from '@/ui/components/settings/ProvidersSettings'
|
|
||||||
import { SkillsConfigCard } from '@/ui/components/settings/SkillsConfigCard'
|
|
||||||
import { AgentsSettings } from '@/ui/components/settings/AgentsSettings'
|
|
||||||
import { SandboxSettings } from '@/ui/components/settings/SandboxSettings'
|
|
||||||
import { Bot, Shield } from 'lucide-react'
|
|
||||||
|
|
||||||
type SettingsTab = 'general' | 'transcode' | 'skills' | 'providers' | 'agents' | 'sandbox'
|
type SettingsTab = 'general' | 'transcode' | 'skills' | 'providers' | 'agents' | 'sandbox'
|
||||||
|
|
||||||
@@ -105,10 +104,10 @@ function TeamSettingsPage() {
|
|||||||
(settings as any)?.transcode?.imageStrategy || ImageTranscodeStrategy.single
|
(settings as any)?.transcode?.imageStrategy || ImageTranscodeStrategy.single
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-slate-50 dark:bg-slate-950 font-sans selection:bg-blue-100 dark:selection:bg-blue-900 transition-colors duration-300">
|
<div className="h-full bg-slate-50 dark:bg-slate-950 font-sans selection:bg-blue-100 dark:selection:bg-blue-900 transition-colors duration-300">
|
||||||
<div className="flex flex-col md:flex-row min-h-screen">
|
<div className="flex flex-col md:flex-row h-full">
|
||||||
{/* Sidebar */}
|
{/* Sidebar */}
|
||||||
<aside className="w-full md:w-72 bg-white dark:bg-slate-900 border-b md:border-b-0 md:border-r border-slate-200 dark:border-slate-800 flex-shrink-0 z-10 md:fixed md:inset-y-0 md:left-16 overflow-y-auto transition-colors duration-300">
|
<div className="w-full h-full md:w-72 bg-white dark:bg-slate-900 border-b md:border-b-0 md:border-r border-slate-200 dark:border-slate-800 z-10 md:left-16 overflow-y-auto transition-colors duration-300">
|
||||||
<nav className="p-4 space-y-1 mt-4">
|
<nav className="p-4 space-y-1 mt-4">
|
||||||
<div className="mb-2 px-4 text-xs font-semibold text-slate-400 dark:text-slate-500 uppercase tracking-wider">
|
<div className="mb-2 px-4 text-xs font-semibold text-slate-400 dark:text-slate-500 uppercase tracking-wider">
|
||||||
Settings
|
Settings
|
||||||
@@ -214,10 +213,10 @@ function TeamSettingsPage() {
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</div>
|
||||||
|
|
||||||
{/* Main Content Area */}
|
{/* Main Content Area */}
|
||||||
<main className="flex-1 bg-slate-50/50 dark:bg-slate-950 md:ml-72 h-screen flex flex-col transition-colors duration-300 overflow-hidden">
|
<main className="flex-1 bg-slate-50/50 dark:bg-slate-950 h-full flex flex-col transition-colors duration-300 overflow-y-hidden">
|
||||||
<div className="flex-1 flex flex-col max-w-4xl w-full mx-auto p-6 md:p-10 overflow-hidden">
|
<div className="flex-1 flex flex-col max-w-4xl w-full mx-auto p-6 md:p-10 overflow-hidden">
|
||||||
<div className="flex-none flex items-center justify-between mb-6">
|
<div className="flex-none flex items-center justify-between mb-6">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user