feat: publish danable frontend updates

This commit is contained in:
quanganh2k4 2026-10-31 18:09:52 +07:00
parent 9ed811369d
commit 60dd253565
43 changed files with 920 additions and 714 deletions

View file

@ -1,4 +1,4 @@
import React, { Component, ErrorInfo, ReactNode } from 'react'
import { Component, ErrorInfo, ReactNode } from 'react'
import { Button } from '../ui/Button'
export interface ErrorBoundaryProps {

View file

@ -1,67 +1,10 @@
import React from 'react'
import { Outlet, Link } from 'react-router-dom'
import { showToast } from '../components/feedback/Toast'
import { Outlet } from 'react-router-dom'
export const AuthLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
return (
<div className="min-h-screen bg-[#FAF9F6] flex flex-col justify-between text-slate-900">
{/* Top Bar */}
<header className="w-full px-6 sm:px-10 py-5 flex items-center justify-between border-b border-slate-200/60 bg-white/80 backdrop-blur-sm">
<Link to="/login" className="flex items-center gap-3">
<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
strokeLinecap="round"
strokeLinejoin="round"
d="M4 8V6a2 2 0 012-2h2M4 16v2a2 2 0 002 2h2m8-16h2a2 2 0 012 2v2m-4 12h2a2 2 0 002-2v-2"
/>
</svg>
</div>
<span className="text-xl font-bold tracking-tight text-slate-900">
danable
</span>
<span className="hidden sm:inline-block rounded-full border border-slate-200 bg-slate-50 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-slate-500">
NỀN TẢNG DỮ LIỆU CHO AI
</span>
</Link>
<div className="text-xs text-slate-500">
Chưa có tài khoản?{' '}
<button
type="button"
onClick={() =>
showToast.info('Vui lòng liên hệ admin@danable.vn để được cấp tài khoản')
}
className="font-semibold text-[#C95C3C] hover:underline"
>
Liên hệ quản trị viên ↗
</button>
</div>
</header>
{/* Main Content */}
<main className="flex-1 flex items-center justify-center p-4 sm:p-8">
{children || <Outlet />}
</main>
{/* Footer */}
<footer className="w-full px-6 sm:px-10 py-4 border-t border-slate-200/60 bg-white/60 flex flex-col sm:flex-row items-center justify-between gap-2 text-xs text-slate-400">
<div>© 2026 danable · Hệ thống gán nhãn dữ liệu thị giác máy tính</div>
<div className="flex items-center gap-4">
<span className="inline-flex items-center gap-1.5 text-slate-500">
<span className="h-1.5 w-1.5 rounded-full bg-emerald-500" />
Máy chủ ổn định (v2.4.0)
</span>
<span>Bảo mật</span>
<span>Điều khoản</span>
</div>
</footer>
<div className="min-h-screen w-full bg-white text-[#141c2a]">
{children || <Outlet />}
</div>
)
}

View file

@ -7,15 +7,16 @@ export const DashboardLayout: React.FC<{ children?: React.ReactNode }> = ({
children,
}) => {
const { pathname } = useLocation()
const isProjectList = pathname === '/projects'
const isProjectWorkspaceScreen =
pathname === '/projects' || /^\/projects\/[^/]+$/.test(pathname)
return (
<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 text-slate-900 ${isProjectWorkspaceScreen ? 'h-screen min-h-0 overflow-hidden bg-[var(--project-canvas)]' : 'min-h-screen bg-[#F8FAFC]'}`}>
<Sidebar isProjectWorkspace={isProjectWorkspaceScreen} />
<div className="flex-1 flex flex-col min-w-0">
<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>
<Header isProjectWorkspace={isProjectWorkspaceScreen} />
<main className={`flex-1 overflow-y-auto ${isProjectWorkspaceScreen ? 'project-workspace-main h-[calc(100vh-64px)] min-h-0 p-6' : 'p-6 lg:p-8'}`}>
<div className={isProjectWorkspaceScreen ? 'w-full' : 'mx-auto max-w-7xl'}>{children || <Outlet />}</div>
</main>
</div>
</div>

View file

@ -6,17 +6,17 @@ import { UserMenu } from './UserMenu'
export interface HeaderProps {
breadcrumbItems?: BreadcrumbItem[]
isProjectList?: boolean
isProjectWorkspace?: boolean
}
export const Header: React.FC<HeaderProps> = ({ breadcrumbItems, isProjectList = false }) => {
export const Header: React.FC<HeaderProps> = ({ breadcrumbItems, isProjectWorkspace = false }) => {
return (
<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'}`}>
<header className={`shrink-0 bg-white px-6 flex items-center justify-between sticky top-0 z-20 ${isProjectWorkspace ? '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 ${isProjectList ? 'gap-5' : 'gap-4'}`}>
<SystemStatus isProjectList={isProjectList} />
<NotificationBell isProjectList={isProjectList} />
<UserMenu isProjectList={isProjectList} />
<div className={`flex items-center ${isProjectWorkspace ? 'gap-5' : 'gap-4'}`}>
<SystemStatus isProjectWorkspace={isProjectWorkspace} />
<NotificationBell isProjectWorkspace={isProjectWorkspace} />
<UserMenu isProjectWorkspace={isProjectWorkspace} />
</div>
</header>
)

View file

@ -28,7 +28,7 @@ const MOCK_NOTIFICATIONS: NotificationItem[] = [
},
]
export const NotificationBell: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const NotificationBell: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = 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<{ isProjectList?: boolean }> = ({ isProj
<button
type="button"
onClick={() => setOpen((prev) => !prev)}
className={`relative rounded-full transition-colors ${isProjectList ? 'p-0 text-[#697386]' : 'p-2 text-slate-500 hover:bg-slate-100 hover:text-slate-800'}`}
className={`relative rounded-full transition-colors ${isProjectWorkspace ? 'p-0 text-[#697386]' : 'p-2 text-slate-500 hover:bg-slate-100 hover:text-slate-800'}`}
aria-label="Thông báo"
>
{isProjectList ? <img className="h-[18px] w-[18px]" src="/assets/projects-ui/bell.svg" alt="" /> : <svg
{isProjectWorkspace ? <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"
@ -70,7 +70,7 @@ export const NotificationBell: React.FC<{ isProjectList?: boolean }> = ({ isProj
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>}
{!isProjectList && unreadCount > 0 && (
{!isProjectWorkspace && unreadCount > 0 && (
<span className="absolute top-1.5 right-1.5 h-2 w-2 rounded-full bg-[#C95C3C] ring-2 ring-white" />
)}
</button>

View file

@ -1,9 +1,9 @@
import React from 'react'
export const SystemStatus: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const SystemStatus: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
return (
<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'}`} />
<div className={`hidden items-center text-slate-600 sm:flex ${isProjectWorkspace ? 'gap-2 text-[10px] text-[#697386]' : 'gap-2 text-xs'}`}>
<span className={`rounded-full bg-[#168262] ${isProjectWorkspace ? 'h-1.5 w-1.5' : 'h-2 w-2 bg-emerald-600'}`} />
<span>Hệ thống ổn định</span>
</div>
)

View file

@ -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<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const UserMenu: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
const navigate = useNavigate()
return (
<Dropdown
align="right"
trigger={
<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'}`}>
<div className={`flex h-[30px] w-[30px] items-center justify-center rounded-full text-[11px] font-semibold text-[var(--project-accent)] transition-all ${isProjectWorkspace ? 'bg-[var(--project-avatar-background)]' : 'bg-orange-100 text-slate-800 hover:ring-2 hover:ring-orange-200'}`}>
MA
</div>
}

View file

@ -3,7 +3,7 @@ import { Link, useLocation } from 'react-router-dom'
import clsx from 'clsx'
import { getProjects, subscribeProjectsStore } from '@/pages/projects/projectData'
export const RecentProjects: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const RecentProjects: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
const location = useLocation()
const [recentProjects, setRecentProjects] = useState(() => getProjects().slice(0, 3))
@ -11,13 +11,12 @@ export const RecentProjects: React.FC<{ isProjectList?: boolean }> = ({ isProjec
return (
<div>
<div className={`px-2 mb-2 text-[9px] font-semibold text-slate-500 ${isProjectList ? 'tracking-normal text-[#332926]' : 'uppercase tracking-wider'}`}>
<div className={`px-2 mb-2 text-[9px] font-semibold text-slate-500 ${isProjectWorkspace ? 'tracking-normal text-[#332926]' : 'uppercase tracking-wider'}`}>
DỰ ÁN GẦN ĐÂY
</div>
<div className="space-y-0.5">
{recentProjects.map((project) => {
const projectPath = `/projects/${project.id}`
const dotColors = ['bg-[#a29fff]', 'bg-[#a29fff]', 'bg-[#a29fff]']
const isCurrent = location.pathname.startsWith(projectPath)
return (
<Link
@ -25,15 +24,17 @@ export const RecentProjects: React.FC<{ isProjectList?: boolean }> = ({ isProjec
to={projectPath}
className={clsx(
'flex items-center transition-colors',
isProjectList
? 'gap-2 px-2.5 py-0.5 text-[11px] font-normal leading-[17px] text-[#332926]'
isProjectWorkspace
? 'gap-2 px-2.5 py-0.5 text-[11px] font-normal leading-[17px] text-[var(--project-heading)]'
: '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'
isProjectWorkspace
? 'text-[var(--project-heading)]'
: isCurrent
? 'bg-slate-100 text-slate-900 font-semibold'
: 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'
)}
>
<span className={`h-[5px] w-[5px] shrink-0 rounded-full ${isProjectList ? 'bg-[#a29fff]' : 'bg-indigo-500'}`} />
<span className={`h-[5px] w-[5px] shrink-0 rounded-full ${isProjectWorkspace ? 'bg-[var(--project-accent-dot)]' : 'bg-indigo-500'}`} />
<span className="truncate">{project.name}</span>
</Link>
)

View file

@ -6,13 +6,13 @@ import { RecentProjects } from './RecentProjects'
import { StorageUsage } from './StorageUsage'
import { UserInfo } from './UserInfo'
export const Sidebar: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const Sidebar: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
return (
<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'}>
<aside className={`shrink-0 bg-white flex flex-col justify-between h-screen sticky top-0 select-none ${isProjectWorkspace ? 'w-[216px] px-4 pt-7 pb-5' : 'w-[240px] border-r border-slate-200/80 px-3.5 py-4'}`}>
<div className={isProjectWorkspace ? 'space-y-7' : 'space-y-5'}>
{/* Brand Logo */}
<Link to="/projects" className="flex items-center gap-2.5 px-1">
{isProjectList ? (
{isProjectWorkspace ? (
<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">
@ -25,24 +25,24 @@ export const Sidebar: React.FC<{ isProjectList?: boolean }> = ({ isProjectList =
</svg>
</div>
)}
<span className={isProjectList ? 'text-[25px] font-bold tracking-[-1px] text-[#332926]' : 'text-xl font-bold tracking-tight text-slate-900'}>
<span className={isProjectWorkspace ? 'text-[25px] font-bold tracking-[-1px] text-[#332926]' : 'text-xl font-bold tracking-tight text-slate-900'}>
danable
</span>
</Link>
{/* Workspace Selector */}
<WorkspaceSelector isProjectList={isProjectList} />
<WorkspaceSelector isProjectWorkspace={isProjectWorkspace} />
{/* Navigation Links */}
<SidebarNav isProjectList={isProjectList} />
<SidebarNav isProjectWorkspace={isProjectWorkspace} />
{/* Recent Projects */}
<RecentProjects isProjectList={isProjectList} />
<RecentProjects isProjectWorkspace={isProjectWorkspace} />
</div>
<div className={isProjectList ? 'space-y-2.5' : 'space-y-4 pt-4'}>
<StorageUsage isProjectList={isProjectList} />
<UserInfo isProjectList={isProjectList} />
<div className={isProjectWorkspace ? 'space-y-2.5' : 'space-y-4 pt-4'}>
<StorageUsage isProjectWorkspace={isProjectWorkspace} />
<UserInfo isProjectWorkspace={isProjectWorkspace} />
</div>
</aside>
)

View file

@ -10,7 +10,7 @@ interface NavItem {
matchPrefix: string
}
export const SidebarNav: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const SidebarNav: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
const location = useLocation()
const navItems: NavItem[] = [
@ -32,7 +32,7 @@ export const SidebarNav: React.FC<{ isProjectList?: boolean }> = ({ isProjectLis
return (
<div>
<div className={`px-2 mb-2 text-[9px] font-semibold text-slate-500 ${isProjectList ? 'tracking-normal text-[#332926]' : 'uppercase tracking-wider'}`}>
<div className={`px-2 mb-2 text-[9px] font-semibold text-slate-500 ${isProjectWorkspace ? 'tracking-normal text-[#332926]' : 'uppercase tracking-wider'}`}>
KHÔNG GIAN LÀM VIỆC
</div>
<nav className="space-y-1">
@ -47,9 +47,9 @@ export const SidebarNav: React.FC<{ isProjectList?: boolean }> = ({ isProjectLis
key={item.to}
to={item.to}
className={clsx(
`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`,
`flex items-center justify-between transition-colors ${isProjectWorkspace ? 'h-[42px] rounded-[7px] px-3 text-[13px]' : 'rounded-xl px-3 py-2.5 text-sm'} font-medium`,
isActive
? (isProjectList ? 'bg-[#c75c4a] text-white' : 'bg-[#C95C3C] text-white shadow-sm')
? (isProjectWorkspace ? 'bg-[var(--brand-primary)] text-white' : 'bg-[#C95C3C] text-white shadow-sm')
: 'text-slate-700 hover:bg-slate-100'
)}
>

View file

@ -1,19 +1,19 @@
import React from 'react'
export const StorageUsage: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const StorageUsage: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
return (
<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'}`}>
<div className={`rounded-[8px] p-3 ${isProjectWorkspace ? '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 ${isProjectWorkspace ? '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 w-full overflow-hidden rounded-full bg-[#e5e8ed]">
<div
className={`h-full rounded-full ${isProjectList ? 'bg-[#8a87f4]' : 'bg-[#3B5BDB]'}`}
className={`h-full rounded-full ${isProjectWorkspace ? 'bg-[#8a87f4]' : 'bg-[#3B5BDB]'}`}
style={{ width: '24%' }}
/>
</div>
<div className={`mt-2 text-slate-500 ${isProjectList ? 'text-[9px] text-[#332926]' : 'text-[11px]'}`}>
<div className={`mt-2 text-slate-500 ${isProjectWorkspace ? 'text-[9px] text-[#332926]' : 'text-[11px]'}`}>
12 GB / 50 GB đã sử dụng
</div>
</div>

View file

@ -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<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const UserInfo: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
const navigate = useNavigate()
const handleLogout = () => {
@ -15,10 +15,10 @@ export const UserInfo: React.FC<{ isProjectList?: boolean }> = ({ isProjectList
<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 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'}`}
className={`flex w-full items-center gap-2 text-xs font-medium text-slate-600 transition-colors hover:text-slate-900 ${isProjectWorkspace ? 'px-2.5 py-2 text-[11px]' : 'px-2 py-1.5'}`}
>
{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'}`}
{isProjectWorkspace ? <img className="h-4 w-4" src="/assets/projects-ui/circle-help.svg" alt="" /> : <svg
className={`h-4 w-4 ${isProjectWorkspace ? 'text-[#697386]' : 'text-slate-400'}`}
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
@ -33,21 +33,21 @@ export const UserInfo: React.FC<{ isProjectList?: boolean }> = ({ isProjectList
<span>Tài liệu & hỗ trợ</span>
</button>
<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 justify-between ${isProjectWorkspace ? '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 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'}`}>
<div className={`flex shrink-0 items-center justify-center rounded-full font-semibold ${isProjectWorkspace ? '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 font-semibold ${isProjectList ? 'text-[12px] text-[#332926]' : 'text-xs text-slate-900'}`}>
<div className={`truncate font-semibold ${isProjectWorkspace ? 'text-[12px] text-[#332926]' : 'text-xs text-slate-900'}`}>
Minh Anh
</div>
<div className={`truncate ${isProjectList ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
<div className={`truncate ${isProjectWorkspace ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
Quản trị viên
</div>
</div>
</div>
{!isProjectList && <button
{!isProjectWorkspace && <button
type="button"
onClick={handleLogout}
title="Đăng xuất"

View file

@ -1,7 +1,7 @@
import React, { useState } from 'react'
import { showToast } from '../../../components/feedback/Toast'
export const WorkspaceSelector: React.FC<{ isProjectList?: boolean }> = ({ isProjectList = false }) => {
export const WorkspaceSelector: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
const [open, setOpen] = useState(false)
return (
@ -9,22 +9,22 @@ export const WorkspaceSelector: React.FC<{ isProjectList?: boolean }> = ({ isPro
<button
type="button"
onClick={() => setOpen((prev) => !prev)}
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'}`}
className={`w-full flex items-center justify-between bg-white text-left transition-colors ${isProjectWorkspace ? '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 text-[11px] font-semibold text-[#332926] ${isProjectList ? 'h-7 w-7 rounded-[6px] bg-[#d6dae6]' : 'rounded-full bg-indigo-50 text-slate-700'}`}>
<div className={`flex h-8 w-8 shrink-0 items-center justify-center text-[11px] font-semibold text-[#332926] ${isProjectWorkspace ? '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 font-semibold leading-tight ${isProjectList ? 'text-[13px] text-[#332926]' : 'text-sm text-slate-900'}`}>
<div className={`truncate font-semibold leading-tight ${isProjectWorkspace ? 'text-[13px] text-[#332926]' : 'text-sm text-slate-900'}`}>
danable
</div>
<div className={`truncate mt-0.5 ${isProjectList ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
<div className={`truncate mt-0.5 ${isProjectWorkspace ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
Không gian nhóm
</div>
</div>
</div>
{isProjectList ? (
{isProjectWorkspace ? (
<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}>

View file

@ -172,23 +172,6 @@ function createTrafficBoulevardSvg(variant = 1): string {
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`
}
function createTruckStreetSvg(): string {
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 1080" width="1920" height="1080">
<rect width="1920" height="500" fill="#CBD5E1"/>
<circle cx="320" cy="260" r="210" fill="#1E4620"/>
<circle cx="1520" cy="250" r="220" fill="#2D5A27"/>
<rect y="500" width="1920" height="580" fill="#64748B"/>
<!-- Blue Cargo Truck -->
<rect x="520" y="320" width="540" height="360" rx="12" fill="#1D4ED8" stroke="#1E3A8A" stroke-width="4"/>
<rect x="1060" y="410" width="240" height="270" rx="16" fill="#2563EB"/>
<rect x="1140" y="435" width="140" height="95" rx="8" fill="#1E293B"/>
<circle cx="670" cy="700" r="64" fill="#0F172A"/>
<circle cx="960" cy="700" r="64" fill="#0F172A"/>
<circle cx="1200" cy="700" r="64" fill="#0F172A"/>
</svg>`
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`
}
export const DEFAULT_CLASSES: LabelClass[] = [
{ id: 'cls-car', name: 'Ô tô', color: '#06B6D4', count: 1, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: '#F59E0B', count: 2, shortcutKey: '2' },

View file

@ -1,5 +1,5 @@
import React, { useRef, useState } from 'react'
import { AnnotationShape, BoundingBox, Point2D } from '@/types'
import { BoundingBox, Point2D } from '@/types'
import { normalizeBBox } from '@/utils/canvas'
import { useAnnotatorStore } from '../../annotatorStore'
import { ImageViewer } from './ImageViewer'

View file

@ -1,9 +1,16 @@
import React, { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { LoginRequest } from '../../types'
import { LoginRequest } from '@/types'
import { LOGIN_COLORS } from '@/styles/theme'
import { HeroSection } from './components/HeroSection'
import { LoginForm } from './components/LoginForm'
const FOOTER_LINKS = [
'Điều khoản sử dụng',
'Chính sách bảo mật',
'Tiếng Việt ⌄',
]
export const LoginPage: React.FC = () => {
const navigate = useNavigate()
const [isLoading, setIsLoading] = useState(false)
@ -26,108 +33,81 @@ export const LoginPage: React.FC = () => {
}
return (
<div className="min-h-screen bg-white text-slate-900 flex flex-col justify-between">
{/* Top Navigation Bar matching wireframe */}
<header className="w-full max-w-[1360px] mx-auto px-6 sm:px-12 pt-7 pb-4 flex items-center justify-between">
<div className="flex items-center gap-16">
{/* Brand Logo */}
<div className="flex items-center gap-2.5">
<div className="w-8 h-8 rounded-lg bg-[#C95C3C] flex items-center justify-center text-white shadow-sm">
<svg
className="w-4 h-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2.2"
strokeLinecap="round"
strokeLinejoin="round"
<div
className="min-h-screen w-full flex justify-center items-start overflow-x-hidden"
style={{ backgroundColor: LOGIN_COLORS.bgWhite }}
>
{/* Khung thiết kế chuẩn 1440x900 từ Figma (chia 2 cột: 660px trái + 780px phải) */}
<div
className="w-full max-w-[1440px] min-h-[900px] flex flex-col lg:flex-row items-start overflow-hidden"
style={{ backgroundColor: LOGIN_COLORS.bgWhite }}
>
{/* Cột trái (660px): Giới thiệu nền tảng & Thẻ minh họa gán nhãn */}
<HeroSection />
{/* Cột phải (780px): Khu vực Đăng nhập */}
<div className="shrink-0 w-full lg:w-[780px] min-h-[900px] flex flex-col justify-between items-center pt-[42px] pr-16 pb-8 pl-16 overflow-hidden">
{/* Liên kết hỗ trợ cấp tài khoản góc trên bên phải */}
<div className="shrink-0 self-stretch flex justify-end items-start gap-1.5 overflow-hidden">
<p
className="shrink-0 font-sans text-[12px] font-normal leading-[18px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textSecondary }}
>
Chưa có tài khoản?
</p>
<button
type="button"
onClick={() => setContactModalOpen(true)}
className="shrink-0 font-sans text-[12px] font-semibold leading-[18px] whitespace-nowrap hover:underline"
style={{ color: LOGIN_COLORS.brandAccentIndigo }}
>
Liên hệ quản trị viên ↗
</button>
</div>
{/* Biểu mẫu đăng nhập trung tâm */}
<LoginForm
onSubmit={handleLogin}
onSSOLogin={handleSSOLogin}
isLoading={isLoading}
/>
{/* Liên kết điều khoản & ngôn ngữ cuối trang */}
<div className="shrink-0 flex items-start gap-[22px] overflow-hidden">
{FOOTER_LINKS.map((item) => (
<button
key={item}
type="button"
className="shrink-0 font-sans text-[10px] font-normal leading-[15px] whitespace-nowrap hover:underline"
style={{ color: LOGIN_COLORS.textSecondary }}
>
<path d="M4 8V6a2 2 0 0 1 2-2h2" />
<path d="M4 16v2a2 2 0 0 0 2 2h2" />
<path d="M16 4h2a2 2 0 0 1 2 2v2" />
<path d="M16 20h2a2 2 0 0 0 2-2v-2" />
</svg>
</div>
<span className="text-xl font-bold tracking-tight text-slate-900">
danable
</span>
</div>
<span className="hidden md:inline-block text-[10px] font-semibold uppercase tracking-[0.14em] text-slate-500">
NỀN TẢNG DỮ LIỆU CHO AI
</span>
</div>
<div className="text-xs text-slate-500">
<span>Chưa có tài khoản? </span>
<button
type="button"
onClick={() => setContactModalOpen(true)}
className="font-semibold text-indigo-600 hover:text-indigo-700 inline-flex items-center gap-0.5"
>
<span>Liên hệ quản trị viên</span>
<span aria-hidden="true">↗</span>
</button>
</div>
</header>
{/* Main 2-Column Content */}
<main className="w-full max-w-[1360px] mx-auto px-6 sm:px-12 py-6 flex-1 flex items-center">
<div className="w-full grid grid-cols-1 lg:grid-cols-12 gap-12 lg:gap-8 items-center">
{/* Left Column: HeroSection */}
<div className="lg:col-span-6">
<HeroSection />
</div>
{/* Right Column: LoginForm */}
<div className="lg:col-span-6 flex flex-col items-center">
<LoginForm
onSubmit={handleLogin}
onSSOLogin={handleSSOLogin}
isLoading={isLoading}
/>
{item}
</button>
))}
</div>
</div>
</main>
</div>
{/* Bottom Footer Links */}
<footer className="w-full max-w-[1360px] mx-auto px-6 sm:px-12 py-6 flex flex-col sm:flex-row items-center justify-end gap-6 text-xs text-slate-500">
<div className="flex items-center gap-6 lg:w-1/2 justify-center">
<a
href="#terms"
onClick={(e) => e.preventDefault()}
className="hover:text-slate-800 transition-colors"
>
Điều khoản sử dụng
</a>
<a
href="#privacy"
onClick={(e) => e.preventDefault()}
className="hover:text-slate-800 transition-colors"
>
Chính sách bảo mật
</a>
<button
type="button"
className="inline-flex items-center gap-1 hover:text-slate-800 transition-colors"
>
<span>Tiếng Việt</span>
<span className="text-[10px]">∨</span>
</button>
</div>
</footer>
{/* Contact Admin Info Modal */}
{/* Hộp thoại thông tin khi bấm "Liên hệ quản trị viên" */}
{contactModalOpen && (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 backdrop-blur-[1px] p-4">
<div className="bg-white rounded-2xl max-w-md w-full p-6 shadow-xl border border-slate-200">
<h3 className="text-lg font-bold text-slate-900 mb-2">
<h3
className="text-lg font-bold mb-2"
style={{ color: LOGIN_COLORS.textRightPrimary }}
>
Liên hệ quản trị viên không gian nhóm
</h3>
<p className="text-sm text-slate-600 leading-relaxed mb-4">
<p
className="text-sm leading-relaxed mb-4"
style={{ color: LOGIN_COLORS.textSecondary }}
>
danable hoạt động theo mô hình lời mời nội bộ để đảm bảo an toàn
dữ liệu. Vui lòng liên hệ Quản trị viên nhóm của bạn (ví dụ:{' '}
<span className="font-medium text-slate-900">
<span
className="font-medium"
style={{ color: LOGIN_COLORS.textRightPrimary }}
>
minhanh@visionlab.vn
</span>
) để nhận email lời mời tham gia dự án.
@ -136,7 +116,8 @@ export const LoginPage: React.FC = () => {
<button
type="button"
onClick={() => setContactModalOpen(false)}
className="px-4 py-2 rounded-xl bg-[#C95C3C] text-white text-sm font-medium hover:bg-[#B5492B] transition-colors"
className="px-4 py-2 rounded-lg text-white text-sm font-medium transition-opacity hover:opacity-95"
style={{ backgroundColor: LOGIN_COLORS.brandOrangeRed }}
>
Đã hiểu
</button>

View file

@ -1,149 +1,196 @@
import React, { useState } from 'react'
import React from 'react'
import { LOGIN_COLORS, createInsetOutlineStyle } from '@/styles/theme'
interface BoundingBoxItem {
id: string
label: string
color: string
position: {
left: number
top: number
width: number
height: number
}
badgeWidth: number
}
/**
* Danh sách các khung nhận diện vật thể (Bounding Box) hiển thị trên ảnh minh họa.
* Tách cấu hình tọa độ và màu sắc rõ ràng thay vì gán cứng trong JSX.
*/
const TRAFFIC_BOUNDING_BOXES: BoundingBoxItem[] = [
{
id: 'car',
label: 'Ô tô',
color: LOGIN_COLORS.boundingBox.carCyan, // #16b9c9
position: { left: 248, top: 157, width: 74, height: 65 },
badgeWidth: 33,
},
{
id: 'bus',
label: 'Xe buýt',
color: LOGIN_COLORS.boundingBox.busPurple, // #ae7cff
position: { left: 155, top: 96, width: 106, height: 87 },
badgeWidth: 49,
},
]
const PREVIEW_STATS = [
{
value: '4.320',
description: 'ảnh trong không gian nhóm',
},
{
value: 'Bạn quyết định',
description: 'duyệt nhãn trước khi xuất',
},
]
const AI_TASK_TYPES = ['Classification', 'Object Detection', 'Segmentation']
/**
* Hàm tạo style cho khung Bounding Box và nhãn tên đối tượng theo màu định nghĩa.
*/
function getBoundingBoxStyles(box: BoundingBoxItem): {
frameStyle: React.CSSProperties
badgeStyle: React.CSSProperties
} {
return {
frameStyle: {
left: `${box.position.left}px`,
top: `${box.position.top}px`,
width: `${box.position.width}px`,
height: `${box.position.height}px`,
...createInsetOutlineStyle(box.color, 2),
},
badgeStyle: {
width: `${box.badgeWidth}px`,
backgroundColor: box.color,
},
}
}
export const HeroSection: React.FC = () => {
const [hoveredBox, setHoveredBox] = useState<'bus' | 'car' | null>(null)
const [activeTask, setActiveTask] = useState<string>('Object Detection')
return (
<div className="flex flex-col justify-between h-full max-w-[540px]">
<div>
<p className="text-[11px] font-semibold uppercase tracking-[0.12em] text-slate-600 mb-3">
<div
className="shrink-0 w-full lg:w-[660px] lg:min-h-[900px] flex flex-col items-start gap-[30px] pt-10 pr-14 pb-8 pl-14 overflow-hidden"
style={{
backgroundColor: LOGIN_COLORS.bgWhite,
color: LOGIN_COLORS.textLeftPrimary,
}}
>
{/* Thanh thương hiệu phía trên */}
<div className="shrink-0 self-stretch flex justify-between items-center overflow-hidden">
<div className="shrink-0 flex items-center gap-2.5 overflow-hidden">
<img
className="shrink-0 w-8 h-8"
src="/assets/bi-u-tr-ng.svg"
alt="Biểu trưng danable"
/>
<p className="shrink-0 font-sans text-[25px] font-bold tracking-[-1px] whitespace-nowrap">
danable
</p>
</div>
<p className="shrink-0 font-mono text-[9px] font-normal leading-[14px] whitespace-nowrap">
NỀN TẢNG DỮ LIỆU CHO AI
</p>
</div>
{/* Tiêu đề & thông điệp chính */}
<div className="shrink-0 self-stretch flex flex-col items-start gap-4 pt-[30px] overflow-hidden">
<p className="shrink-0 font-sans text-[10px] font-semibold tracking-[1px] whitespace-nowrap">
TỪ DỮ LIỆU THÔ ĐẾN NHÃN CHẤT LƯỢNG
</p>
<h1 className="text-4xl sm:text-[42px] font-bold tracking-tight text-slate-900 leading-[1.15] mb-3.5">
<h1 className="shrink-0 self-stretch font-sans text-[42px] font-semibold leading-[50px] tracking-[-1px]">
Giải pháp dữ liệu cho AI
</h1>
<p className="text-[15px] text-slate-600 leading-relaxed mb-7">
<p className="shrink-0 self-stretch font-sans text-[14px] font-normal leading-[21px]">
Kiểm soát chất lượng mô hình AI của bạn từ những bước bắt đầu.
</p>
</div>
{/* Interactive Preview Card */}
<div className="rounded-2xl border border-slate-300 bg-white shadow-sm overflow-hidden transition-shadow hover:shadow-md">
{/* Card Top Bar */}
<div className="flex items-center justify-between px-4 py-3 border-b border-slate-200 bg-white">
<span className="text-xs font-medium text-slate-700">
Giao thông đô thị
</span>
<span className="inline-flex items-center gap-1.5 text-xs font-medium text-slate-600">
<span className="h-1.5 w-1.5 rounded-full bg-emerald-500" />
Đã duyệt thủ công
</span>
</div>
{/* Street Traffic Image + Bounding Box Overlays */}
<div className="relative h-[265px] sm:h-[285px] w-full overflow-hidden bg-slate-900 select-none">
<img
src="https://images.unsplash.com/photo-1519003722824-194d4455a60c?auto=format&fit=crop&w=1080&q=85"
alt="Giao thông đô thị Việt Nam"
className="w-full h-full object-cover object-center brightness-95"
/>
{/* Subtle road scene gradient for crisp bounding box contrast */}
<div className="absolute inset-0 bg-gradient-to-t from-black/25 via-transparent to-black/10 pointer-events-none" />
{/* Purple Bounding Box: Xe buýt */}
<div
onMouseEnter={() => setHoveredBox('bus')}
onMouseLeave={() => setHoveredBox(null)}
style={{
left: '28%',
top: '35%',
width: '20%',
height: '31%',
}}
className={`absolute border-2 transition-all duration-150 cursor-pointer ${
hoveredBox === 'bus'
? 'border-[#A855F7] bg-[#A855F7]/20 shadow-[0_0_0_2px_rgba(168,85,247,0.3)]'
: 'border-[#C084FC] bg-[#A855F7]/10'
}`}
>
<span className="absolute -top-6 left-[-2px] inline-flex items-center px-2 py-0.5 rounded-t-md rounded-br-md bg-[#C084FC] text-slate-950 text-[11px] font-bold shadow-sm whitespace-nowrap">
Xe buýt
</span>
{/* Corner handles */}
<span className="absolute -top-1 -left-1 w-2 h-2 bg-white border border-[#A855F7] rounded-full" />
<span className="absolute -top-1 -right-1 w-2 h-2 bg-white border border-[#A855F7] rounded-full" />
<span className="absolute -bottom-1 -left-1 w-2 h-2 bg-white border border-[#A855F7] rounded-full" />
<span className="absolute -bottom-1 -right-1 w-2 h-2 bg-white border border-[#A855F7] rounded-full" />
</div>
{/* Cyan Bounding Box: Ô tô */}
<div
onMouseEnter={() => setHoveredBox('car')}
onMouseLeave={() => setHoveredBox(null)}
style={{
left: '45.5%',
top: '57%',
width: '13.5%',
height: '24%',
}}
className={`absolute border-2 transition-all duration-150 cursor-pointer ${
hoveredBox === 'car'
? 'border-[#06B6D4] bg-[#06B6D4]/25 shadow-[0_0_0_2px_rgba(6,182,212,0.35)]'
: 'border-[#22D3EE] bg-[#06B6D4]/10'
}`}
>
<span className="absolute -top-6 left-[-2px] inline-flex items-center px-2 py-0.5 rounded-t-md rounded-br-md bg-[#22D3EE] text-slate-950 text-[11px] font-bold shadow-sm whitespace-nowrap">
Ô tô
</span>
{/* Corner handles */}
<span className="absolute -top-1 -left-1 w-2 h-2 bg-white border border-[#06B6D4] rounded-full" />
<span className="absolute -top-1 -right-1 w-2 h-2 bg-white border border-[#06B6D4] rounded-full" />
<span className="absolute -bottom-1 -left-1 w-2 h-2 bg-white border border-[#06B6D4] rounded-full" />
<span className="absolute -bottom-1 -right-1 w-2 h-2 bg-white border border-[#06B6D4] rounded-full" />
</div>
</div>
{/* Card Bottom Stats */}
<div className="flex items-center justify-between px-5 py-4 bg-white border-t border-slate-200">
<div>
<div className="text-xl font-bold text-slate-900 tracking-tight">
4.320
</div>
<div className="text-xs text-slate-500 mt-0.5">
ảnh trong không gian nhóm
</div>
</div>
<div className="text-right">
<div className="text-xl font-bold text-slate-900 tracking-tight">
Bạn quyết định
</div>
<div className="text-xs text-slate-500 mt-0.5">
duyệt nhãn trước khi xuất
</div>
</div>
</div>
{/* Thẻ minh họa gán nhãn giao thông đô thị */}
<div
className="shrink-0 self-stretch flex flex-col items-start rounded-[12px] overflow-hidden"
style={{
backgroundColor: LOGIN_COLORS.bgPreviewCard,
...createInsetOutlineStyle(LOGIN_COLORS.borderPreviewCard, 1),
}}
>
{/* Tiêu đề thẻ minh họa */}
<div className="shrink-0 self-stretch flex justify-between items-start p-3.5 overflow-hidden">
<p className="shrink-0 font-sans text-[11px] font-normal leading-[17px] whitespace-nowrap">
Giao thông đô thị
</p>
<p className="shrink-0 font-sans text-[10px] font-normal leading-[15px] whitespace-nowrap">
Đã duyệt thủ công
</p>
</div>
{/* Bottom Task Tags */}
<div className="flex items-center gap-6 mt-6">
{(['Classification', 'Object Detection', 'Segmentation'] as const).map(
(task) => {
const isSelected = activeTask === task
return (
<button
key={task}
type="button"
onClick={() => setActiveTask(task)}
className={`text-xs transition-colors ${
isSelected
? 'font-semibold text-slate-900 underline decoration-[#C95C3C] decoration-2 underline-offset-4'
: 'font-medium text-slate-600 hover:text-slate-900'
}`}
{/* Ảnh giao thông và các khung Bounding Box */}
<div className="shrink-0 h-[272px] w-full max-w-[548px] flex flex-col items-start overflow-hidden relative">
<img
className="shrink-0 h-[272px] w-[548px] object-cover"
src="/assets/nh-giao-th-ng.jpg"
alt="Ảnh giao thông"
/>
{TRAFFIC_BOUNDING_BOXES.map((box) => {
const { frameStyle, badgeStyle } = getBoundingBoxStyles(box)
return (
<div
key={box.id}
className="absolute flex flex-col items-start"
style={frameStyle}
>
<div
className="absolute left-[-2px] top-[-22px] h-[21px] flex items-start py-[3px] px-1.5 overflow-hidden"
style={badgeStyle}
>
{task}
</button>
)
}
)}
<p
className="shrink-0 font-sans text-[10px] font-semibold leading-[15px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textLeftPrimary }}
>
{box.label}
</p>
</div>
</div>
)
})}
</div>
{/* Thông số thống kê bên dưới ảnh */}
<div className="shrink-0 self-stretch flex justify-between items-start p-4 overflow-hidden">
{PREVIEW_STATS.map((stat) => (
<div
key={stat.value}
className="shrink-0 flex flex-col items-start gap-[3px] overflow-hidden"
>
<p className="shrink-0 font-sans text-[20px] font-semibold leading-[30px] whitespace-nowrap">
{stat.value}
</p>
<p className="shrink-0 font-sans text-[10px] font-normal leading-[15px] whitespace-nowrap">
{stat.description}
</p>
</div>
))}
</div>
</div>
{/* Footer Copyright */}
<p className="text-xs text-slate-500 mt-8">
{/* Các loại bài toán gán nhãn hỗ trợ */}
<div className="shrink-0 flex items-start gap-5 overflow-hidden">
{AI_TASK_TYPES.map((taskName) => (
<p
key={taskName}
className="shrink-0 font-sans text-[10px] font-normal leading-[15px] whitespace-nowrap"
>
{taskName}
</p>
))}
</div>
{/* Bản quyền */}
<p className="shrink-0 font-sans text-[10px] font-normal leading-[15px] whitespace-nowrap">
© 2026 danable. Dữ liệu của bạn, quyền kiểm soát của bạn.
</p>
</div>

View file

@ -1,6 +1,7 @@
import React, { useState } from 'react'
import { Link } from 'react-router-dom'
import { LoginRequest } from '../../../types'
import { LoginRequest } from '@/types'
import { LOGIN_COLORS, createInsetOutlineStyle } from '@/styles/theme'
import { SSOButton } from './SSOButton'
export interface LoginFormProps {
@ -38,196 +39,194 @@ export const LoginForm: React.FC<LoginFormProps> = ({
})
}
const inputBoxOutlineStyle = createInsetOutlineStyle(
LOGIN_COLORS.borderControl,
1
)
return (
<div className="w-full max-w-[420px] mx-auto">
{/* Header */}
<div className="mb-6">
<p className="text-[11px] font-semibold uppercase tracking-[0.08em] text-indigo-600 mb-2">
<form
onSubmit={handleSubmit}
noValidate
className="shrink-0 w-full max-w-[416px] flex flex-col items-start gap-6 overflow-hidden"
>
{/* Phần tiêu đề chào mừng */}
<div className="shrink-0 self-stretch flex flex-col items-start gap-2.5 overflow-hidden">
<p
className="shrink-0 font-sans text-[10px] font-semibold leading-[15px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.brandAccentIndigo }}
>
CHÀO MỪNG TRỞ LẠI
</p>
<h2 className="text-[28px] font-bold text-slate-900 tracking-tight leading-tight mb-2">
<h2
className="shrink-0 font-sans text-[30px] font-normal tracking-[-1px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textRightPrimary }}
>
Đăng nhập vào danable
</h2>
<p className="text-sm text-slate-500">
<p
className="shrink-0 self-stretch font-sans text-[13px] font-normal leading-[20px]"
style={{ color: LOGIN_COLORS.textSecondary }}
>
Tiếp tục xây dựng bộ dữ liệu tốt hơn, cùng đội ngũ của bạn.
</p>
</div>
{/* SSO Button */}
{/* Nút đăng nhập bằng SSO công ty */}
<SSOButton onClick={onSSOLogin} isLoading={isLoading} />
{/* Divider */}
<div className="relative flex items-center justify-center my-6">
<div className="w-full border-t border-slate-200" />
<span className="bg-white px-3 text-xs text-slate-400 whitespace-nowrap">
{/* Đường phân cách "hoặc sử dụng email" */}
<div className="shrink-0 self-stretch flex items-center gap-3.5 overflow-hidden">
<div
className="flex-1 min-w-0 h-[1px]"
style={{ backgroundColor: LOGIN_COLORS.borderControl }}
/>
<p
className="shrink-0 font-sans text-[10px] font-normal leading-[15px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textMuted }}
>
hoặc sử dụng email
</span>
<div className="w-full border-t border-slate-200" />
</p>
<div
className="flex-1 min-w-0 h-[1px]"
style={{ backgroundColor: LOGIN_COLORS.borderControl }}
/>
</div>
{/* Error Alert */}
{/* Thông báo lỗi nếu có */}
{errorMessage && (
<div className="mb-4 px-3.5 py-2.5 rounded-lg bg-red-50 border border-red-200 text-xs text-red-700">
<div className="self-stretch px-3.5 py-2.5 rounded-[8px] bg-red-50 border border-red-200 text-xs text-red-700">
{errorMessage}
</div>
)}
{/* Form */}
<form onSubmit={handleSubmit} className="space-y-4" noValidate>
{/* Email Field */}
<div>
<label
htmlFor="work-email"
className="block text-[13px] font-medium text-slate-800 mb-1.5"
>
Email công việc
</label>
<div className="relative">
<span className="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
<svg
className="w-4 h-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.8"
strokeLinecap="round"
strokeLinejoin="round"
>
<rect x="2" y="4" width="20" height="16" rx="2" />
<path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" />
</svg>
</span>
<input
id="work-email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="name@company.vn"
className="w-full pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:border-[#C95C3C] focus:ring-2 focus:ring-[#C95C3C]/15 transition-all"
/>
</div>
</div>
{/* Password Field */}
<div>
<label
htmlFor="work-password"
className="block text-[13px] font-medium text-slate-800 mb-1.5"
>
Mật khẩu
</label>
<div className="relative">
<span className="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
<svg
className="w-4 h-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.8"
strokeLinecap="round"
strokeLinejoin="round"
>
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
</svg>
</span>
<input
id="work-password"
type={showPassword ? 'text' : 'password'}
value={password}
onChange={(e) => setPassword(e.target.value)}
placeholder="Nhập mật khẩu"
className="w-full pl-10 pr-10 py-2.5 rounded-xl border border-slate-200 bg-white text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:border-[#C95C3C] focus:ring-2 focus:ring-[#C95C3C]/15 transition-all"
/>
<button
type="button"
onClick={() => setShowPassword((prev) => !prev)}
aria-label={showPassword ? 'Ẩn mật khẩu' : 'Hiện mật khẩu'}
className="absolute inset-y-0 right-0 pr-3.5 flex items-center text-slate-500 hover:text-slate-700"
>
{showPassword ? (
<svg
className="w-4 h-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.8"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" />
<circle cx="12" cy="12" r="3" />
</svg>
) : (
<svg
className="w-4 h-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.8"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M9.88 9.88a3 3 0 1 0 4.24 4.24" />
<path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" />
<path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" />
<line x1="2" x2="22" y1="2" y2="22" />
</svg>
)}
</button>
</div>
</div>
{/* Remember Me & Forgot Password */}
<div className="flex items-center justify-between pt-1">
<label className="inline-flex items-center gap-2 cursor-pointer select-none">
<input
type="checkbox"
checked={rememberMe}
onChange={(e) => setRememberMe(e.target.checked)}
className="w-4 h-4 rounded border-slate-300 text-slate-700 focus:ring-slate-500 accent-slate-600"
/>
<span className="text-xs text-slate-600">Ghi nhớ đăng nhập</span>
</label>
<Link
to="/forgot-password"
className="text-xs font-medium text-indigo-600 hover:text-indigo-700 hover:underline"
>
Quên mật khẩu?
</Link>
</div>
{/* Terracotta Submit Button */}
<button
type="submit"
disabled={isLoading}
className="w-full flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[#C95C3C] hover:bg-[#B5492B] active:bg-[#A03E22] text-white text-sm font-semibold shadow-sm transition-colors disabled:opacity-60 mt-2"
{/* Trường nhập Email công việc */}
<div className="shrink-0 self-stretch flex flex-col items-start gap-2 overflow-hidden">
<label
htmlFor="work-email"
className="shrink-0 font-sans text-[13px] font-medium leading-[20px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textRightPrimary }}
>
<span>{isLoading ? 'Đang đăng nhập...' : 'Đăng nhập'}</span>
<span aria-hidden="true" className="text-base leading-none">
→
</span>
</button>
</form>
{/* Security Badge */}
<div className="flex items-center justify-center gap-1.5 mt-5 text-xs text-slate-500">
<svg
className="w-3.5 h-3.5 text-slate-500 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
Email công việc
</label>
<div
className="shrink-0 h-12 self-stretch flex items-center gap-3 py-0 px-3.5 rounded-[8px] overflow-hidden"
style={inputBoxOutlineStyle}
>
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10" />
<path d="m9 12 2 2 4-4" />
</svg>
<span>Kết nối được mã hóa. Dữ liệu luôn riêng tư.</span>
<img
className="shrink-0 w-4 h-4"
src="/assets/mail.svg"
alt="Biểu tượng email"
/>
<input
id="work-email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="minhanh@visionlab.vn"
className="flex-1 min-w-0 bg-transparent font-sans text-[13px] font-normal leading-[20px] focus:outline-none"
style={{ color: LOGIN_COLORS.textRightPrimary }}
/>
</div>
</div>
</div>
{/* Trường nhập Mật khẩu */}
<div className="shrink-0 self-stretch flex flex-col items-start gap-2 overflow-hidden">
<label
htmlFor="work-password"
className="shrink-0 font-sans text-[13px] font-medium leading-[20px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textRightPrimary }}
>
Mật khẩu
</label>
<div
className="shrink-0 h-12 self-stretch flex items-center gap-3 py-0 px-3.5 rounded-[8px] overflow-hidden"
style={inputBoxOutlineStyle}
>
<img
className="shrink-0 w-4 h-4"
src="/assets/lock-keyhole.svg"
alt="Biểu tượng khóa"
/>
<input
id="work-password"
type={showPassword ? 'text' : 'password'}
value={password}
onChange={(e) => setPassword(e.target.value)}
placeholder="••••••••••••"
className="flex-1 min-w-0 bg-transparent font-sans text-[13px] font-normal leading-[20px] focus:outline-none"
style={{ color: LOGIN_COLORS.textRightPrimary }}
/>
<button
type="button"
onClick={() => setShowPassword((prev) => !prev)}
aria-label={showPassword ? 'Ẩn mật khẩu' : 'Hiện mật khẩu'}
className="shrink-0 flex items-center justify-center"
>
<img
className="shrink-0 w-4 h-4"
src="/assets/eye-off.svg"
alt="Ẩn/hiện mật khẩu"
/>
</button>
</div>
</div>
{/* Ghi nhớ đăng nhập & Quên mật khẩu */}
<div className="shrink-0 self-stretch flex justify-between items-start overflow-hidden">
<button
type="button"
onClick={() => setRememberMe((prev) => !prev)}
className="shrink-0 font-sans text-[12px] font-normal leading-[18px] whitespace-nowrap text-left"
style={{ color: LOGIN_COLORS.textSecondary }}
>
{rememberMe ? '☑ Ghi nhớ đăng nhập' : '☐ Ghi nhớ đăng nhập'}
</button>
<Link
to="/forgot-password"
className="shrink-0 font-sans text-[12px] font-normal leading-[18px] whitespace-nowrap hover:underline"
style={{ color: LOGIN_COLORS.brandAccentIndigo }}
>
Quên mật khẩu?
</Link>
</div>
{/* Nút Đăng nhập chính */}
<button
type="submit"
disabled={isLoading}
className="shrink-0 h-12 self-stretch flex justify-center items-center gap-3 rounded-[8px] overflow-hidden transition-opacity hover:opacity-95 disabled:opacity-60"
style={{ backgroundColor: LOGIN_COLORS.brandOrangeRed }}
>
<span
className="shrink-0 font-sans text-[13px] font-semibold leading-[20px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textOnBrand }}
>
{isLoading ? 'Đang đăng nhập...' : 'Đăng nhập'}
</span>
<img
className="shrink-0 w-4 h-4"
src="/assets/arrow-right.svg"
alt="Mũi tên tiếp tục"
/>
</button>
{/* Cam kết bảo mật */}
<div className="shrink-0 self-stretch flex justify-center items-start gap-[7px] overflow-hidden">
<img
className="shrink-0 w-[13px] h-[13px]"
src="/assets/shield-check.svg"
alt="Biểu tượng bảo mật"
/>
<p
className="shrink-0 font-sans text-[10px] font-normal leading-[15px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textSecondary }}
>
Kết nối được mã hóa. Dữ liệu luôn riêng tư.
</p>
</div>
</form>
)
}

View file

@ -1,4 +1,5 @@
import React from 'react'
import { LOGIN_COLORS, createInsetOutlineStyle } from '@/styles/theme'
export interface SSOButtonProps {
onClick?: () => void
@ -14,31 +15,20 @@ export const SSOButton: React.FC<SSOButtonProps> = ({
type="button"
onClick={onClick}
disabled={isLoading}
className="w-full flex items-center justify-center gap-2.5 px-4 py-3 rounded-xl border border-slate-200 bg-white text-slate-800 text-sm font-medium hover:bg-slate-50 hover:border-slate-300 active:bg-slate-100 transition-all disabled:opacity-60"
className="shrink-0 h-[46px] self-stretch flex justify-center items-center gap-2.5 rounded-[8px] overflow-hidden hover:bg-slate-50 transition-colors disabled:opacity-60"
style={createInsetOutlineStyle(LOGIN_COLORS.borderControl, 1)}
>
{/* Building Icon */}
<svg
className="w-4 h-4 text-slate-600 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.8"
strokeLinecap="round"
strokeLinejoin="round"
<img
className="shrink-0 w-4 h-4"
src="/assets/building-2.svg"
alt="Biểu tượng SSO công ty"
/>
<span
className="shrink-0 font-sans text-[13px] font-medium leading-[20px] whitespace-nowrap"
style={{ color: LOGIN_COLORS.textRightPrimary }}
>
<rect x="4" y="2" width="16" height="20" rx="2" ry="2" />
<path d="M9 22v-4h6v4" />
<path d="M8 6h.01" />
<path d="M16 6h.01" />
<path d="M12 6h.01" />
<path d="M12 10h.01" />
<path d="M12 14h.01" />
<path d="M16 10h.01" />
<path d="M16 14h.01" />
<path d="M8 10h.01" />
<path d="M8 14h.01" />
</svg>
<span>Đăng nhập bằng SSO công ty</span>
Đăng nhập bằng SSO công ty
</span>
</button>
)
}

View file

@ -65,7 +65,7 @@ export const ProjectDetailPage: React.FC = () => {
}
return (
<div className="space-y-4">
<div className="space-y-5">
{/* Hidden file input for header "↑ Tải ảnh lên" button */}
<input
ref={fileInputRef}
@ -77,13 +77,13 @@ export const ProjectDetailPage: React.FC = () => {
/>
{/* Top Header matching MVP · Project dashboard.png */}
<div className="flex flex-wrap items-start justify-between gap-4">
<div>
<h1 className="text-[28px] font-bold leading-tight tracking-tight text-slate-900">
<div className="flex flex-wrap items-center justify-between gap-4">
<div className="min-w-0">
<h1 className="text-[27px] font-medium leading-tight tracking-[-0.03em] text-[var(--project-heading)]">
{project.name}
</h1>
<p className="mt-1 text-xs text-slate-500">
<span className="font-mono text-slate-600">{project.slug}</span>
<p className="mt-1.5 text-xs leading-[18px] text-[var(--project-body)]">
<span className="font-mono text-[var(--project-body)]">{project.slug}</span>
{' · '}
<span>{TASK_DISPLAY_NAME[project.taskType]}</span>
{' · '}
@ -93,14 +93,14 @@ export const ProjectDetailPage: React.FC = () => {
</p>
</div>
<div className="flex flex-wrap items-center gap-3">
<div className="flex flex-wrap items-center gap-2">
<button
type="button"
onClick={() => fileInputRef.current?.click()}
className="inline-flex h-10 items-center gap-2 rounded-xl border border-slate-200 bg-white px-4 text-xs font-bold text-slate-800 shadow-sm transition hover:bg-slate-50"
className="inline-flex h-10 items-center gap-2 rounded-lg border border-[var(--project-border)] bg-white px-4 text-[13px] font-semibold text-[var(--project-heading)] transition hover:bg-[var(--project-canvas)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--project-accent)]/30"
>
<svg
className="h-4 w-4 text-slate-700"
className="h-4 w-4 text-[var(--project-heading)]"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
@ -118,17 +118,19 @@ export const ProjectDetailPage: React.FC = () => {
<button
type="button"
onClick={() => navigate(`/projects/${project.id}/annotate`)}
className="inline-flex h-10 items-center gap-2 rounded-xl bg-[#C95C3C] px-5 text-xs font-bold text-white shadow-sm transition hover:bg-[#B5492B]"
className="inline-flex h-10 items-center gap-2 rounded-lg border border-[var(--project-accent)] bg-[var(--brand-primary)] px-4 text-[13px] font-semibold text-white transition hover:bg-[var(--brand-primary-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--project-accent)]/40"
>
<span>↗</span>
<svg className="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" aria-hidden="true">
<path strokeLinecap="round" strokeLinejoin="round" d="M7 17 17 7M8 7h9v9" />
</svg>
<span>Mở giao diện gán nhãn</span>
</button>
</div>
</div>
{/* Tabs navigation matching MVP · Project dashboard.png */}
<div className="border-b border-slate-200">
<nav className="-mb-px flex flex-wrap gap-6">
<div className="border-b border-[var(--project-border)]">
<nav className="-mb-px flex flex-wrap gap-7" aria-label="Điều hướng dự án">
{TABS.map((tab) => {
const isActive = activeTab === tab.key
return (
@ -136,10 +138,10 @@ export const ProjectDetailPage: React.FC = () => {
key={tab.key}
type="button"
onClick={() => setActiveTab(tab.key)}
className={`border-b-2 pb-2.5 text-xs font-semibold transition ${
className={`flex h-[38px] items-center border-b-2 text-[13px] transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--project-accent)]/30 ${
isActive
? 'border-indigo-600 text-indigo-600'
: 'border-transparent text-slate-500 hover:border-slate-300 hover:text-slate-800'
? 'border-[var(--project-accent)] font-semibold text-[var(--project-accent)]'
: 'border-transparent font-normal text-[var(--project-body)] hover:text-[var(--project-heading)]'
}`}
>
{tab.label}
@ -150,7 +152,7 @@ export const ProjectDetailPage: React.FC = () => {
</div>
{/* Tab Content */}
<div className="pt-1">
<div className="pt-0">
{activeTab === 'overview' && (
<OverviewTab
project={project}

View file

@ -50,10 +50,10 @@ export const ExportButton: React.FC<ExportButtonProps> = ({
<button
type="button"
onClick={() => setOpen((prev) => !prev)}
className="inline-flex h-10 items-center gap-2 rounded-xl border border-slate-200 bg-white px-4 text-xs font-bold text-slate-800 shadow-sm transition hover:bg-slate-50"
className="inline-flex h-10 items-center gap-2 rounded-lg border border-[var(--project-border)] bg-white px-4 text-xs font-semibold text-[var(--project-heading)] transition hover:bg-[var(--project-canvas)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--project-accent)]/30"
>
<svg
className="h-4 w-4 text-slate-600"
className="h-4 w-4 text-[var(--project-body)]"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
@ -69,7 +69,7 @@ export const ExportButton: React.FC<ExportButtonProps> = ({
</button>
{open && (
<div className="absolute right-0 top-11 z-20 w-52 rounded-xl border border-slate-200 bg-white py-1.5 shadow-lg">
<div className="absolute right-0 top-11 z-20 w-52 rounded-lg border border-[var(--project-border)] bg-white py-1.5 shadow-lg">
<div className="px-3.5 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-slate-400">
Định dạng xuất
</div>

View file

@ -17,27 +17,27 @@ const STATUS_BADGE_MAP: Record<
> = {
pending_review: {
label: 'Chờ duyệt',
bg: 'bg-[#FEF3C7]',
text: 'text-[#B45309]',
dot: 'bg-[#F59E0B]',
bg: 'bg-[var(--project-status-review-bg)]',
text: 'text-[var(--project-status-review-text)]',
dot: 'bg-[var(--project-status-review-dot)]',
},
in_progress: {
label: 'Đang làm',
bg: 'bg-[#FEE2E2]/80',
text: 'text-[#B91C1C]',
dot: 'bg-[#EF4444]',
bg: 'bg-[var(--project-status-active-bg)]',
text: 'text-[var(--project-status-active-text)]',
dot: 'bg-[var(--brand-primary)]',
},
completed: {
label: 'Hoàn thành',
bg: 'bg-[#DCFCE7]',
text: 'text-[#15803D]',
dot: 'bg-[#22C55E]',
bg: 'bg-[var(--project-status-complete-bg)]',
text: 'text-[var(--project-status-complete-text)]',
dot: 'bg-[var(--project-status-complete-text)]',
},
unassigned: {
label: 'Chưa gán nhãn',
bg: 'bg-slate-100',
text: 'text-slate-600',
dot: 'bg-slate-400',
bg: 'bg-[var(--project-status-draft-bg)]',
text: 'text-[var(--project-status-draft-text)]',
dot: 'bg-[var(--project-status-draft-text)]',
},
}
@ -77,12 +77,12 @@ export const ImageTable: React.FC<ImageTableProps> = ({
const formatNum = (n: number) => n.toLocaleString('vi-VN')
return (
<div className="overflow-hidden rounded-2xl border border-slate-200/80 bg-white shadow-[0_1px_2px_rgba(15,23,42,0.03)]">
<div className="overflow-hidden rounded-xl border border-[var(--project-border)] bg-[var(--project-surface)]">
{/* Top Header + Filter Bar */}
<div className="p-5">
<div className="p-[18px]">
<div className="mb-4 flex items-center justify-between">
<h3 className="text-base font-bold text-slate-900">Danh sách ảnh</h3>
<span className="text-xs font-medium text-indigo-600">
<h3 className="text-sm font-semibold text-[var(--project-heading)]">Danh sách ảnh</h3>
<span className="text-[11px] text-[var(--project-accent)]">
{formatNum(stats.totalImages)} ảnh · {formatNum(totalObjects)} đối tượng
</span>
</div>
@ -105,7 +105,7 @@ export const ImageTable: React.FC<ImageTableProps> = ({
<div className="overflow-x-auto">
<table className="w-full border-collapse text-left">
<thead>
<tr className="border-y border-slate-200/70 bg-slate-50/70 text-[11px] font-bold uppercase tracking-wider text-slate-400">
<tr className="border-y border-[var(--project-border)] bg-[var(--project-canvas)] text-[10px] font-semibold tracking-[0.04em] text-[var(--project-body)]">
<th className="py-3 pl-5 pr-4">TÊN ẢNH</th>
<th className="px-4 py-3">TRẠNG THÁI</th>
<th className="px-4 py-3">NHÃN</th>
@ -113,10 +113,10 @@ export const ImageTable: React.FC<ImageTableProps> = ({
<th className="py-3 pl-4 pr-5">THAO TÁC</th>
</tr>
</thead>
<tbody className="divide-y divide-slate-100 text-xs">
<tbody className="divide-y divide-[var(--project-border)] text-xs">
{filteredImages.length === 0 ? (
<tr>
<td colSpan={5} className="py-10 text-center text-slate-400">
<td colSpan={5} className="py-10 text-center text-[var(--project-body)]">
Không tìm thấy ảnh phù hợp với bộ lọc hiện tại.
</td>
</tr>
@ -129,20 +129,20 @@ export const ImageTable: React.FC<ImageTableProps> = ({
onClick={() =>
navigate(`/projects/${projectId}/annotate?imageId=${image.id}`)
}
className="cursor-pointer transition hover:bg-slate-50/80"
className="h-16 cursor-pointer transition hover:bg-[var(--project-canvas)]"
>
<td className="py-3.5 pl-5 pr-4">
<div className="flex items-center gap-3.5">
<div className="flex items-center gap-3">
<img
src={image.thumbnailUrl}
alt={image.fileName}
className="h-9 w-14 rounded-lg object-cover border border-slate-200/60 shrink-0"
className="h-9 w-[54px] shrink-0 rounded object-cover"
/>
<div>
<p className="font-mono text-xs font-semibold text-slate-900">
<p className="font-mono text-[11px] text-[var(--project-heading)]">
{image.fileName}
</p>
<p className="mt-0.5 text-[11px] text-slate-400">
<p className="text-[9px] text-[var(--project-muted)]">
{image.width} × {image.height} px
</p>
</div>
@ -151,18 +151,18 @@ export const ImageTable: React.FC<ImageTableProps> = ({
<td className="px-4 py-3.5">
<span
className={`inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold ${badge.bg} ${badge.text}`}
className={`inline-flex items-center gap-[5px] rounded-md px-2 py-1 text-[11px] font-medium ${badge.bg} ${badge.text}`}
>
<span className={`h-1.5 w-1.5 rounded-full ${badge.dot}`} />
{badge.label}
</span>
</td>
<td className="px-4 py-3.5 text-slate-600">
<td className="px-4 py-3.5 text-[11px] text-[var(--project-body)]">
{image.objectCount} đối tượng
</td>
<td className="px-4 py-3.5 font-semibold text-slate-800">
<td className="px-4 py-3.5 text-[11px] text-[var(--project-heading)]">
{image.assignedTo.name}
</td>
@ -173,7 +173,7 @@ export const ImageTable: React.FC<ImageTableProps> = ({
e.stopPropagation()
navigate(`/projects/${projectId}/annotate?imageId=${image.id}`)
}}
className="font-semibold text-indigo-600 hover:text-indigo-700 transition"
className="text-[11px] font-medium text-[var(--project-accent)] transition hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--project-accent)]/30"
>
Mở ảnh →
</button>

View file

@ -33,7 +33,7 @@ export const ImageTableFilters: React.FC<ImageTableFiltersProps> = ({
{/* Search Input */}
<div className="relative w-full sm:w-64">
<svg
className="pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"
className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--project-body)]"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
@ -50,7 +50,7 @@ export const ImageTableFilters: React.FC<ImageTableFiltersProps> = ({
value={searchQuery}
onChange={(e) => onSearchChange(e.target.value)}
placeholder="Tìm tên ảnh..."
className="h-10 w-full rounded-xl border border-slate-200 bg-white pl-10 pr-4 text-xs 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-9 pr-3 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>
@ -59,7 +59,7 @@ export const ImageTableFilters: React.FC<ImageTableFiltersProps> = ({
<select
value={selectedStatus}
onChange={(e) => onStatusChange(e.target.value as 'all' | ImageAnnotationStatus)}
className="h-10 appearance-none rounded-xl border border-slate-200 bg-white pl-3.5 pr-9 text-xs 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="pending_review">Chờ duyệt</option>
@ -68,7 +68,7 @@ export const ImageTableFilters: React.FC<ImageTableFiltersProps> = ({
<option value="unassigned">Chưa gán nhãn</option>
</select>
<svg
className="pointer-events-none absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-500"
className="pointer-events-none absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--project-body)]"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
@ -83,7 +83,7 @@ export const ImageTableFilters: React.FC<ImageTableFiltersProps> = ({
<select
value={selectedMember}
onChange={(e) => onMemberChange(e.target.value)}
className="h-10 appearance-none rounded-xl border border-slate-200 bg-white pl-3.5 pr-9 text-xs 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ả thành viên</option>
{memberNames.map((name) => (
@ -93,7 +93,7 @@ export const ImageTableFilters: React.FC<ImageTableFiltersProps> = ({
))}
</select>
<svg
className="pointer-events-none absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-500"
className="pointer-events-none absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--project-body)]"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"

View file

@ -20,31 +20,31 @@ export const LabelDistribution: React.FC<LabelDistributionProps> = ({
const formatNum = (n: number) => n.toLocaleString('vi-VN')
return (
<div className="flex h-full flex-col justify-between rounded-2xl border border-slate-200/80 bg-white p-5 shadow-[0_1px_2px_rgba(15,23,42,0.03)]">
<div className="flex h-full flex-col justify-between overflow-hidden rounded-xl border border-[var(--project-border)] bg-[var(--project-surface)]">
<div>
<div className="flex items-center justify-between">
<h3 className="text-base font-bold text-slate-900">Lớp nhãn</h3>
<div className="flex h-[52px] items-center justify-between px-[18px]">
<h3 className="text-sm font-semibold text-[var(--project-heading)]">Lớp nhãn</h3>
<button
type="button"
onClick={onManageLabels}
className="text-xs font-semibold text-indigo-600 hover:text-indigo-700 transition"
className="text-[11px] text-[var(--project-accent)] transition hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--project-accent)]/30"
>
Quản lý {classes.length} lớp →
</button>
</div>
{/* 4 columns with colored dots matching MVP · Project dashboard.png */}
<div className="mt-5 grid grid-cols-2 gap-4 sm:grid-cols-4">
<div className="grid grid-cols-2 gap-3 px-[18px] pb-4 sm:grid-cols-4">
{classes.map((cls) => (
<div key={cls.id}>
<div className="flex items-center gap-1.5">
<span
className="h-2 w-2 rounded-full shrink-0"
className="h-[7px] w-[7px] shrink-0 rounded-full"
style={{ backgroundColor: cls.color }}
/>
<span className="text-xs font-semibold text-slate-800">{cls.name}</span>
<span className="text-[11px] text-[var(--project-heading)]">{cls.name}</span>
</div>
<p className="mt-2 text-2xl font-bold tracking-tight text-slate-900">
<p className="mt-1.5 text-xl font-normal leading-[30px] tabular-nums text-[var(--project-heading)]">
{formatNum(cls.count)}
</p>
</div>
@ -53,16 +53,16 @@ export const LabelDistribution: React.FC<LabelDistributionProps> = ({
</div>
{/* Bottom progress bar */}
<div className="mt-6 pt-2">
<div className="flex items-center justify-between text-xs">
<span className="text-slate-500">
<div className="px-[18px] pb-[18px]">
<div className="flex items-center justify-between text-[11px]">
<span className="text-[var(--project-body)]">
{formatNum(annotatedImages)} / {formatNum(totalImages)} ảnh đã gán nhãn
</span>
<span className="font-bold text-indigo-600">{progressPercent}%</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-2 h-1.5 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(--brand-primary)] transition-[width] duration-300"
style={{ width: `${Math.min(100, Math.max(0, progressPercent))}%` }}
/>
</div>

View file

@ -27,20 +27,20 @@ export const MemberAssignment: React.FC<MemberAssignmentProps> = ({
: sortedMembers
return (
<div className="flex h-full flex-col justify-between rounded-2xl border border-slate-200/80 bg-white p-5 shadow-[0_1px_2px_rgba(15,23,42,0.03)]">
<div className="flex h-full flex-col justify-between overflow-hidden rounded-xl border border-[var(--project-border)] bg-[var(--project-surface)]">
<div>
<div className="flex items-center justify-between">
<h3 className="text-base font-bold text-slate-900">Phân công thành viên</h3>
<div className="flex h-[52px] items-center justify-between px-[18px]">
<h3 className="text-sm font-semibold text-[var(--project-heading)]">Phân công thành viên</h3>
<button
type="button"
onClick={onEditMembers}
className="text-xs font-semibold text-indigo-600 hover:text-indigo-700 transition"
className="text-[11px] text-[var(--project-accent)] transition hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--project-accent)]/30"
>
Chỉnh sửa →
</button>
</div>
<div className="mt-4 space-y-3">
<div className="space-y-3 px-[18px] pb-4">
{displayMembers.map((member) => {
const rightLabel =
member.role === 'reviewer' && member.pendingReviewCount !== undefined
@ -50,25 +50,24 @@ export const MemberAssignment: React.FC<MemberAssignmentProps> = ({
return (
<div
key={member.id}
className="flex items-center justify-between py-0.5"
className="flex min-w-0 items-center justify-between gap-3"
>
<div className="flex items-center gap-3">
<div className="flex min-w-0 items-center gap-2.5">
<div
style={{ backgroundColor: member.color }}
className="flex h-8 w-8 items-center justify-center rounded-full text-xs font-bold text-indigo-700"
className="flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full bg-[var(--project-avatar-background)] text-[11px] font-semibold text-[var(--project-accent)]"
>
{member.initials}
</div>
<div className="flex items-baseline gap-2">
<span className="text-xs font-bold text-slate-900">
<span className="truncate text-[11px] font-medium text-[var(--project-heading)]">
{member.name}
</span>
<span className="text-xs text-slate-400">
<span className="truncate text-[10px] text-[var(--project-body)]">
{ROLE_LABELS[member.role]}
</span>
</div>
</div>
<span className="text-xs font-medium text-slate-600">
<span className="shrink-0 text-[11px] text-[var(--project-body)]">
{rightLabel}
</span>
</div>

View file

@ -17,20 +17,20 @@ export const OverviewTab: React.FC<OverviewTabProps> = ({
onSwitchTab,
}) => {
return (
<div className="space-y-4">
<div className="space-y-5">
{/* 4 Status Cards */}
<StatusCards stats={project.stats} />
{/* Side-by-side Label Distribution (7 cols) + Member Assignment (5 cols) */}
<div className="grid grid-cols-1 gap-4 lg:grid-cols-12">
<div className="lg:col-span-7">
{/* Side-by-side label summary and member assignments. */}
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
<div className="min-w-0">
<LabelDistribution
classes={project.classes}
stats={project.stats}
onManageLabels={() => onSwitchTab('labels')}
/>
</div>
<div className="lg:col-span-5">
<div className="min-w-0">
<MemberAssignment
members={project.members}
onEditMembers={() => onSwitchTab('members')}
@ -46,6 +46,17 @@ export const OverviewTab: React.FC<OverviewTabProps> = ({
stats={project.stats}
classes={project.classes}
/>
<section className="overflow-hidden rounded-xl border border-[var(--project-border)] bg-[var(--project-surface)]">
<div className="flex min-h-[52px] items-center px-[18px]">
<h2 className="text-sm font-semibold text-[var(--project-heading)]">Thông tin bộ dữ liệu</h2>
</div>
<div className="flex flex-wrap gap-x-8 gap-y-2 border-t border-[var(--project-border)] px-[18px] py-4 text-xs text-[var(--project-body)]">
<span>Mã dự án: <span className="font-mono text-[var(--project-heading)]">{project.slug}</span></span>
<span>Loại bài toán: <span className="text-[var(--project-heading)]">{project.taskType.replace('_', ' ')}</span></span>
<span>Tổng số ảnh: <span className="tabular-nums text-[var(--project-heading)]">{project.stats.totalImages.toLocaleString('vi-VN')}</span></span>
</div>
</section>
</div>
)
}

View file

@ -44,15 +44,15 @@ export const StatusCards: React.FC<StatusCardsProps> = ({ stats }) => {
return (
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
{cards.map((c) => (
<div
<div
key={c.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 min-w-0 flex-col gap-[5px] rounded-[10px] border border-[var(--project-border)] bg-[var(--project-surface)] p-[18px]"
>
<p className="text-xs font-medium text-slate-500">{c.label}</p>
<p className="mt-2 text-[28px] font-bold leading-tight tracking-tight text-slate-900">
<p className="text-[11px] font-normal leading-[17px] text-[var(--project-body)]">{c.label}</p>
<p className="text-[28px] font-normal leading-[42px] tabular-nums text-[var(--project-heading)]">
{c.value}
</p>
<p className="mt-2 text-xs text-slate-500">{c.subtext}</p>
<p className="text-[10px] leading-[15px] text-[var(--project-body)]">{c.subtext}</p>
</div>
))}
</div>

View file

@ -4,6 +4,13 @@ import { Project, ImageItem, ActivityLog, CreateProjectInput, LabelClass, Projec
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'
// Annotation label colors follow the Figma dashboard palette.
export const PROJECT_LABEL_COLORS = {
car: '#16b9c9',
motorbike: '#f5be51',
bus: '#ae7cff',
truck: '#648bf3',
} as const
export const INITIAL_PROJECTS: Project[] = [
{
@ -16,10 +23,10 @@ export const INITIAL_PROJECTS: Project[] = [
thumbnailUrl: THUMBNAIL_CAR_SEDAN,
updatedAt: 'Cập nhật 5 phút trước',
classes: [
{ id: 'cls-car', name: 'Ô tô', color: '#06B6D4', count: 980, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: '#F59E0B', count: 1120, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: '#A855F7', count: 140, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: '#3B82F6', count: 160, shortcutKey: '4' },
{ id: 'cls-car', name: 'Ô tô', color: PROJECT_LABEL_COLORS.car, count: 980, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: PROJECT_LABEL_COLORS.motorbike, count: 1120, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: PROJECT_LABEL_COLORS.bus, count: 140, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: PROJECT_LABEL_COLORS.truck, count: 160, shortcutKey: '4' },
],
stats: {
totalImages: 2400,
@ -45,10 +52,10 @@ export const INITIAL_PROJECTS: Project[] = [
thumbnailUrl: THUMBNAIL_TRAFFIC_STREET,
updatedAt: 'Cập nhật 5 phút trước',
classes: [
{ id: 'cls-car', name: 'Ô tô', color: '#06B6D4', count: 1420, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: '#F59E0B', count: 1860, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: '#A855F7', count: 264, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: '#3B82F6', count: 312, shortcutKey: '4' },
{ id: 'cls-car', name: 'Ô tô', color: PROJECT_LABEL_COLORS.car, count: 1420, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: PROJECT_LABEL_COLORS.motorbike, count: 1860, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: PROJECT_LABEL_COLORS.bus, count: 264, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: PROJECT_LABEL_COLORS.truck, count: 312, shortcutKey: '4' },
],
stats: {
totalImages: 1280,
@ -75,10 +82,10 @@ export const INITIAL_PROJECTS: Project[] = [
thumbnailUrl: THUMBNAIL_STREET_SEGMENTATION,
updatedAt: 'Cập nhật 5 phút trước',
classes: [
{ id: 'cls-car', name: 'Ô tô', color: '#06B6D4', count: 520, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: '#F59E0B', count: 640, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: '#A855F7', count: 110, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: '#3B82F6', count: 145, shortcutKey: '4' },
{ id: 'cls-car', name: 'Ô tô', color: PROJECT_LABEL_COLORS.car, count: 520, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: PROJECT_LABEL_COLORS.motorbike, count: 640, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: PROJECT_LABEL_COLORS.bus, count: 110, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: PROJECT_LABEL_COLORS.truck, count: 145, shortcutKey: '4' },
],
stats: {
totalImages: 640,
@ -97,6 +104,112 @@ export const INITIAL_PROJECTS: Project[] = [
]
export const INITIAL_PROJECT_IMAGES: ImageItem[] = [
{
id: 'urban-img-321',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00321.jpg',
url: THUMBNAIL_CAR_SEDAN,
thumbnailUrl: THUMBNAIL_CAR_SEDAN,
width: 1920,
height: 1080,
status: 'in_progress',
objectCount: 1,
assignedTo: { id: 'mem-hl', name: 'Hà Linh', role: 'annotator' },
submittedBy: 'Hà Linh',
submittedAt: '5 phút trước',
},
{
id: 'urban-img-322',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00322.jpg',
url: THUMBNAIL_TRAFFIC_STREET,
thumbnailUrl: THUMBNAIL_TRAFFIC_STREET,
width: 1920,
height: 1080,
status: 'pending_review',
objectCount: 4,
assignedTo: { id: 'mem-tn', name: 'Tuấn Nam', role: 'annotator' },
reviewerName: 'Minh Anh',
submittedBy: 'Tuấn Nam',
submittedAt: '10 phút trước',
},
{
id: 'urban-img-323',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00323.jpg',
url: THUMBNAIL_STREET_SEGMENTATION,
thumbnailUrl: THUMBNAIL_STREET_SEGMENTATION,
width: 1920,
height: 1080,
status: 'completed',
objectCount: 3,
assignedTo: { id: 'mem-hl', name: 'Hà Linh', role: 'annotator' },
reviewerName: 'Minh Anh',
},
{
id: 'urban-img-324',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00324.jpg',
url: THUMBNAIL_CAR_SEDAN,
thumbnailUrl: THUMBNAIL_CAR_SEDAN,
width: 1920,
height: 1080,
status: 'unassigned',
objectCount: 0,
assignedTo: { id: 'mem-hl', name: 'Hà Linh', role: 'annotator' },
},
{
id: 'urban-img-325',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00325.jpg',
url: THUMBNAIL_TRAFFIC_STREET,
thumbnailUrl: THUMBNAIL_TRAFFIC_STREET,
width: 1920,
height: 1080,
status: 'pending_review',
objectCount: 5,
assignedTo: { id: 'mem-tn', name: 'Tuấn Nam', role: 'annotator' },
reviewerName: 'Minh Anh',
},
{
id: 'urban-img-326',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00326.jpg',
url: THUMBNAIL_CAR_SEDAN,
thumbnailUrl: THUMBNAIL_CAR_SEDAN,
width: 1920,
height: 1080,
status: 'unassigned',
objectCount: 0,
assignedTo: { id: 'mem-tn', name: 'Tuấn Nam', role: 'annotator' },
},
{
id: 'urban-img-327',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00327.jpg',
url: THUMBNAIL_STREET_SEGMENTATION,
thumbnailUrl: THUMBNAIL_STREET_SEGMENTATION,
width: 1920,
height: 1080,
status: 'completed',
objectCount: 2,
assignedTo: { id: 'mem-hl', name: 'Hà Linh', role: 'annotator' },
reviewerName: 'Minh Anh',
},
{
id: 'urban-img-328',
projectId: 'urban_vehicles_v2',
fileName: 'urban_vehicle_00328.jpg',
url: THUMBNAIL_TRAFFIC_STREET,
thumbnailUrl: THUMBNAIL_TRAFFIC_STREET,
width: 1920,
height: 1080,
status: 'in_progress',
objectCount: 2,
assignedTo: { id: 'mem-tn', name: 'Tuấn Nam', role: 'annotator' },
submittedBy: 'Tuấn Nam',
savedAt: '5 phút trước',
},
{
id: 'img-321',
projectId: 'traffic_camera_v2',
@ -272,10 +385,10 @@ export function addProject(input: CreateProjectInput): Project {
: THUMBNAIL_STREET_SEGMENTATION,
updatedAt: 'Vừa tạo xong',
classes: [
{ id: 'cls-car', name: 'Ô tô', color: '#06B6D4', count: 0, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: '#F59E0B', count: 0, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: '#A855F7', count: 0, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: '#3B82F6', count: 0, shortcutKey: '4' },
{ id: 'cls-car', name: 'Ô tô', color: PROJECT_LABEL_COLORS.car, count: 0, shortcutKey: '1' },
{ id: 'cls-motorbike', name: 'Xe máy', color: PROJECT_LABEL_COLORS.motorbike, count: 0, shortcutKey: '2' },
{ id: 'cls-bus', name: 'Xe buýt', color: PROJECT_LABEL_COLORS.bus, count: 0, shortcutKey: '3' },
{ id: 'cls-truck', name: 'Xe tải', color: PROJECT_LABEL_COLORS.truck, count: 0, shortcutKey: '4' },
],
stats: {
totalImages: 0,

View file

@ -10,6 +10,7 @@
--brand-primary-hover: #b5492b;
--project-accent: #5451d6;
--project-accent-soft: #f1f3fe;
--project-accent-dot: #a29fff;
--project-canvas: #f5f6fa;
--project-surface: #ffffff;
--project-heading: #172033;
@ -18,17 +19,21 @@
--project-border: #e4e7ef;
--project-status-active-bg: #f5ded6;
--project-status-active-text: #5451d6;
--project-status-active-border: #f0cfc3;
--project-status-review-bg: #fff5df;
--project-status-review-text: #b57916;
--project-status-review-border: #f6e5bb;
--project-status-complete-bg: #e4f5ed;
--project-status-complete-text: #168262;
--project-status-complete-border: #c9eadb;
--project-status-draft-bg: #eef0f4;
--project-status-draft-text: #697386;
--project-status-draft-border: #e2e5eb;
--project-status-review-dot: #b57916;
--project-label-car: #16b9c9;
--project-label-bus: #ae7cff;
--project-label-motorbike: #10b981;
--project-label-truck: #3b82f6;
--project-label-motorbike: #f5be51;
--project-label-truck: #648bf3;
--project-avatar-background: #f5ded6;
/* Màu chữ (Typography) */
@ -55,21 +60,15 @@
}
}
.project-list-main {
.project-workspace-main {
scrollbar-width: none;
overflow-y: visible;
overflow-y: auto;
}
.project-list-main::-webkit-scrollbar {
.project-workspace-main::-webkit-scrollbar {
display: none;
}
@media (max-width: 767px) {
.project-list-main {
overflow-y: auto;
}
}
/* Custom thin scrollbars */
::-webkit-scrollbar {
width: 6px;

View file

@ -1,8 +1,57 @@
import type React from 'react'
/**
* Bảng màu chuẩn theo thiết kế Figma (MVP Đăng nhập & Hệ thống)
* Đặt tên tường minh theo ngữ cảnh sử dụng để dễ đọc và bảo trì.
*/
export const LOGIN_COLORS = {
// Màu thương hiệu chính
brandOrangeRed: '#c75c4a',
brandOrangeRedHover: '#b5492b',
brandAccentIndigo: '#5451d6',
// Màu nền (Backgrounds)
bgWhite: '#ffffff',
bgPreviewCard: '#f8f9fa',
// Màu chữ (Typography)
textLeftPrimary: '#141c2a', // Chữ chính cột giới thiệu bên trái
textRightPrimary: '#172033', // Chữ chính cột form đăng nhập bên phải
textSecondary: '#697386', // Chữ phụ, mô tả, ghi chú
textMuted: '#939bad', // Chữ mờ ở thanh phân cách "hoặc sử dụng email"
textOnBrand: '#ffffff', // Chữ trắng trên nền nút chính
// Màu đường viền (Borders / Outlines)
borderPreviewCard: '#3b465e', // Viền khung thẻ minh họa giao thông
borderControl: '#e4e7ef', // Viền ô nhập liệu, nút SSO, đường kẻ ngang
// Màu nhãn Bounding Box trên ảnh minh họa
boundingBox: {
carCyan: '#16b9c9', // Nhãn "Ô tô"
busPurple: '#ae7cff', // Nhãn "Xe buýt"
},
} as const
/**
* Hàm tạo style đường viền trong (inset outline) thay cho cú pháp Tailwind khó đọc
* như `[outline:1px_solid_#e4e7ef] [outline-offset:-1px]`
*/
export function createInsetOutlineStyle(
borderColor: string,
borderWidthPx: number = 1
): React.CSSProperties {
return {
outline: `${borderWidthPx}px solid ${borderColor}`,
outlineOffset: `-${borderWidthPx}px`,
}
}
export const themeTokens = {
colors: {
brand: {
primary: '#C95C3C',
primaryHover: '#B5492B',
primary: LOGIN_COLORS.brandOrangeRed,
primaryHover: LOGIN_COLORS.brandOrangeRedHover,
accent: LOGIN_COLORS.brandAccentIndigo,
light: '#FDF4F1',
border: '#F0AE99',
},
@ -13,11 +62,10 @@ export const themeTokens = {
completed: { bg: '#DCFCE7', text: '#15803D', dot: '#22C55E' },
},
labels: {
car: '#06B6D4', // Cyan - Ô tô
motorbike: '#F59E0B', // Amber - Xe máy
bus: '#A855F7', // Purple - Xe buýt
truck: '#3B82F6', // Blue - Xe tải
car: LOGIN_COLORS.boundingBox.carCyan, // Cyan - Ô tô (#16b9c9)
motorbike: '#F59E0B', // Amber - Xe máy
bus: LOGIN_COLORS.boundingBox.busPurple, // Purple - Xe buýt (#ae7cff)
truck: '#3B82F6', // Blue - Xe tải
},
},
} as const

View file

@ -1,38 +1,74 @@
/**
* Bảng màu mặc định cho các lớp nhãn (Annotation Classes)
*/
export const DEFAULT_CLASS_COLOR = '#16B9C9'
export const CLASS_COLORS: string[] = [
'#3B82F6', // Ô tô - Blue
'#16B9C9', // Ô tô - Cyan (theo thiết kế Figma)
'#AE7CFF', // Xe buýt - Purple (theo thiết kế Figma)
'#10B981', // Xe máy - Emerald
'#F59E0B', // Xe buýt - Amber
'#A855F7', // Xe tải - Purple
'#F59E0B', // Xe tải - Amber
'#3B82F6', // Xe khách - Blue
'#EC4899', // Người đi bộ - Pink
'#06B6D4', // Xe đạp - Cyan
'#EF4444', // Biển báo - Red
'#84CC16', // Đèn tín hiệu - Lime
]
const NAMED_CLASS_COLORS: Record<string, string> = {
'ô tô': '#3B82F6',
/**
* Bảng ánh xạ tên nhãn tiếng Việt sang mã màu cố định
*/
export const NAMED_CLASS_COLORS: Record<string, string> = {
'ô tô': '#16B9C9',
'xe buýt': '#AE7CFF',
'xe máy': '#10B981',
'xe buýt': '#F59E0B',
'xe tải': '#A855F7',
'xe tải': '#F59E0B',
'người đi bộ': '#EC4899',
'xe đạp': '#06B6D4',
}
/**
* Lấy màu dựa theo số thứ tự (index) trong danh sách CLASS_COLORS.
* Tự động xoay vòng nếu số thứ tự vượt quá độ dài bảng màu.
*/
export function getColorByClassIndex(index: number): string {
const safeIndex = Math.abs(index) % CLASS_COLORS.length
return CLASS_COLORS[safeIndex] ?? DEFAULT_CLASS_COLOR
}
/**
* Tính mã băm (hash) dương từ chuỗi tên để chọn màu cố định cho tên nhãn bất kỳ.
*/
function calculateStringHash(text: string): number {
let hashValue = 0
for (let i = 0; i < text.length; i++) {
const charCode = text.charCodeAt(i)
hashValue = (hashValue * 31 + charCode) | 0
}
return Math.abs(hashValue)
}
/**
* Lấy màu dựa theo tên lớp nhãn (ví dụ: "Ô tô", "Xe buýt").
* Nếu tên nhãn chưa được định nghĩa sẵn trong NAMED_CLASS_COLORS,
* hàm sẽ tự sinh màu cố định từ bảng CLASS_COLORS dựa trên tên nhãn.
*/
export function getColorByClassName(className: string): string {
const normalizedName = className.trim().toLowerCase()
if (NAMED_CLASS_COLORS[normalizedName]) {
return NAMED_CLASS_COLORS[normalizedName]
}
const colorIndex = calculateStringHash(normalizedName)
return getColorByClassIndex(colorIndex)
}
/**
* Hàm tổng hợp lấy màu cho lớp nhãn theo index (số) hoặc tên nhãn (chuỗi).
*/
export function getColorForClass(indexOrName: number | string): string {
if (typeof indexOrName === 'number') {
const idx = Math.abs(indexOrName) % CLASS_COLORS.length
return CLASS_COLORS[idx] ?? '#3B82F6'
return getColorByClassIndex(indexOrName)
}
const normalized = indexOrName.trim().toLowerCase()
if (NAMED_CLASS_COLORS[normalized]) {
return NAMED_CLASS_COLORS[normalized] ?? '#3B82F6'
}
let hash = 0
for (let i = 0; i < normalized.length; i++) {
hash = normalized.charCodeAt(i) + ((hash << 5) - hash)
}
const idx = Math.abs(hash) % CLASS_COLORS.length
return CLASS_COLORS[idx] ?? '#3B82F6'
return getColorByClassName(indexOrName)
}