feat: align projects page with Figma design
This commit is contained in:
parent
78848dd7d1
commit
9de99c833b
42 changed files with 347 additions and 384 deletions
|
|
@ -1,18 +1,21 @@
|
|||
import React from 'react'
|
||||
import { Outlet } from 'react-router-dom'
|
||||
import { Outlet, useLocation } from 'react-router-dom'
|
||||
import { Sidebar } from './components/Sidebar/Sidebar'
|
||||
import { Header } from './components/Header/Header'
|
||||
|
||||
export const DashboardLayout: React.FC<{ children?: React.ReactNode }> = ({
|
||||
children,
|
||||
}) => {
|
||||
const { pathname } = useLocation()
|
||||
const isProjectList = pathname === '/projects'
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen bg-[#F8FAFC] text-slate-900">
|
||||
<Sidebar />
|
||||
<div className={`flex text-slate-900 ${isProjectList ? 'h-screen min-h-0 overflow-hidden bg-[var(--project-canvas)]' : 'min-h-screen bg-[#F8FAFC]'}`}>
|
||||
<Sidebar isProjectList={isProjectList} />
|
||||
<div className="flex-1 flex flex-col min-w-0">
|
||||
<Header />
|
||||
<main className="flex-1 overflow-y-auto p-6 lg:p-8">
|
||||
<div className="mx-auto max-w-7xl">{children || <Outlet />}</div>
|
||||
<Header isProjectList={isProjectList} />
|
||||
<main className={`flex-1 overflow-y-auto ${isProjectList ? 'project-list-main h-[calc(100vh-64px)] min-h-0 p-6' : 'p-6 lg:p-8'}`}>
|
||||
<div className={isProjectList ? 'w-full' : 'mx-auto max-w-7xl'}>{children || <Outlet />}</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export const Breadcrumb: React.FC<BreadcrumbProps> = ({ items }) => {
|
|||
if (items && items.length > 0) return items
|
||||
|
||||
const path = location.pathname
|
||||
if (path === '/projects') return [{ label: 'Dự án' }]
|
||||
if (path.startsWith('/users')) {
|
||||
return [
|
||||
{ label: 'Không gian làm việc', to: '/projects' },
|
||||
|
|
@ -52,8 +53,10 @@ export const Breadcrumb: React.FC<BreadcrumbProps> = ({ items }) => {
|
|||
|
||||
return (
|
||||
<nav className="flex items-center gap-2 text-xs text-slate-500">
|
||||
<svg
|
||||
className="h-4 w-4 text-slate-400 shrink-0"
|
||||
{location.pathname === '/projects' ? (
|
||||
<img className="h-4 w-4 shrink-0" src="/assets/projects-ui/folder-open.svg" alt="" />
|
||||
) : <svg
|
||||
className={`h-4 w-4 shrink-0 ${location.pathname === '/projects' ? 'text-[#697386]' : 'text-slate-400'}`}
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
|
|
@ -64,7 +67,7 @@ export const Breadcrumb: React.FC<BreadcrumbProps> = ({ items }) => {
|
|||
strokeLinejoin="round"
|
||||
d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"
|
||||
/>
|
||||
</svg>
|
||||
</svg>}
|
||||
{resolvedItems.map((item, idx) => {
|
||||
const isLast = idx === resolvedItems.length - 1
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -6,16 +6,17 @@ import { UserMenu } from './UserMenu'
|
|||
|
||||
export interface HeaderProps {
|
||||
breadcrumbItems?: BreadcrumbItem[]
|
||||
isProjectList?: boolean
|
||||
}
|
||||
|
||||
export const Header: React.FC<HeaderProps> = ({ breadcrumbItems }) => {
|
||||
export const Header: React.FC<HeaderProps> = ({ breadcrumbItems, isProjectList = false }) => {
|
||||
return (
|
||||
<header className="h-14 shrink-0 bg-white border-b border-slate-200/80 px-6 flex items-center justify-between sticky top-0 z-20">
|
||||
<header className={`shrink-0 bg-white px-6 flex items-center justify-between sticky top-0 z-20 ${isProjectList ? 'h-16 shadow-[inset_0_-1px_0_0_var(--project-border)]' : 'h-14 border-b border-slate-200/80'}`}>
|
||||
<Breadcrumb items={breadcrumbItems} />
|
||||
<div className="flex items-center gap-4">
|
||||
<SystemStatus />
|
||||
<NotificationBell />
|
||||
<UserMenu />
|
||||
<div className={`flex items-center ${isProjectList ? 'gap-5' : 'gap-4'}`}>
|
||||
<SystemStatus isProjectList={isProjectList} />
|
||||
<NotificationBell isProjectList={isProjectList} />
|
||||
<UserMenu isProjectList={isProjectList} />
|
||||
</div>
|
||||
</header>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const MOCK_NOTIFICATIONS: NotificationItem[] = [
|
|||
},
|
||||
]
|
||||
|
||||
export const NotificationBell: React.FC = () => {
|
||||
export const NotificationBell: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
const [open, setOpen] = useState(false)
|
||||
const [notifications, setNotifications] = useState(MOCK_NOTIFICATIONS)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
|
|
@ -54,10 +54,10 @@ export const NotificationBell: React.FC = () => {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
className="relative rounded-full p-2 text-slate-500 hover:bg-slate-100 hover:text-slate-800 transition-colors"
|
||||
className={`relative rounded-full transition-colors ${isProjectList ? 'p-0 text-[#697386]' : 'p-2 text-slate-500 hover:bg-slate-100 hover:text-slate-800'}`}
|
||||
aria-label="Thông báo"
|
||||
>
|
||||
<svg
|
||||
{isProjectList ? <img className="h-[18px] w-[18px]" src="/assets/projects-ui/bell.svg" alt="" /> : <svg
|
||||
className="h-4 w-4"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
|
|
@ -69,8 +69,8 @@ export const NotificationBell: React.FC = () => {
|
|||
strokeLinejoin="round"
|
||||
d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
|
||||
/>
|
||||
</svg>
|
||||
{unreadCount > 0 && (
|
||||
</svg>}
|
||||
{!isProjectList && unreadCount > 0 && (
|
||||
<span className="absolute top-1.5 right-1.5 h-2 w-2 rounded-full bg-[#C95C3C] ring-2 ring-white" />
|
||||
)}
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react'
|
||||
|
||||
export const SystemStatus: React.FC = () => {
|
||||
export const SystemStatus: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
return (
|
||||
<div className="hidden sm:flex items-center gap-2 text-xs text-slate-600">
|
||||
<span className="h-2 w-2 rounded-full bg-emerald-600" />
|
||||
<div className={`hidden items-center text-slate-600 sm:flex ${isProjectList ? 'gap-2 text-[10px] text-[#697386]' : 'gap-2 text-xs'}`}>
|
||||
<span className={`rounded-full bg-[#168262] ${isProjectList ? 'h-1.5 w-1.5' : 'h-2 w-2 bg-emerald-600'}`} />
|
||||
<span>Hệ thống ổn định</span>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ import { useNavigate } from 'react-router-dom'
|
|||
import { Dropdown } from '../../../components/ui/Dropdown'
|
||||
import { showToast } from '../../../components/feedback/Toast'
|
||||
|
||||
export const UserMenu: React.FC = () => {
|
||||
export const UserMenu: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
const navigate = useNavigate()
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
align="right"
|
||||
trigger={
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-orange-100 text-xs font-bold text-slate-800 hover:ring-2 hover:ring-orange-200 transition-all">
|
||||
<div className={`flex h-[30px] w-[30px] items-center justify-center rounded-full text-[11px] font-semibold text-[#5451d6] transition-all ${isProjectList ? 'bg-[#f5ded6]' : 'bg-orange-100 text-slate-800 hover:ring-2 hover:ring-orange-200'}`}>
|
||||
MA
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,58 +1,39 @@
|
|||
import React from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import clsx from 'clsx'
|
||||
import { getProjects, subscribeProjectsStore } from '@/pages/projects/projectData'
|
||||
|
||||
interface RecentProjectItem {
|
||||
id: string
|
||||
name: string
|
||||
path: string
|
||||
dotColor: string
|
||||
}
|
||||
|
||||
const RECENT_PROJECTS: RecentProjectItem[] = [
|
||||
{
|
||||
id: 'proj-1',
|
||||
name: 'Phương tiện đô thị',
|
||||
path: '/projects/proj-1',
|
||||
dotColor: 'bg-indigo-500',
|
||||
},
|
||||
{
|
||||
id: 'proj-2',
|
||||
name: 'Giao thông đô thị',
|
||||
path: '/projects/proj-2',
|
||||
dotColor: 'bg-blue-600',
|
||||
},
|
||||
{
|
||||
id: 'proj-3',
|
||||
name: 'Phân vùng đường phố',
|
||||
path: '/projects/proj-3',
|
||||
dotColor: 'bg-violet-500',
|
||||
},
|
||||
]
|
||||
|
||||
export const RecentProjects: React.FC = () => {
|
||||
export const RecentProjects: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
const location = useLocation()
|
||||
const [recentProjects, setRecentProjects] = useState(() => getProjects().slice(0, 3))
|
||||
|
||||
useEffect(() => subscribeProjectsStore(() => setRecentProjects(getProjects().slice(0, 3))), [])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="px-2 mb-2 text-[10px] font-bold uppercase tracking-wider text-slate-500">
|
||||
<div className={`px-2 mb-2 text-[9px] font-semibold text-slate-500 ${isProjectList ? 'tracking-normal text-[#332926]' : 'uppercase tracking-wider'}`}>
|
||||
DỰ ÁN GẦN ĐÂY
|
||||
</div>
|
||||
<div className="space-y-0.5">
|
||||
{RECENT_PROJECTS.map((project) => {
|
||||
const isCurrent = location.pathname.startsWith(project.path)
|
||||
{recentProjects.map((project) => {
|
||||
const projectPath = `/projects/${project.id}`
|
||||
const dotColors = ['bg-[#a29fff]', 'bg-[#a29fff]', 'bg-[#a29fff]']
|
||||
const isCurrent = location.pathname.startsWith(projectPath)
|
||||
return (
|
||||
<Link
|
||||
key={project.id}
|
||||
to={project.path}
|
||||
to={projectPath}
|
||||
className={clsx(
|
||||
'flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-xs font-medium transition-colors',
|
||||
'flex items-center transition-colors',
|
||||
isProjectList
|
||||
? 'gap-2 px-2.5 py-0.5 text-[11px] font-normal leading-[17px] text-[#332926]'
|
||||
: 'gap-2.5 rounded-lg px-2.5 py-2 text-xs font-medium',
|
||||
isCurrent
|
||||
? 'bg-slate-100 text-slate-900 font-semibold'
|
||||
: 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'
|
||||
)}
|
||||
>
|
||||
<span className={clsx('h-1.5 w-1.5 rounded-full shrink-0', project.dotColor)} />
|
||||
<span className={`h-[5px] w-[5px] shrink-0 rounded-full ${isProjectList ? 'bg-[#a29fff]' : 'bg-indigo-500'}`} />
|
||||
<span className="truncate">{project.name}</span>
|
||||
</Link>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,15 @@ import { RecentProjects } from './RecentProjects'
|
|||
import { StorageUsage } from './StorageUsage'
|
||||
import { UserInfo } from './UserInfo'
|
||||
|
||||
export const Sidebar: React.FC = () => {
|
||||
export const Sidebar: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
return (
|
||||
<aside className="w-[240px] shrink-0 bg-white border-r border-slate-200/80 flex flex-col justify-between h-screen sticky top-0 px-3.5 py-4 select-none">
|
||||
<div className="space-y-5">
|
||||
<aside className={`shrink-0 bg-white flex flex-col justify-between h-screen sticky top-0 select-none ${isProjectList ? 'w-[216px] px-4 pt-7 pb-5' : 'w-[240px] border-r border-slate-200/80 px-3.5 py-4'}`}>
|
||||
<div className={isProjectList ? 'space-y-7' : 'space-y-5'}>
|
||||
{/* Brand Logo */}
|
||||
<Link to="/projects" className="flex items-center gap-2.5 px-1">
|
||||
{isProjectList ? (
|
||||
<img className="h-8 w-8 shrink-0" src="/assets/bi-u-tr-ng.svg" alt="" />
|
||||
) : (
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-[#C95C3C] text-white shadow-sm">
|
||||
<svg className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.2}>
|
||||
<path
|
||||
|
|
@ -21,24 +24,25 @@ export const Sidebar: React.FC = () => {
|
|||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<span className="text-xl font-bold tracking-tight text-slate-900">
|
||||
)}
|
||||
<span className={isProjectList ? 'text-[25px] font-bold tracking-[-1px] text-[#332926]' : 'text-xl font-bold tracking-tight text-slate-900'}>
|
||||
danable
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
{/* Workspace Selector */}
|
||||
<WorkspaceSelector />
|
||||
<WorkspaceSelector isProjectList={isProjectList} />
|
||||
|
||||
{/* Navigation Links */}
|
||||
<SidebarNav />
|
||||
<SidebarNav isProjectList={isProjectList} />
|
||||
|
||||
{/* Recent Projects */}
|
||||
<RecentProjects />
|
||||
<RecentProjects isProjectList={isProjectList} />
|
||||
</div>
|
||||
|
||||
<div className="space-y-4 pt-4">
|
||||
<StorageUsage />
|
||||
<UserInfo />
|
||||
<div className={isProjectList ? 'space-y-2.5' : 'space-y-4 pt-4'}>
|
||||
<StorageUsage isProjectList={isProjectList} />
|
||||
<UserInfo isProjectList={isProjectList} />
|
||||
</div>
|
||||
</aside>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ interface NavItem {
|
|||
to: string
|
||||
label: string
|
||||
badge: number
|
||||
icon: React.ReactNode
|
||||
icon: string
|
||||
matchPrefix: string
|
||||
}
|
||||
|
||||
export const SidebarNav: React.FC = () => {
|
||||
export const SidebarNav: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
const location = useLocation()
|
||||
|
||||
const navItems: NavItem[] = [
|
||||
|
|
@ -19,36 +19,20 @@ export const SidebarNav: React.FC = () => {
|
|||
label: 'Dự án',
|
||||
badge: 3,
|
||||
matchPrefix: '/projects',
|
||||
icon: (
|
||||
<svg className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
icon: '/assets/projects-ui/layout-grid.svg',
|
||||
},
|
||||
{
|
||||
to: '/users',
|
||||
label: 'Người dùng',
|
||||
badge: 8,
|
||||
matchPrefix: '/users',
|
||||
icon: (
|
||||
<svg className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
icon: '/assets/projects-ui/users.svg',
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="px-2 mb-2 text-[10px] font-bold uppercase tracking-wider text-slate-500">
|
||||
<div className={`px-2 mb-2 text-[9px] font-semibold text-slate-500 ${isProjectList ? 'tracking-normal text-[#332926]' : 'uppercase tracking-wider'}`}>
|
||||
KHÔNG GIAN LÀM VIỆC
|
||||
</div>
|
||||
<nav className="space-y-1">
|
||||
|
|
@ -63,16 +47,14 @@ export const SidebarNav: React.FC = () => {
|
|||
key={item.to}
|
||||
to={item.to}
|
||||
className={clsx(
|
||||
'flex items-center justify-between rounded-xl px-3 py-2.5 text-sm font-medium transition-colors',
|
||||
`flex items-center justify-between transition-colors ${isProjectList ? 'h-[42px] rounded-[7px] px-3 text-[13px]' : 'rounded-xl px-3 py-2.5 text-sm'} font-medium`,
|
||||
isActive
|
||||
? 'bg-[#C95C3C] text-white shadow-sm'
|
||||
? (isProjectList ? 'bg-[#c75c4a] text-white' : 'bg-[#C95C3C] text-white shadow-sm')
|
||||
: 'text-slate-700 hover:bg-slate-100'
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center gap-2.5">
|
||||
<span className={clsx(isActive ? 'text-white' : 'text-slate-500')}>
|
||||
{item.icon}
|
||||
</span>
|
||||
<img className="h-[18px] w-[18px] shrink-0" src={item.icon} alt="" />
|
||||
<span>{item.label}</span>
|
||||
</div>
|
||||
<span
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
import React from 'react'
|
||||
|
||||
export const StorageUsage: React.FC = () => {
|
||||
export const StorageUsage: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
return (
|
||||
<div className="rounded-xl bg-slate-100/80 border border-slate-200/60 p-3.5">
|
||||
<div className="flex items-center justify-between text-xs font-medium text-slate-700 mb-2">
|
||||
<div className={`rounded-[8px] p-3 ${isProjectList ? 'bg-[#f1f3fe]' : 'rounded-xl border border-slate-200/60 bg-slate-100/80 p-3.5'}`}>
|
||||
<div className={`mb-2 flex items-center justify-between font-medium text-slate-700 ${isProjectList ? 'text-[10px] text-[#332926]' : 'text-xs'}`}>
|
||||
<span>Dung lượng dữ liệu</span>
|
||||
<span className="font-semibold text-slate-900">24%</span>
|
||||
</div>
|
||||
<div className="h-1.5 w-full overflow-hidden rounded-full bg-slate-200">
|
||||
<div className="h-1 w-full overflow-hidden rounded-full bg-[#e5e8ed]">
|
||||
<div
|
||||
className="h-full rounded-full bg-[#3B5BDB]"
|
||||
className={`h-full rounded-full ${isProjectList ? 'bg-[#8a87f4]' : 'bg-[#3B5BDB]'}`}
|
||||
style={{ width: '24%' }}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-2 text-[11px] text-slate-500">
|
||||
<div className={`mt-2 text-slate-500 ${isProjectList ? 'text-[9px] text-[#332926]' : 'text-[11px]'}`}>
|
||||
12 GB / 50 GB đã sử dụng
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React from 'react'
|
|||
import { useNavigate } from 'react-router-dom'
|
||||
import { showToast } from '../../../components/feedback/Toast'
|
||||
|
||||
export const UserInfo: React.FC = () => {
|
||||
export const UserInfo: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
const navigate = useNavigate()
|
||||
|
||||
const handleLogout = () => {
|
||||
|
|
@ -15,10 +15,10 @@ export const UserInfo: React.FC = () => {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => showToast.info('Tài liệu hướng dẫn sử dụng danable v1.0')}
|
||||
className="flex w-full items-center gap-2 px-2 py-1.5 text-xs font-medium text-slate-600 hover:text-slate-900 transition-colors"
|
||||
className={`flex w-full items-center gap-2 text-xs font-medium text-slate-600 transition-colors hover:text-slate-900 ${isProjectList ? 'px-2.5 py-2 text-[11px]' : 'px-2 py-1.5'}`}
|
||||
>
|
||||
<svg
|
||||
className="h-4 w-4 text-slate-400"
|
||||
{isProjectList ? <img className="h-4 w-4" src="/assets/projects-ui/circle-help.svg" alt="" /> : <svg
|
||||
className={`h-4 w-4 ${isProjectList ? 'text-[#697386]' : 'text-slate-400'}`}
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
|
|
@ -29,25 +29,25 @@ export const UserInfo: React.FC = () => {
|
|||
strokeLinejoin="round"
|
||||
d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg>
|
||||
</svg>}
|
||||
<span>Tài liệu & hỗ trợ</span>
|
||||
</button>
|
||||
|
||||
<div className="border-t border-slate-200 pt-3 flex items-center justify-between">
|
||||
<div className={`flex items-center justify-between ${isProjectList ? 'border-t border-[#2d374d] pt-[18px]' : 'border-t border-slate-200 pt-3'}`}>
|
||||
<div className="flex items-center gap-2.5 min-w-0">
|
||||
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-orange-100 text-xs font-bold text-slate-800">
|
||||
<div className={`flex shrink-0 items-center justify-center rounded-full font-semibold ${isProjectList ? 'h-[34px] w-[34px] bg-[#f5ded6] text-[11px] text-[#332926]' : 'h-8 w-8 bg-orange-100 text-xs text-slate-800'}`}>
|
||||
MA
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div className="truncate text-xs font-semibold text-slate-900">
|
||||
<div className={`truncate font-semibold ${isProjectList ? 'text-[12px] text-[#332926]' : 'text-xs text-slate-900'}`}>
|
||||
Minh Anh
|
||||
</div>
|
||||
<div className="truncate text-[11px] text-slate-500">
|
||||
<div className={`truncate ${isProjectList ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
|
||||
Quản trị viên
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
{!isProjectList && <button
|
||||
type="button"
|
||||
onClick={handleLogout}
|
||||
title="Đăng xuất"
|
||||
|
|
@ -66,7 +66,7 @@ export const UserInfo: React.FC = () => {
|
|||
d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</button>}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState } from 'react'
|
||||
import { showToast } from '../../../components/feedback/Toast'
|
||||
|
||||
export const WorkspaceSelector: React.FC = () => {
|
||||
export const WorkspaceSelector: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
return (
|
||||
|
|
@ -9,34 +9,28 @@ export const WorkspaceSelector: React.FC = () => {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
className="w-full flex items-center justify-between rounded-xl border border-slate-300/90 bg-white px-3 py-2.5 text-left hover:border-slate-400 transition-colors"
|
||||
className={`w-full flex items-center justify-between bg-white text-left transition-colors ${isProjectList ? 'gap-[9px] rounded-[8px] border border-[#344057] p-2.5 hover:border-[#344057]' : 'rounded-xl border border-slate-300/90 px-3 py-2.5 hover:border-slate-400'}`}
|
||||
>
|
||||
<div className="flex items-center gap-2.5 min-w-0">
|
||||
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-indigo-50 text-xs font-bold text-slate-700">
|
||||
<div className={`flex h-8 w-8 shrink-0 items-center justify-center text-[11px] font-semibold text-[#332926] ${isProjectList ? 'h-7 w-7 rounded-[6px] bg-[#d6dae6]' : 'rounded-full bg-indigo-50 text-slate-700'}`}>
|
||||
VL
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div className="truncate text-sm font-semibold text-slate-900 leading-tight">
|
||||
<div className={`truncate font-semibold leading-tight ${isProjectList ? 'text-[13px] text-[#332926]' : 'text-sm text-slate-900'}`}>
|
||||
danable
|
||||
</div>
|
||||
<div className="truncate text-[11px] text-slate-500 mt-0.5">
|
||||
<div className={`truncate mt-0.5 ${isProjectList ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
|
||||
Không gian nhóm
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<svg
|
||||
className="h-4 w-4 text-slate-400 shrink-0"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
strokeWidth={1.8}
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M8 9l4-4 4 4m0 6l-4 4-4-4"
|
||||
/>
|
||||
</svg>
|
||||
{isProjectList ? (
|
||||
<img className="h-[13px] w-[13px] shrink-0" src="/assets/projects-ui/chevrons-up-down.svg" alt="" />
|
||||
) : (
|
||||
<svg className="h-4 w-4 shrink-0 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.8}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M8 9l4-4 4 4m0 6l-4 4-4-4" />
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
|
||||
{open && (
|
||||
|
|
|
|||
|
|
@ -77,14 +77,14 @@ export const ProjectListPage: React.FC = () => {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
<div className="project-dashboard space-y-5">
|
||||
{/* Page Header matching MVP · Quản lý dự án.png */}
|
||||
<div className="flex flex-wrap items-start justify-between gap-4">
|
||||
<div className="flex flex-wrap items-center justify-between gap-4">
|
||||
<div>
|
||||
<h1 className="text-[28px] font-bold leading-tight tracking-tight text-slate-900">
|
||||
<h1 className="text-[27px] font-medium leading-[40.5px] tracking-[-1px] text-[var(--project-heading)]">
|
||||
Dự án của bạn
|
||||
</h1>
|
||||
<p className="mt-1 text-xs text-slate-500">
|
||||
<p className="mt-1.5 text-xs leading-[18px] text-[var(--project-body)]">
|
||||
Quản lý dữ liệu, phân công gán nhãn và kiểm soát chất lượng trong một nơi.
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -92,9 +92,9 @@ export const ProjectListPage: React.FC = () => {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => setIsCreateModalOpen(true)}
|
||||
className="inline-flex items-center gap-2 rounded-xl bg-[#C95C3C] px-4 py-2.5 text-xs font-semibold text-white shadow-sm transition hover:bg-[#B5492B]"
|
||||
className="inline-flex h-10 items-center gap-2 rounded-lg bg-[var(--color-brand-orange-red)] px-4 text-[13px] font-semibold text-white [outline:1px_solid_var(--project-accent)] [outline-offset:-1px] transition hover:bg-[var(--brand-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--project-accent)]"
|
||||
>
|
||||
<span className="text-base leading-none">+</span>
|
||||
<img className="h-4 w-4" src="/assets/projects-ui/plus.svg" alt="" />
|
||||
<span>Tạo dự án</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,24 +16,12 @@ export const ActivityFeed: React.FC<ActivityFeedProps> = ({
|
|||
const displayed = expanded ? activities : activities.slice(0, 2)
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-5">
|
||||
{/* Main Activity Bar matching wireframe */}
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-slate-200/80 bg-white px-5 py-3 shadow-[0_1px_2px_rgba(15,23,42,0.02)]">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 px-3 py-2">
|
||||
<div className="flex flex-wrap items-center gap-6 text-xs text-slate-500">
|
||||
{/* Pulse / Waveform icon */}
|
||||
<svg
|
||||
className="h-4 w-4 text-slate-400 shrink-0"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth={2}
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M3 12h4l3-8 4 16 3-8h4"
|
||||
/>
|
||||
</svg>
|
||||
<img className="h-[15px] w-[15px] shrink-0" src="/assets/projects-ui/activity.svg" alt="" />
|
||||
|
||||
{displayed.map((act) => (
|
||||
<span key={act.id} className="inline-flex items-center gap-1 text-slate-500">
|
||||
|
|
@ -48,7 +36,7 @@ export const ActivityFeed: React.FC<ActivityFeedProps> = ({
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => setExpanded((prev) => !prev)}
|
||||
className="text-xs font-semibold text-indigo-600 hover:text-indigo-700 transition"
|
||||
className="text-[11px] font-semibold text-[var(--project-accent)] transition hover:opacity-80"
|
||||
>
|
||||
{expanded ? 'Thu gọn ↑' : 'Xem tất cả →'}
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,39 +1,45 @@
|
|||
import React, { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { Project, TaskType } from '@/types'
|
||||
import { Project, ProjectStatus, TaskType } from '@/types'
|
||||
|
||||
interface ProjectCardProps {
|
||||
project: Project
|
||||
onDelete?: (projectId: string) => void
|
||||
}
|
||||
|
||||
const TASK_BADGE_CONFIG: Record<
|
||||
TaskType,
|
||||
{ label: string; icon: React.ReactNode }
|
||||
const TASK_BADGE_CONFIG: Record<TaskType, { label: string; iconSrc: string }> = {
|
||||
classification: { label: 'Classification', iconSrc: '/assets/projects-ui/tags.svg' },
|
||||
object_detection: { label: 'Object Detection', iconSrc: '/assets/projects-ui/scan.svg' },
|
||||
segmentation: { label: 'Segmentation', iconSrc: '/assets/projects-ui/pentagon.svg' },
|
||||
}
|
||||
|
||||
const PROJECT_STATUS_PRESENTATION: Record<
|
||||
ProjectStatus,
|
||||
{ label: string; background: string; text: string; dot: string }
|
||||
> = {
|
||||
classification: {
|
||||
label: 'Classification',
|
||||
icon: (
|
||||
<svg className="h-3.5 w-3.5 text-slate-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
|
||||
</svg>
|
||||
),
|
||||
annotating: {
|
||||
label: 'Đang gán nhãn',
|
||||
background: 'var(--project-status-active-bg)',
|
||||
text: 'var(--project-status-active-text)',
|
||||
dot: 'var(--color-brand-orange-red)',
|
||||
},
|
||||
object_detection: {
|
||||
label: 'Object Detection',
|
||||
icon: (
|
||||
<svg className="h-3.5 w-3.5 text-slate-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M4 8V5a1 1 0 011-1h3M16 4h3a1 1 0 011 1v3M20 16v3a1 1 0 01-1 1h-3M8 20H5a1 1 0 01-1-1v-3" />
|
||||
</svg>
|
||||
),
|
||||
pending_review: {
|
||||
label: 'Chờ duyệt',
|
||||
background: 'var(--project-status-review-bg)',
|
||||
text: 'var(--project-status-review-text)',
|
||||
dot: 'var(--project-status-review-dot)',
|
||||
},
|
||||
segmentation: {
|
||||
label: 'Segmentation',
|
||||
icon: (
|
||||
<svg className="h-3.5 w-3.5 text-slate-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
||||
<polygon points="12 3 20 8.5 17 19 7 19 4 8.5" strokeLinecap="round" strokeLinejoin="round" />
|
||||
</svg>
|
||||
),
|
||||
completed: {
|
||||
label: 'Hoàn thành',
|
||||
background: 'var(--project-status-complete-bg)',
|
||||
text: 'var(--project-status-complete-text)',
|
||||
dot: 'var(--project-status-complete-text)',
|
||||
},
|
||||
draft: {
|
||||
label: 'Bản nháp',
|
||||
background: 'var(--project-status-draft-bg)',
|
||||
text: 'var(--project-status-draft-text)',
|
||||
dot: 'var(--project-status-draft-text)',
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -48,10 +54,11 @@ export const ProjectCard: React.FC<ProjectCardProps> = ({ project, onDelete }) =
|
|||
? Math.round((annotatedCount / project.stats.totalImages) * 100)
|
||||
: 0
|
||||
|
||||
const formatNum = (n: number) => n.toLocaleString('vi-VN')
|
||||
const formatProjectNumber = (value: number) => value.toLocaleString('vi-VN')
|
||||
|
||||
const isPendingReviewHighlight =
|
||||
project.status === 'pending_review' && project.stats.pendingReview > 0
|
||||
const statusPresentation = PROJECT_STATUS_PRESENTATION[project.status]
|
||||
|
||||
const displayMembers = project.members.slice(0, 3)
|
||||
|
||||
|
|
@ -62,128 +69,28 @@ export const ProjectCard: React.FC<ProjectCardProps> = ({ project, onDelete }) =
|
|||
return (
|
||||
<div
|
||||
onClick={handleOpenOverview}
|
||||
className="group relative flex cursor-pointer flex-col overflow-hidden rounded-2xl border border-slate-200/80 bg-white shadow-[0_1px_3px_rgba(15,23,42,0.04)] transition-all duration-200 hover:-translate-y-0.5 hover:border-slate-300 hover:shadow-md"
|
||||
className="group relative flex cursor-pointer flex-col overflow-hidden rounded-[12px] border border-[var(--project-border)] bg-[var(--project-surface)] shadow-none transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md"
|
||||
>
|
||||
{/* Top Thumbnail with decorative overlays */}
|
||||
<div className="relative h-44 w-full overflow-hidden bg-slate-100">
|
||||
<div className="relative h-[174px] w-full overflow-hidden bg-slate-100">
|
||||
<img
|
||||
src={project.thumbnailUrl}
|
||||
alt={project.name}
|
||||
className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]"
|
||||
/>
|
||||
|
||||
{/* Decorative Bounding Box overlay for Object Detection */}
|
||||
{project.taskType === 'object_detection' && (
|
||||
<svg
|
||||
className="pointer-events-none absolute inset-0 h-full w-full"
|
||||
viewBox="0 0 400 180"
|
||||
preserveAspectRatio="none"
|
||||
>
|
||||
{/* Cyan bbox around car */}
|
||||
<rect
|
||||
x="105"
|
||||
y="72"
|
||||
width="66"
|
||||
height="48"
|
||||
fill="rgba(6, 182, 212, 0.14)"
|
||||
stroke="#06B6D4"
|
||||
strokeWidth="2"
|
||||
rx="2"
|
||||
/>
|
||||
<rect x="105" y="61" width="32" height="11" fill="#06B6D4" rx="1.5" />
|
||||
<text x="109" y="69" fill="#ffffff" fontSize="7.5" fontWeight="600">
|
||||
Ô tô
|
||||
</text>
|
||||
|
||||
{/* Red/Orange bbox around bus */}
|
||||
<rect
|
||||
x="212"
|
||||
y="34"
|
||||
width="124"
|
||||
height="84"
|
||||
fill="rgba(239, 68, 68, 0.14)"
|
||||
stroke="#EF4444"
|
||||
strokeWidth="2"
|
||||
rx="2"
|
||||
/>
|
||||
<rect x="212" y="23" width="44" height="11" fill="#EF4444" rx="1.5" />
|
||||
<text x="216" y="31" fill="#ffffff" fontSize="7.5" fontWeight="600">
|
||||
Xe buýt
|
||||
</text>
|
||||
|
||||
{/* Amber bbox around motorbike */}
|
||||
<rect
|
||||
x="248"
|
||||
y="112"
|
||||
width="34"
|
||||
height="52"
|
||||
fill="rgba(245, 158, 11, 0.16)"
|
||||
stroke="#F59E0B"
|
||||
strokeWidth="1.8"
|
||||
rx="2"
|
||||
/>
|
||||
<rect
|
||||
x="298"
|
||||
y="108"
|
||||
width="36"
|
||||
height="56"
|
||||
fill="rgba(34, 197, 94, 0.16)"
|
||||
stroke="#22C55E"
|
||||
strokeWidth="1.8"
|
||||
rx="2"
|
||||
/>
|
||||
</svg>
|
||||
)}
|
||||
|
||||
{/* Decorative Polygon Mask overlay for Segmentation */}
|
||||
{project.taskType === 'segmentation' && (
|
||||
<svg
|
||||
className="pointer-events-none absolute inset-0 h-full w-full"
|
||||
viewBox="0 0 400 180"
|
||||
preserveAspectRatio="none"
|
||||
>
|
||||
{/* Cyan polygon mask on car */}
|
||||
<polygon
|
||||
points="110,94 122,74 156,74 168,92 166,118 108,118"
|
||||
fill="rgba(6, 182, 212, 0.36)"
|
||||
stroke="#22D3EE"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
{/* Red/Coral polygon mask on bus */}
|
||||
<polygon
|
||||
points="216,42 292,35 334,54 334,114 276,118 216,96"
|
||||
fill="rgba(239, 68, 68, 0.35)"
|
||||
stroke="#F87171"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
{/* Green polygon masks on motorbikes */}
|
||||
<polygon
|
||||
points="254,124 268,112 280,128 276,162 252,160"
|
||||
fill="rgba(34, 197, 94, 0.38)"
|
||||
stroke="#4ADE80"
|
||||
strokeWidth="1.8"
|
||||
/>
|
||||
<polygon
|
||||
points="304,118 318,108 332,126 328,162 302,160"
|
||||
fill="rgba(168, 85, 247, 0.38)"
|
||||
stroke="#C084FC"
|
||||
strokeWidth="1.8"
|
||||
/>
|
||||
</svg>
|
||||
)}
|
||||
|
||||
{/* Top-left Task Badge */}
|
||||
<div className="absolute left-3.5 top-3.5 inline-flex items-center gap-1.5 rounded-lg bg-white/95 px-2.5 py-1 text-xs font-semibold text-slate-800 shadow-sm backdrop-blur-sm">
|
||||
{badge.icon}
|
||||
<div className="absolute left-3 top-3 inline-flex items-center gap-1.5 rounded-[5px] bg-white/95 px-[9px] py-[5px] text-[10px] font-semibold text-[var(--project-heading)] shadow-sm backdrop-blur-sm">
|
||||
<img className="h-3 w-3" src={badge.iconSrc} alt="" />
|
||||
<span>{badge.label}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Card Content */}
|
||||
<div className="flex flex-1 flex-col p-5">
|
||||
<div className="flex flex-1 flex-col gap-[13px] p-[18px]">
|
||||
{/* Title + 3-dots menu */}
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<h3 className="text-lg font-bold text-slate-900 group-hover:text-[#C95C3C] transition-colors">
|
||||
<h3 className="text-[17px] font-semibold leading-[26px] text-[var(--project-heading)] group-hover:text-[var(--project-accent)] transition-colors">
|
||||
{project.name}
|
||||
</h3>
|
||||
<div className="relative" onClick={(e) => e.stopPropagation()}>
|
||||
|
|
@ -193,9 +100,7 @@ export const ProjectCard: React.FC<ProjectCardProps> = ({ project, onDelete }) =
|
|||
className="flex h-7 w-7 items-center justify-center rounded-lg text-slate-400 hover:bg-slate-100 hover:text-slate-600"
|
||||
aria-label="Tùy chọn dự án"
|
||||
>
|
||||
<svg className="h-4 w-4" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M6 10a2 2 0 11-4 0 2 2 0 014 0zm6 0a2 2 0 11-4 0 2 2 0 014 0zm6 0a2 2 0 11-4 0 2 2 0 014 0z" />
|
||||
</svg>
|
||||
<img className="h-4 w-4" src="/assets/projects-ui/ellipsis.svg" alt="" />
|
||||
</button>
|
||||
{menuOpen && (
|
||||
<div className="absolute right-0 top-8 z-20 w-44 rounded-xl border border-slate-200 bg-white py-1.5 shadow-lg">
|
||||
|
|
@ -237,50 +142,47 @@ export const ProjectCard: React.FC<ProjectCardProps> = ({ project, onDelete }) =
|
|||
</div>
|
||||
|
||||
{/* Description & Monospace Slug */}
|
||||
<p className="mt-1 text-xs text-slate-500">{project.description}</p>
|
||||
<p className="mt-2 font-mono text-[11px] text-slate-400">{project.slug}</p>
|
||||
<p className="text-[11px] leading-[17px] text-[var(--project-body)]">{project.description}</p>
|
||||
<p className="font-mono text-[10px] leading-[15px] text-[var(--project-muted)]">{project.slug}</p>
|
||||
|
||||
{/* Image count & class count */}
|
||||
<div className="mt-3.5 flex items-center gap-3 text-xs font-medium text-slate-600">
|
||||
<span>{formatNum(project.stats.totalImages)} ảnh</span>
|
||||
<div className="flex items-center gap-4 text-[11px] leading-[17px] text-[var(--project-body)]">
|
||||
<span>{formatProjectNumber(project.stats.totalImages)} ảnh</span>
|
||||
<span>{project.classes.length} lớp</span>
|
||||
</div>
|
||||
|
||||
{/* Progress text & bar */}
|
||||
<div className="mt-3">
|
||||
<div className="flex items-center justify-between text-xs">
|
||||
<span className="text-slate-500">{formatNum(annotatedCount)} đã gán nhãn</span>
|
||||
<span className="font-bold text-indigo-600">{progressPercent}%</span>
|
||||
<div>
|
||||
<div className="flex items-center justify-between text-[11px]">
|
||||
<span className="text-[var(--project-body)]">{formatProjectNumber(annotatedCount)} đã gán nhãn</span>
|
||||
<span className="font-semibold text-[var(--project-accent)]">{progressPercent}%</span>
|
||||
</div>
|
||||
<div className="mt-2 h-1.5 w-full overflow-hidden rounded-full bg-slate-100">
|
||||
<div className="mt-1.5 h-[5px] w-full overflow-hidden rounded-full bg-[var(--project-border)]">
|
||||
<div
|
||||
className="h-full rounded-full bg-[#C95C3C] transition-all duration-300"
|
||||
className="h-full rounded-full bg-[var(--color-brand-orange-red)] transition-all duration-300"
|
||||
style={{ width: `${Math.min(100, Math.max(0, progressPercent))}%` }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Status Pill & Member Avatar Stack */}
|
||||
<div className="mt-4 flex items-center justify-between">
|
||||
{isPendingReviewHighlight ? (
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-[#FEF3C7] px-3 py-1 text-xs font-semibold text-[#B45309]">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#F59E0B]" />
|
||||
{formatNum(project.stats.pendingReview)} ảnh chờ duyệt
|
||||
</span>
|
||||
) : (
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-[#FEE2E2]/80 px-3 py-1 text-xs font-semibold text-[#B91C1C]">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#EF4444]" />
|
||||
Đang gán nhãn
|
||||
</span>
|
||||
)}
|
||||
<div className="flex items-center justify-between">
|
||||
<span
|
||||
className="inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] font-medium"
|
||||
style={{ backgroundColor: statusPresentation.background, color: statusPresentation.text }}
|
||||
>
|
||||
<span className="h-1.5 w-1.5 rounded-full" style={{ backgroundColor: statusPresentation.dot }} />
|
||||
{isPendingReviewHighlight
|
||||
? `${formatProjectNumber(project.stats.pendingReview)} ảnh chờ duyệt`
|
||||
: statusPresentation.label}
|
||||
</span>
|
||||
|
||||
<div className="flex items-center -space-x-1.5">
|
||||
{displayMembers.map((member) => (
|
||||
<div
|
||||
key={member.id}
|
||||
title={member.name}
|
||||
style={{ backgroundColor: member.color }}
|
||||
className="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white text-[10px] font-bold text-slate-700"
|
||||
className="flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-[var(--project-avatar-background)] text-[11px] font-semibold text-[var(--project-accent)]"
|
||||
>
|
||||
{member.initials}
|
||||
</div>
|
||||
|
|
@ -289,9 +191,9 @@ export const ProjectCard: React.FC<ProjectCardProps> = ({ project, onDelete }) =
|
|||
</div>
|
||||
|
||||
{/* Divider + Footer */}
|
||||
<div className="mt-4 flex items-center justify-between border-t border-slate-100 pt-3.5 text-xs">
|
||||
<span className="text-slate-400">{project.updatedAt}</span>
|
||||
<span className="inline-flex items-center gap-1 font-semibold text-indigo-600 group-hover:translate-x-0.5 transition-transform">
|
||||
<div className="flex items-center justify-between border-t border-[var(--project-border)] pt-3 text-[10px]">
|
||||
<span className="text-[var(--project-muted)]">{project.updatedAt}</span>
|
||||
<span className="inline-flex items-center gap-1 text-[11px] font-semibold text-[var(--project-accent)] group-hover:translate-x-0.5 transition-transform">
|
||||
Mở tổng quan →
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -31,25 +31,13 @@ export const ProjectFilters: React.FC<ProjectFiltersProps> = ({
|
|||
<div className="flex flex-wrap items-center gap-3">
|
||||
{/* Search Input */}
|
||||
<div className="relative w-full sm:w-80">
|
||||
<svg
|
||||
className="pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
strokeWidth={2}
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M21 21l-4.35-4.35m0 0A7.5 7.5 0 104.5 4.5a7.5 7.5 0 0012.15 12.15z"
|
||||
/>
|
||||
</svg>
|
||||
<img className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2" src="/assets/projects-ui/search.svg" alt="" />
|
||||
<input
|
||||
type="text"
|
||||
value={searchQuery}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
placeholder="Tìm theo tên dự án..."
|
||||
className="h-10 w-full rounded-xl border border-slate-200 bg-white pl-10 pr-4 text-sm text-slate-800 placeholder:text-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/15"
|
||||
className="h-10 w-full rounded-lg border border-[var(--project-border)] bg-white pl-10 pr-4 text-xs text-[var(--project-heading)] placeholder:text-[var(--project-muted)] focus:border-[var(--project-accent)] focus:outline-none focus:ring-2 focus:ring-[var(--project-accent)]/15"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -58,22 +46,14 @@ export const ProjectFilters: React.FC<ProjectFiltersProps> = ({
|
|||
<select
|
||||
value={selectedTaskType}
|
||||
onChange={(e) => onTaskTypeChange(e.target.value as 'all' | TaskType)}
|
||||
className="h-10 appearance-none rounded-xl border border-slate-200 bg-white pl-3.5 pr-9 text-sm font-medium text-slate-700 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/15"
|
||||
className="h-10 appearance-none rounded-lg border border-[var(--project-border)] bg-white pl-3.5 pr-9 text-xs font-normal text-[var(--project-heading)] focus:border-[var(--project-accent)] focus:outline-none focus:ring-2 focus:ring-[var(--project-accent)]/15"
|
||||
>
|
||||
<option value="all">Tất cả bài toán</option>
|
||||
<option value="classification">Classification</option>
|
||||
<option value="object_detection">Object Detection</option>
|
||||
<option value="segmentation">Segmentation</option>
|
||||
</select>
|
||||
<svg
|
||||
className="pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
strokeWidth={2}
|
||||
>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
<img className="pointer-events-none absolute right-3 top-1/2 h-[13px] w-[13px] -translate-y-1/2" src="/assets/projects-ui/chevron-down.svg" alt="" />
|
||||
</div>
|
||||
|
||||
{/* Status Filter */}
|
||||
|
|
@ -81,22 +61,14 @@ export const ProjectFilters: React.FC<ProjectFiltersProps> = ({
|
|||
<select
|
||||
value={selectedStatus}
|
||||
onChange={(e) => onStatusChange(e.target.value as 'all' | ProjectStatus)}
|
||||
className="h-10 appearance-none rounded-xl border border-slate-200 bg-white pl-3.5 pr-9 text-sm font-medium text-slate-700 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/15"
|
||||
className="h-10 appearance-none rounded-lg border border-[var(--project-border)] bg-white pl-3.5 pr-9 text-xs font-normal text-[var(--project-heading)] focus:border-[var(--project-accent)] focus:outline-none focus:ring-2 focus:ring-[var(--project-accent)]/15"
|
||||
>
|
||||
<option value="all">Tất cả trạng thái</option>
|
||||
<option value="annotating">Đang gán nhãn</option>
|
||||
<option value="pending_review">Chờ duyệt</option>
|
||||
<option value="completed">Hoàn thành</option>
|
||||
</select>
|
||||
<svg
|
||||
className="pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
strokeWidth={2}
|
||||
>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
<img className="pointer-events-none absolute right-3 top-1/2 h-[13px] w-[13px] -translate-y-1/2" src="/assets/projects-ui/chevron-down-2.svg" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -106,38 +78,25 @@ export const ProjectFilters: React.FC<ProjectFiltersProps> = ({
|
|||
<select
|
||||
value={sortBy}
|
||||
onChange={(e) => onSortChange(e.target.value as 'updated' | 'name' | 'progress')}
|
||||
className="appearance-none bg-transparent pr-5 text-xs font-medium text-slate-500 hover:text-slate-800 focus:outline-none cursor-pointer"
|
||||
className="appearance-none bg-transparent pr-5 text-[11px] font-normal text-[var(--project-body)] hover:text-[var(--project-heading)] focus:outline-none cursor-pointer"
|
||||
>
|
||||
<option value="updated">Mới cập nhật</option>
|
||||
<option value="name">Tên dự án (A-Z)</option>
|
||||
<option value="progress">Tiến độ gán nhãn</option>
|
||||
</select>
|
||||
<svg
|
||||
className="pointer-events-none absolute right-0.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
strokeWidth={2}
|
||||
>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
<img className="pointer-events-none absolute right-0.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2" src="/assets/projects-ui/chevron-down.svg" alt="" />
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onViewModeChange(viewMode === 'grid' ? 'list' : 'grid')}
|
||||
title={viewMode === 'grid' ? 'Chuyển sang dạng danh sách' : 'Chuyển sang dạng lưới'}
|
||||
className="flex h-8 w-8 items-center justify-center rounded-lg text-indigo-600 transition hover:bg-indigo-50"
|
||||
className="flex h-8 w-8 items-center justify-center rounded-lg text-[var(--project-accent)] transition hover:bg-[var(--project-accent-soft)]"
|
||||
>
|
||||
{viewMode === 'grid' ? (
|
||||
<svg className="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
||||
<rect x="3" y="3" width="7" height="7" rx="1.5" />
|
||||
<rect x="14" y="3" width="7" height="7" rx="1.5" />
|
||||
<rect x="3" y="14" width="7" height="7" rx="1.5" />
|
||||
<rect x="14" y="14" width="7" height="7" rx="1.5" />
|
||||
</svg>
|
||||
<img className="h-4 w-4" src="/assets/projects-ui/layout-grid-2.svg" alt="" />
|
||||
) : (
|
||||
<svg className="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
||||
<svg className="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} aria-hidden="true">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M4 6h16M4 12h16M4 18h16" />
|
||||
</svg>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ export const ProjectStatsCards: React.FC<ProjectStatsCardsProps> = ({ projects }
|
|||
{cards.map((card) => (
|
||||
<div
|
||||
key={card.label}
|
||||
className="rounded-2xl border border-slate-200/80 bg-white px-5 py-4 shadow-[0_1px_2px_rgba(15,23,42,0.03)]"
|
||||
className="flex flex-col gap-[5px] rounded-[10px] border border-[var(--project-border)] bg-[var(--project-surface)] p-[18px] shadow-none"
|
||||
>
|
||||
<p className="text-xs font-medium text-slate-500">{card.label}</p>
|
||||
<p className="mt-2 text-[28px] font-bold leading-tight tracking-tight text-slate-900">
|
||||
<p className="text-[11px] font-normal text-[var(--project-body)]">{card.label}</p>
|
||||
<p className="text-[28px] font-normal leading-[42px] text-[var(--project-heading)]">
|
||||
{card.value}
|
||||
</p>
|
||||
<p className="mt-2 text-xs text-slate-500">{card.subtext}</p>
|
||||
<p className="text-[10px] leading-[15px] text-[var(--project-body)]">{card.subtext}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
import { Project, ImageItem, ActivityLog, CreateProjectInput, LabelClass, ProjectMemberSummary } from '@/types'
|
||||
|
||||
// SVG Data URLs for realistic street/vehicle thumbnails matching the wireframes
|
||||
export const THUMBNAIL_CAR_SEDAN =
|
||||
'https://images.unsplash.com/photo-1549399542-7e3f8b79c341?auto=format&fit=crop&w=900&q=80'
|
||||
|
||||
export const THUMBNAIL_TRAFFIC_STREET =
|
||||
'https://images.unsplash.com/photo-1519003722824-194d4455a60c?auto=format&fit=crop&w=900&q=80'
|
||||
|
||||
export const THUMBNAIL_STREET_SEGMENTATION =
|
||||
'https://images.unsplash.com/photo-1506521781263-d8422e82f27a?auto=format&fit=crop&w=900&q=80'
|
||||
// Card thumbnails from the Figma project management screen.
|
||||
export const THUMBNAIL_CAR_SEDAN = '/assets/projects/classification.jpg'
|
||||
export const THUMBNAIL_TRAFFIC_STREET = '/assets/projects/object-detection.jpg'
|
||||
export const THUMBNAIL_STREET_SEGMENTATION = '/assets/projects/segmentation.jpg'
|
||||
|
||||
export const INITIAL_PROJECTS: Project[] = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,17 +4,72 @@
|
|||
|
||||
@layer base {
|
||||
:root {
|
||||
--brand-primary: #c95c3c;
|
||||
/* Danable project dashboard palette. Keep names tied to UI roles. */
|
||||
--color-brand-orange-red: #c75c4a;
|
||||
--brand-primary: #c75c4a;
|
||||
--brand-primary-hover: #b5492b;
|
||||
--project-accent: #5451d6;
|
||||
--project-accent-soft: #f1f3fe;
|
||||
--project-canvas: #f5f6fa;
|
||||
--project-surface: #ffffff;
|
||||
--project-heading: #172033;
|
||||
--project-body: #697386;
|
||||
--project-muted: #939bad;
|
||||
--project-border: #e4e7ef;
|
||||
--project-status-active-bg: #f5ded6;
|
||||
--project-status-active-text: #5451d6;
|
||||
--project-status-review-bg: #fff5df;
|
||||
--project-status-review-text: #b57916;
|
||||
--project-status-complete-bg: #e4f5ed;
|
||||
--project-status-complete-text: #168262;
|
||||
--project-status-draft-bg: #eef0f4;
|
||||
--project-status-draft-text: #697386;
|
||||
--project-status-review-dot: #b57916;
|
||||
--project-label-car: #16b9c9;
|
||||
--project-label-bus: #ae7cff;
|
||||
--project-label-motorbike: #10b981;
|
||||
--project-label-truck: #3b82f6;
|
||||
--project-avatar-background: #f5ded6;
|
||||
|
||||
/* Màu chữ (Typography) */
|
||||
--color-text-heading-left: #141c2a;
|
||||
--color-text-heading-right: #172033;
|
||||
--color-text-secondary: #697386;
|
||||
--color-text-muted: #939bad;
|
||||
--color-text-accent: #5451d6;
|
||||
|
||||
/* Màu nền & đường viền (Surfaces & Borders) */
|
||||
--color-surface-card: #f8f9fa;
|
||||
--color-border-card: #3b465e;
|
||||
--color-border-input: #e4e7ef;
|
||||
|
||||
/* Màu nhãn Bounding Box minh họa (Annotation Labels) */
|
||||
--color-label-car: #16b9c9;
|
||||
--color-label-bus: #ae7cff;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
background-color: #f8fafc;
|
||||
background-color: var(--project-canvas);
|
||||
color: #0f172a;
|
||||
}
|
||||
}
|
||||
|
||||
.project-list-main {
|
||||
scrollbar-width: none;
|
||||
overflow-y: visible;
|
||||
}
|
||||
|
||||
.project-list-main::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.project-list-main {
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom thin scrollbars */
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
|
|
@ -33,4 +88,3 @@
|
|||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #94a3b8;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue