feat: add dataset import and upload flow
This commit is contained in:
parent
e010bb5558
commit
7352228c60
33 changed files with 2161 additions and 252 deletions
|
|
@ -1,11 +1,33 @@
|
|||
import React from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useAuthStore } from '@/stores/authStore'
|
||||
import { showToast } from '../../../components/feedback/Toast'
|
||||
|
||||
const ROLE_LABELS: Record<string, string> = {
|
||||
admin: 'Quản trị viên',
|
||||
manager: 'Quản lý dự án',
|
||||
reviewer: 'Người kiểm duyệt',
|
||||
annotator: 'Người gán nhãn',
|
||||
}
|
||||
|
||||
function initialsOf(name: string): string {
|
||||
const parts = name.trim().split(/\s+/)
|
||||
if (parts.length >= 2) {
|
||||
return `${parts[0]?.[0] ?? ''}${parts[parts.length - 1]?.[0] ?? ''}`.toUpperCase()
|
||||
}
|
||||
return (name.trim().slice(0, 2) || '??').toUpperCase()
|
||||
}
|
||||
|
||||
export const UserInfo: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProjectWorkspace = false }) => {
|
||||
const navigate = useNavigate()
|
||||
const user = useAuthStore((s) => s.user)
|
||||
const storeLogout = useAuthStore((s) => s.logout)
|
||||
|
||||
const displayName = user?.name ?? 'Người dùng'
|
||||
const displayRole = (user?.role && ROLE_LABELS[user.role]) || 'Thành viên'
|
||||
|
||||
const handleLogout = () => {
|
||||
storeLogout()
|
||||
showToast.success('Đã đăng xuất khỏi phiên làm việc')
|
||||
navigate('/login')
|
||||
}
|
||||
|
|
@ -36,14 +58,14 @@ export const UserInfo: React.FC<{ isProjectWorkspace?: boolean }> = ({ isProject
|
|||
<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 ${isProjectWorkspace ? 'h-[34px] w-[34px] bg-[#f5ded6] text-[11px] text-[#332926]' : 'h-8 w-8 bg-orange-100 text-xs text-slate-800'}`}>
|
||||
MA
|
||||
{initialsOf(displayName)}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div className={`truncate font-semibold ${isProjectWorkspace ? 'text-[12px] text-[#332926]' : 'text-xs text-slate-900'}`}>
|
||||
Minh Anh
|
||||
{displayName}
|
||||
</div>
|
||||
<div className={`truncate ${isProjectWorkspace ? 'text-[10px] text-[#332926]' : 'text-[11px] text-slate-500'}`}>
|
||||
Quản trị viên
|
||||
{displayRole}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue