mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:46:29 +00:00
Improve task views mobile responsiveness
This commit updates the task dashboard and assignment views for smaller screens by tightening spacing, improving text wrapping, and making filter/search controls responsive. It also refreshes the assignment detail layout with clearer date spans, team summaries, and switchable grid/list member views, while polishing client and assignment cards for better readability on mobile.
This commit is contained in:
@@ -43,23 +43,23 @@ export default async function ClientDetailPage({ params, searchParams }: Props)
|
||||
const filterAssignments = getFilteredAssignments(assignmentList, query, sortBy)
|
||||
|
||||
return (
|
||||
<div className="flex-1 space-y-8 p-6 sm:p-8 pt-6">
|
||||
<div className="flex-1 space-y-8 p-4 sm:p-8 pt-4 sm:pt-6">
|
||||
<div className="flex flex-col md:flex-row md:items-end justify-between gap-6">
|
||||
<div className="flex items-start gap-6">
|
||||
<div className="w-24 h-24 rounded-2xl overflow-hidden shadow-xl border-4 border-background">
|
||||
<div className="flex flex-col sm:flex-row items-start gap-4 sm:gap-6 min-w-0 flex-1">
|
||||
<div className="w-16 h-16 sm:w-24 sm:h-24 rounded-2xl overflow-hidden shadow-lg border-2 sm:border-4 border-background shrink-0">
|
||||
<LazyImage src={client.photo!} alt={client.name} className="w-full h-full object-cover" />
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<div className="space-y-1 min-w-0 flex-1">
|
||||
<Link href="/task">
|
||||
<Button variant="ghost" size="sm" className="p-0 h-auto hover:bg-transparent text-muted-foreground mb-2">
|
||||
<ArrowLeft className="w-4 h-4 mr-1" /> Back to Clients
|
||||
</Button>
|
||||
</Link>
|
||||
<h1 className="text-xl sm:text-4xl font-bold tracking-tight">{client.name}</h1>
|
||||
<p className="text-sm sm:text-lg text-muted-foreground">{client?.description || 'No description available for this client.'}</p>
|
||||
<h1 className="text-xl sm:text-3xl md:text-4xl font-bold tracking-tight wrap-break-word">{client.name}</h1>
|
||||
<p className="text-sm sm:text-base text-muted-foreground wrap-break-word">{client?.description || 'No description available for this client.'}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<div className="flex gap-3 w-full sm:w-auto">
|
||||
<Link href={`/task/client-detail/${client_id}/project-assignments`} className='w-full sm:w-max'>
|
||||
<Button className="gap-2 w-full">
|
||||
<Plus className="w-4 h-4" /> Create Project Assignment
|
||||
|
||||
+359
-88
@@ -12,10 +12,11 @@
|
||||
|
||||
import { useState, type ReactNode } from 'react';
|
||||
import Link from 'next/link';
|
||||
import dayjs from 'dayjs';
|
||||
import { motion, useReducedMotion } from 'motion/react';
|
||||
import {
|
||||
ArrowLeft, Briefcase, CalendarDays, ChevronDown, ExternalLink, FileText, FolderGit2,
|
||||
History, Mail, Phone, UserPlus, Users,
|
||||
ArrowLeft, Briefcase, Calendar, CalendarDays, ChevronDown, Clock, ExternalLink, FileText,
|
||||
FolderGit2, History, LayoutGrid, List, Mail, Phone, UserPlus, Users,
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -32,33 +33,32 @@ interface Props {
|
||||
initialAssignment: IProjectAssignment;
|
||||
}
|
||||
|
||||
const TEAM_PREVIEW_LIMIT = 6;
|
||||
const TEAM_PREVIEW_LIMIT = 5;
|
||||
|
||||
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
|
||||
/** Deterministic dd Mon yyyy, avoids locale differences between server and browser. */
|
||||
function formatAssignmentDate(dateStr?: string | null) {
|
||||
if (!dateStr) return 'N/A';
|
||||
const d = new Date(dateStr);
|
||||
if (isNaN(d.getTime())) return 'N/A';
|
||||
return `${String(d.getDate()).padStart(2, '0')} ${MONTHS[d.getMonth()]} ${d.getFullYear()}`;
|
||||
const d = dayjs(dateStr);
|
||||
return d.isValid() ? d.format('DD MMM YYYY') : 'N/A';
|
||||
}
|
||||
|
||||
function diffInDays(start?: string | null, end?: string | null) {
|
||||
/** Human span between two dates, e.g. "2 months 15 days". Null when either date is missing or invalid. */
|
||||
function formatSpan(start?: string | null, end?: string | null) {
|
||||
if (!start || !end) return null;
|
||||
const s = new Date(start);
|
||||
const e = new Date(end);
|
||||
if (isNaN(s.getTime()) || isNaN(e.getTime())) return null;
|
||||
return Math.max(0, Math.round((e.getTime() - s.getTime()) / 86_400_000));
|
||||
}
|
||||
|
||||
function pluralDays(n: number) {
|
||||
return `${n} ${n === 1 ? 'day' : 'days'}`;
|
||||
const s = dayjs(start).startOf('day');
|
||||
const e = dayjs(end).startOf('day');
|
||||
if (!s.isValid() || !e.isValid() || e.isBefore(s)) return null;
|
||||
const months = e.diff(s, 'month');
|
||||
const days = e.diff(s.add(months, 'month'), 'day');
|
||||
const parts: string[] = [];
|
||||
if (months > 0) parts.push(`${months} ${months === 1 ? 'month' : 'months'}`);
|
||||
if (days > 0) parts.push(`${days} ${days === 1 ? 'day' : 'days'}`);
|
||||
return parts.length ? parts.join(' ') : 'Same day';
|
||||
}
|
||||
|
||||
export default function AssignmentDetail({ client, initialAssignment: assignment }: Props) {
|
||||
const [action, setAction] = useState<'MANAGE_EMPLOYEE' | 'UPDATE_STATUS' | undefined>();
|
||||
const [showAllTeam, setShowAllTeam] = useState(false);
|
||||
const [teamView, setTeamView] = useState<'grid' | 'list'>('grid');
|
||||
|
||||
const isWorkOrder = !!assignment.wo_name;
|
||||
const assignmentType = isWorkOrder ? 'Work Order' : 'Internal Memo';
|
||||
@@ -83,13 +83,15 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
const statusHistory = assignment.project_assignment_status_detail?.filter(s => s.start_date) ?? [];
|
||||
const currentEntry = statusHistory.find(s => !s.end_date) ?? statusHistory[0];
|
||||
|
||||
const duration = diffInDays(assignmentStartDate, assignmentEndDate);
|
||||
const duration = formatSpan(assignmentStartDate, assignmentEndDate);
|
||||
const positionCount = new Set(team.map(m => m.user?.position?.name).filter(Boolean)).size;
|
||||
const activeTeamCount = team.filter(m => !m.end_date || !dayjs(m.end_date).endOf('day').isBefore(dayjs())).length;
|
||||
|
||||
const handleClose = () => setAction(undefined);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mx-auto w-full max-w-7xl flex-1 space-y-6 p-6 pt-6 sm:p-8">
|
||||
<div className="mx-auto w-full max-w-7xl flex-1 space-y-6 p-4 pt-4 sm:p-8 sm:pt-6">
|
||||
<Reveal>
|
||||
<Link
|
||||
href={clientHref}
|
||||
@@ -128,12 +130,12 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<h1 id="assignment-title" className="text-balance text-2xl font-semibold tracking-tight text-foreground md:text-3xl">
|
||||
<h1 id="assignment-title" className="text-balance text-2xl font-semibold tracking-tight text-foreground md:text-3xl wrap-break-word">
|
||||
{assignmentName}
|
||||
</h1>
|
||||
|
||||
{assignmentDesc ? (
|
||||
<p className="max-w-[65ch] text-sm leading-relaxed text-muted-foreground">
|
||||
<p className="max-w-[65ch] text-sm leading-relaxed text-muted-foreground wrap-break-word">
|
||||
{assignmentDesc}
|
||||
</p>
|
||||
) : null}
|
||||
@@ -152,7 +154,7 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
<dl className="mt-7 grid grid-cols-2 gap-x-6 gap-y-5 border-t border-border/70 pt-6 sm:grid-cols-4">
|
||||
<Fact label="Start" value={formatAssignmentDate(assignmentStartDate)} />
|
||||
<Fact label="End" value={formatAssignmentDate(assignmentEndDate)} />
|
||||
<Fact label="Duration" value={duration === null ? 'N/A' : pluralDays(duration)} />
|
||||
<Fact label="Duration" value={duration ?? 'N/A'} />
|
||||
<Fact label="Team" value={team.length === 1 ? '1 person' : `${team.length} people`} />
|
||||
</dl>
|
||||
</section>
|
||||
@@ -184,27 +186,40 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
<div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-border bg-muted/40 text-muted-foreground transition-colors group-hover:text-his">
|
||||
<FolderGit2 className="h-5 w-5" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1 space-y-1.5">
|
||||
<div className="flex flex-wrap items-center gap-x-2.5 gap-y-1">
|
||||
<p className="font-medium text-foreground transition-colors group-hover:text-his">
|
||||
<div className="min-w-0 flex-1 space-y-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<p className="font-semibold text-foreground transition-colors group-hover:text-his">
|
||||
{assignment.project.name}
|
||||
</p>
|
||||
<ExternalLink className="h-4 w-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-his" />
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{assignment.project.code ? (
|
||||
<span className="font-mono text-xs text-muted-foreground">{assignment.project.code}</span>
|
||||
<span className="inline-flex items-center rounded-md border border-border/80 bg-muted/60 px-2 py-0.5 font-mono text-xs font-medium text-foreground/90">
|
||||
<span className="mr-0.5 text-muted-foreground">#</span>
|
||||
{assignment.project.code}
|
||||
</span>
|
||||
) : null}
|
||||
{assignment.project.year ? (
|
||||
<span className="text-xs text-muted-foreground">Year {assignment.project.year}</span>
|
||||
<span className="inline-flex items-center gap-1 rounded-md border border-border/60 bg-muted/20 px-2 py-0.5 text-xs text-muted-foreground">
|
||||
<Calendar className="h-3 w-3 text-muted-foreground/70" />
|
||||
<span>Year {assignment.project.year}</span>
|
||||
</span>
|
||||
) : null}
|
||||
{assignment.project.start_date || assignment.project.end_date ? (
|
||||
<span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<span className="text-muted-foreground/40" aria-hidden>·</span>
|
||||
<Clock className="h-3 w-3 text-muted-foreground/70" />
|
||||
<span>
|
||||
{formatAssignmentDate(assignment.project.start_date)} to {formatAssignmentDate(assignment.project.end_date)}
|
||||
</span>
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<p className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<CalendarDays className="h-3.5 w-3.5" />
|
||||
{formatAssignmentDate(assignment.project.start_date)} - {formatAssignmentDate(assignment.project.end_date)}
|
||||
</p>
|
||||
<p className="line-clamp-3 max-w-[65ch] text-sm leading-relaxed text-muted-foreground">
|
||||
{assignment.project.description || 'No description available.'}
|
||||
</p>
|
||||
</div>
|
||||
<ExternalLink className="mt-1 h-4 w-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-his" />
|
||||
</Link>
|
||||
</Surface>
|
||||
</Reveal>
|
||||
@@ -225,15 +240,49 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
title="Team"
|
||||
meta={team.length > 0 ? `${team.length}` : undefined}
|
||||
action={
|
||||
<Button
|
||||
onClick={() => setAction('MANAGE_EMPLOYEE')}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="gap-1.5 transition-transform active:scale-[0.98]"
|
||||
>
|
||||
<UserPlus className="h-4 w-4" />
|
||||
Manage team
|
||||
</Button>
|
||||
<div className="flex items-center gap-2">
|
||||
{team.length > 0 ? (
|
||||
<div className="flex items-center rounded-lg border border-border bg-muted/30 p-0.5 shadow-xs">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setTeamView('grid')}
|
||||
className={cn(
|
||||
'flex h-7 w-7 items-center justify-center rounded-md text-xs transition-colors',
|
||||
teamView === 'grid'
|
||||
? 'bg-his text-white shadow-xs'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
)}
|
||||
title="Grid cards"
|
||||
aria-label="Grid cards"
|
||||
>
|
||||
<LayoutGrid className="h-3.5 w-3.5" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setTeamView('list')}
|
||||
className={cn(
|
||||
'flex h-7 w-7 items-center justify-center rounded-md text-xs transition-colors',
|
||||
teamView === 'list'
|
||||
? 'bg-his text-white shadow-xs'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
)}
|
||||
title="Compact list"
|
||||
aria-label="Compact list"
|
||||
>
|
||||
<List className="h-3.5 w-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
<Button
|
||||
onClick={() => setAction('MANAGE_EMPLOYEE')}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="gap-1.5 transition-transform active:scale-[0.98]"
|
||||
>
|
||||
<UserPlus className="h-4 w-4" />
|
||||
Manage team
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{team.length === 0 ? (
|
||||
@@ -247,27 +296,63 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
Add people from the team directory to start tracking who works on this assignment.
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
onClick={() => setAction('MANAGE_EMPLOYEE')}
|
||||
size="sm"
|
||||
className="mt-2 gap-1.5 transition-transform active:scale-[0.98]"
|
||||
>
|
||||
<UserPlus className="h-4 w-4" />
|
||||
Assign member
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<ul className="grid gap-3 sm:grid-cols-2">
|
||||
{visibleTeam.map(member => (
|
||||
<TeamMember key={member.id} member={member} />
|
||||
))}
|
||||
</ul>
|
||||
<div className="space-y-4">
|
||||
{/* Team Overview Bar */}
|
||||
<div className="flex flex-col gap-2 rounded-xl border border-border/60 bg-muted/20 p-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<AvatarStack members={team} />
|
||||
<div className="min-w-0">
|
||||
<p className="text-xs font-medium text-foreground">
|
||||
{team.length} {team.length === 1 ? 'member assigned' : 'members assigned'}
|
||||
</p>
|
||||
<p className="text-[11px] text-muted-foreground">
|
||||
{activeTeamCount} active · {positionCount} {positionCount === 1 ? 'role' : 'roles'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<span className="font-mono text-[11px] text-muted-foreground/80">
|
||||
Viewing {visibleTeam.length} of {team.length}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Member Roster Display: Grid or List */}
|
||||
{teamView === 'grid' ? (
|
||||
<ul className="grid gap-3 sm:grid-cols-2">
|
||||
{visibleTeam.map(member => (
|
||||
<TeamCard key={member.id} member={member} />
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<ul className="divide-y divide-border/60 overflow-hidden rounded-xl border border-border/80 bg-card">
|
||||
{visibleTeam.map(member => (
|
||||
<TeamRow key={member.id} member={member} />
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{team.length > TEAM_PREVIEW_LIMIT ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setShowAllTeam(v => !v)}
|
||||
className="mt-3 gap-1.5 text-muted-foreground"
|
||||
className="gap-1.5 text-muted-foreground transition-colors hover:text-foreground"
|
||||
aria-expanded={showAllTeam}
|
||||
>
|
||||
<ChevronDown className={cn('h-4 w-4 transition-transform duration-300', showAllTeam && 'rotate-180')} />
|
||||
{showAllTeam ? 'Show fewer' : `Show ${hiddenTeamCount} more`}
|
||||
{showAllTeam ? 'Show fewer' : `Show ${hiddenTeamCount} more members`}
|
||||
</Button>
|
||||
) : null}
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
</Surface>
|
||||
</Reveal>
|
||||
@@ -281,16 +366,16 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
No status changes recorded yet. Use Update status to log the first one.
|
||||
</p>
|
||||
) : (
|
||||
<ol className="relative space-y-6 before:absolute before:bottom-2 before:left-[7px] before:top-2 before:w-px before:bg-border">
|
||||
<ol className="relative space-y-6 before:absolute before:bottom-2 before:left-1.75 before:top-2 before:w-px before:bg-border">
|
||||
{statusHistory.map(entry => {
|
||||
const isCurrent = entry.id === currentEntry?.id;
|
||||
const days = diffInDays(entry.start_date, entry.end_date);
|
||||
const span = formatSpan(entry.start_date, entry.end_date);
|
||||
return (
|
||||
<li key={entry.id} className="relative pl-7">
|
||||
<span
|
||||
aria-hidden
|
||||
className={cn(
|
||||
'absolute left-0 top-1 h-[15px] w-[15px] rounded-full border-[3px] border-card',
|
||||
'absolute left-0 top-1 h-3.75 w-3.75 rounded-full border-[3px] border-card',
|
||||
isCurrent ? 'bg-his' : 'bg-muted-foreground/40'
|
||||
)}
|
||||
/>
|
||||
@@ -307,8 +392,8 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
<p className="mt-1.5 font-mono text-xs text-muted-foreground">
|
||||
{formatAssignmentDate(entry.start_date)} - {entry.end_date ? formatAssignmentDate(entry.end_date) : 'Present'}
|
||||
</p>
|
||||
{days !== null ? (
|
||||
<p className="mt-0.5 text-xs text-muted-foreground/80">{pluralDays(days)}</p>
|
||||
{span ? (
|
||||
<p className="mt-0.5 text-xs text-muted-foreground/80">{span}</p>
|
||||
) : null}
|
||||
</li>
|
||||
);
|
||||
@@ -427,45 +512,231 @@ function PartyRow({
|
||||
);
|
||||
}
|
||||
|
||||
function TeamMember({ member }: { member: ProjectAssignmentWorkOrderDetail }) {
|
||||
const user = member.user;
|
||||
const name = user?.fullname || user?.name || 'Unnamed member';
|
||||
function avatarSrc(user?: { avatar?: string | null }) {
|
||||
return user?.avatar ? `${process.env.BASE_URL_IMG}/${user.avatar}` : '/assets/no-avatar.jpg';
|
||||
}
|
||||
|
||||
function memberName(member: ProjectAssignmentWorkOrderDetail) {
|
||||
return member.user?.fullname || member.user?.name || 'Unnamed member';
|
||||
}
|
||||
|
||||
/** Overlapping avatars used in the team summary. */
|
||||
function AvatarStack({ members }: { members: ProjectAssignmentWorkOrderDetail[] }) {
|
||||
const shown = members.slice(0, 5);
|
||||
const extra = members.length - shown.length;
|
||||
return (
|
||||
<li className="flex min-w-0 items-start gap-3 rounded-xl border border-border/70 bg-muted/20 p-3 transition-colors hover:border-border hover:bg-muted/40">
|
||||
<LazyImage
|
||||
src={user?.avatar ? `${process.env.BASE_URL_IMG}/${user.avatar}` : '/assets/no-avatar.jpg'}
|
||||
alt={name}
|
||||
className="h-10 w-10 shrink-0 rounded-full border border-border"
|
||||
/>
|
||||
<div className="min-w-0 flex-1 space-y-1">
|
||||
<p className="truncate text-sm font-medium text-foreground">{name}</p>
|
||||
{user?.position?.name ? (
|
||||
<p className="truncate text-xs text-muted-foreground">{user.position.name}</p>
|
||||
) : null}
|
||||
<div className="flex flex-col gap-0.5 pt-0.5 text-xs text-muted-foreground">
|
||||
{user?.email ? (
|
||||
<a
|
||||
href={`mailto:${user.email}`}
|
||||
referrerPolicy="no-referrer"
|
||||
className="inline-flex min-w-0 items-center gap-1.5 transition-colors hover:text-his"
|
||||
<div className="flex items-center" aria-hidden>
|
||||
{shown.map((m, i) => (
|
||||
<LazyImage
|
||||
key={m.id}
|
||||
src={avatarSrc(m.user)}
|
||||
alt=""
|
||||
className={cn('h-8 w-8 shrink-0 rounded-full border-2 border-card bg-muted', i > 0 && '-ml-2')}
|
||||
/>
|
||||
))}
|
||||
{extra > 0 ? (
|
||||
<span className="-ml-2 flex h-8 min-w-8 shrink-0 items-center justify-center rounded-full border-2 border-card bg-muted px-1.5 font-mono text-[11px] font-medium text-muted-foreground">
|
||||
+{extra}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ContactButton({ href, label, children }: { href: string; label: string; children: ReactNode }) {
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
title={label}
|
||||
aria-label={label}
|
||||
referrerPolicy="no-referrer"
|
||||
className="flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground transition-all hover:bg-muted hover:text-his active:scale-[0.96]"
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
/** Grid view card for a team member */
|
||||
function TeamCard({ member }: { member: ProjectAssignmentWorkOrderDetail }) {
|
||||
const user = member.user;
|
||||
const name = memberName(member);
|
||||
const ended = !!member.end_date && dayjs(member.end_date).endOf('day').isBefore(dayjs());
|
||||
const span = formatSpan(member.start_date, member.end_date);
|
||||
const position = user?.position?.name;
|
||||
|
||||
return (
|
||||
<li
|
||||
className={cn(
|
||||
'group relative flex flex-col justify-between rounded-xl border border-border/80 bg-card p-4 transition-all duration-200 hover:border-border hover:shadow-xs',
|
||||
ended && 'bg-muted/10 opacity-75'
|
||||
)}
|
||||
>
|
||||
{/* Top row: Avatar + Identity + Status */}
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="relative shrink-0">
|
||||
<LazyImage
|
||||
src={avatarSrc(user)}
|
||||
alt={name}
|
||||
className={cn(
|
||||
'h-11 w-11 rounded-full border border-border bg-muted',
|
||||
ended && 'grayscale'
|
||||
)}
|
||||
/>
|
||||
<span
|
||||
aria-label={ended ? 'Ended' : 'Active'}
|
||||
className={cn(
|
||||
'absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-card',
|
||||
ended ? 'bg-muted-foreground/50' : 'bg-emerald-500'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center justify-between gap-1.5">
|
||||
<p className="truncate text-sm font-semibold text-foreground transition-colors group-hover:text-his">
|
||||
{name}
|
||||
</p>
|
||||
<span
|
||||
className={cn(
|
||||
'shrink-0 rounded-md px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase',
|
||||
ended
|
||||
? 'bg-muted text-muted-foreground'
|
||||
: 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-400'
|
||||
)}
|
||||
>
|
||||
<Mail className="h-3 w-3 shrink-0" />
|
||||
<span className="truncate">{user.email}</span>
|
||||
</a>
|
||||
) : null}
|
||||
{user?.phone_number ? (
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<Phone className="h-3 w-3 shrink-0" />
|
||||
<span className="font-mono">{user.phone_number}</span>
|
||||
{ended ? 'Ended' : 'Active'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p className="mt-0.5 truncate text-xs font-medium text-muted-foreground">
|
||||
{position || 'Team Member'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Middle row: Assignment Period & Duration pill */}
|
||||
<div className="mt-3.5 rounded-lg border border-border/50 bg-muted/20 px-2.5 py-1.5 text-xs">
|
||||
<div className="flex flex-wrap items-center justify-between gap-1.5">
|
||||
<span className="inline-flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground">
|
||||
<Calendar className="h-3 w-3 shrink-0 text-muted-foreground/70" />
|
||||
<span className="truncate">
|
||||
{member.start_date ? formatAssignmentDate(member.start_date) : 'N/A'} - {member.end_date ? formatAssignmentDate(member.end_date) : 'Present'}
|
||||
</span>
|
||||
</span>
|
||||
{span ? (
|
||||
<span className="shrink-0 font-medium text-[11px] text-foreground/80">
|
||||
{span}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
{member.start_date ? (
|
||||
<p className="pt-1 font-mono text-[11px] text-muted-foreground/80">
|
||||
{formatAssignmentDate(member.start_date)} - {member.end_date ? formatAssignmentDate(member.end_date) : 'Open'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Bottom row: Direct Actions & Contact */}
|
||||
<div className="mt-3.5 flex items-center justify-between border-t border-border/60 pt-2.5 text-xs">
|
||||
{user?.email ? (
|
||||
<a
|
||||
href={`mailto:${user.email}`}
|
||||
referrerPolicy="no-referrer"
|
||||
title={`Email ${user.email}`}
|
||||
className="group/mail inline-flex min-w-0 flex-1 items-center gap-1.5 truncate text-muted-foreground transition-colors hover:text-his"
|
||||
>
|
||||
<Mail className="h-3.5 w-3.5 shrink-0 text-muted-foreground/70 group-hover/mail:text-his" />
|
||||
<span className="truncate text-[11px]">{user.email}</span>
|
||||
</a>
|
||||
) : (
|
||||
<span className="text-[11px] text-muted-foreground/50">No email</span>
|
||||
)}
|
||||
|
||||
{user?.phone_number ? (
|
||||
<a
|
||||
href={`tel:${user.phone_number}`}
|
||||
referrerPolicy="no-referrer"
|
||||
title={`Call ${user.phone_number}`}
|
||||
className="group/phone inline-flex shrink-0 items-center gap-1 font-mono text-[11px] text-muted-foreground transition-colors hover:text-his"
|
||||
>
|
||||
<Phone className="h-3.5 w-3.5 shrink-0 text-muted-foreground/70 group-hover/phone:text-his" />
|
||||
<span>{user.phone_number}</span>
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
/** List view row for a team member */
|
||||
function TeamRow({ member }: { member: ProjectAssignmentWorkOrderDetail }) {
|
||||
const user = member.user;
|
||||
const name = memberName(member);
|
||||
const ended = !!member.end_date && dayjs(member.end_date).endOf('day').isBefore(dayjs());
|
||||
const span = formatSpan(member.start_date, member.end_date);
|
||||
const position = user?.position?.name;
|
||||
|
||||
return (
|
||||
<li
|
||||
className={cn(
|
||||
'group flex flex-col gap-3 p-3.5 transition-colors hover:bg-muted/30 sm:flex-row sm:items-center sm:justify-between',
|
||||
ended && 'opacity-75'
|
||||
)}
|
||||
>
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
<div className="relative shrink-0">
|
||||
<LazyImage
|
||||
src={avatarSrc(user)}
|
||||
alt={name}
|
||||
className={cn('h-10 w-10 rounded-full border border-border bg-muted', ended && 'grayscale')}
|
||||
/>
|
||||
<span
|
||||
aria-label={ended ? 'Ended' : 'Active'}
|
||||
className={cn(
|
||||
'absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-card',
|
||||
ended ? 'bg-muted-foreground/50' : 'bg-emerald-500'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<p className="truncate text-sm font-semibold text-foreground transition-colors group-hover:text-his">
|
||||
{name}
|
||||
</p>
|
||||
<span
|
||||
className={cn(
|
||||
'rounded-md px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase',
|
||||
ended
|
||||
? 'bg-muted text-muted-foreground'
|
||||
: 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-400'
|
||||
)}
|
||||
>
|
||||
{ended ? 'Ended' : 'Active'}
|
||||
</span>
|
||||
</div>
|
||||
<p className="truncate text-xs text-muted-foreground">{position || 'Team Member'}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 sm:justify-end sm:pl-0">
|
||||
<div className="text-left sm:text-right">
|
||||
<p className="font-mono text-[11px] text-muted-foreground">
|
||||
{member.start_date ? formatAssignmentDate(member.start_date) : 'N/A'} - {member.end_date ? formatAssignmentDate(member.end_date) : 'Present'}
|
||||
</p>
|
||||
{span ? (
|
||||
<p className="text-[11px] font-medium text-foreground/80">{span}</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-1">
|
||||
{user?.email ? (
|
||||
<ContactButton href={`mailto:${user.email}`} label={`Email ${user.email}`}>
|
||||
<Mail className="h-3.5 w-3.5" />
|
||||
</ContactButton>
|
||||
) : null}
|
||||
{user?.phone_number ? (
|
||||
<ContactButton href={`tel:${user.phone_number}`} label={`Call ${user.phone_number}`}>
|
||||
<Phone className="h-3.5 w-3.5" />
|
||||
</ContactButton>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -88,13 +88,13 @@ const FilterComponent: FC<Props> = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='flex flex-col sm:flex-row justify-between items-center gap-5'>
|
||||
<div className='flex flex-col sm:flex-row items-center gap-5 w-full sm:w-auto'>
|
||||
<div className="relative w-full sm:w-64">
|
||||
<div className='flex flex-col md:flex-row justify-between items-stretch md:items-center gap-3 md:gap-5 w-full'>
|
||||
<div className='flex items-center gap-2.5 w-full md:w-auto'>
|
||||
<div className="relative flex-1 sm:w-64 sm:flex-none">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder="Search..."
|
||||
className="pl-10 w-full bg-white dark:bg-zinc-900"
|
||||
className="pl-9 w-full bg-white dark:bg-zinc-900 h-9"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
/>
|
||||
@@ -109,7 +109,7 @@ const FilterComponent: FC<Props> = ({
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className='flex items-center gap-3 w-full sm:w-auto justify-end'>
|
||||
<div className='flex items-center gap-2.5 w-full md:w-auto justify-between md:justify-end'>
|
||||
{showLayoutToggle ? (
|
||||
<div className="flex items-center p-0.5 bg-muted/60 dark:bg-zinc-800/80 rounded-lg border border-border shrink-0">
|
||||
<Button
|
||||
@@ -145,7 +145,7 @@ const FilterComponent: FC<Props> = ({
|
||||
|
||||
{!hideSort ? (
|
||||
<Select value={currentSort} onValueChange={handleSortChange}>
|
||||
<SelectTrigger className="w-full sm:w-auto md:w-max bg-white dark:bg-zinc-900">
|
||||
<SelectTrigger className="flex-1 md:flex-none md:w-max min-w-32.5 bg-white dark:bg-zinc-900 h-9 text-xs sm:text-sm">
|
||||
<SelectValue placeholder="Sort by" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
|
||||
@@ -158,12 +158,12 @@ export const FilterModal: FC<Props> = ({ hideClient = true, hideEndUser = true,
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button variant="outline" className='dark:bg-zinc-900'>
|
||||
<ListFilter className='mr-1' /> Filter
|
||||
<Badge variant='secondary' className="ml-2">{activeFilterCount}</Badge>
|
||||
<Button variant="outline" className='dark:bg-zinc-900 shrink-0 h-9 px-3 gap-1.5'>
|
||||
<ListFilter className='w-4 h-4' /> Filter
|
||||
<Badge variant='secondary' className="ml-1 px-1.5 py-0 text-[10px]">{activeFilterCount}</Badge>
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align='start' forceMount className='w-full sm:w-95 px-0'>
|
||||
<PopoverContent align='start' forceMount className='w-[calc(100vw-2rem)] max-w-sm sm:w-96 px-0'>
|
||||
<CardHeader>
|
||||
<CardTitle>Filter</CardTitle>
|
||||
<CardDescription>Apply filters to customize the data shown.</CardDescription>
|
||||
|
||||
@@ -39,9 +39,9 @@ export default function HomeTask({ currentView }: ShellProps) {
|
||||
Something that can be done at any time is often done at no time.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex flex-col sm:flex-row items-stretch sm:items-center gap-2.5 sm:gap-3 w-full md:w-auto">
|
||||
<Select value={currentView} onValueChange={handleTabChange}>
|
||||
<SelectTrigger className="w-full md:w-max bg-white dark:bg-zinc-900">
|
||||
<SelectTrigger className="w-full sm:w-44 md:w-max bg-white dark:bg-zinc-900">
|
||||
<SelectValue placeholder="Show by" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
@@ -53,12 +53,12 @@ export default function HomeTask({ currentView }: ShellProps) {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{currentView === 'clients' ?
|
||||
<Button className="gap-2" onClick={() => setShowForm(true)}>
|
||||
<Button className="gap-2 w-full sm:w-auto shrink-0" onClick={() => setShowForm(true)}>
|
||||
<Plus className="w-4 h-4" /> Add Client
|
||||
</Button>
|
||||
:
|
||||
<Link href='task/project-assignment'>
|
||||
<Button className="gap-2">
|
||||
<Link href='task/project-assignment' className="w-full sm:w-auto shrink-0">
|
||||
<Button className="gap-2 w-full sm:w-auto">
|
||||
<Plus className="w-4 h-4" /> Create Project Assignment
|
||||
</Button>
|
||||
</Link>
|
||||
|
||||
@@ -71,7 +71,7 @@ export default function ClientGrid({ clients, onEdit, onDelete }: ClientGridProp
|
||||
</span>
|
||||
</button>
|
||||
</HoverCardTrigger>
|
||||
<HoverCardContent side="bottom" align='end' className="flex flex-col gap-0.5 text-sm w-68">
|
||||
<HoverCardContent side="bottom" align='end' className="flex flex-col gap-0.5 text-sm w-[calc(100vw-3rem)] max-w-xs sm:w-72">
|
||||
<div className="font-semibold">Status Summary</div>
|
||||
<div className="text-xs text-muted-foreground">This is status summary information from WO or IM related to this client.</div>
|
||||
<div className='flex flex-col mt-4 gap-3 text-xs'>
|
||||
@@ -87,10 +87,10 @@ export default function ClientGrid({ clients, onEdit, onDelete }: ClientGridProp
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="p-5 flex flex-col flex-1 justify-between gap-4">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
<div className="p-4 sm:p-5 flex flex-col flex-1 justify-between gap-4 min-w-0">
|
||||
<div className="space-y-2 min-w-0">
|
||||
<div className="flex items-start justify-between gap-2 min-w-0">
|
||||
<div className="flex flex-wrap items-center gap-1.5 min-w-0 flex-1">
|
||||
{client.code && (
|
||||
<span className="text-[11px] font-mono font-medium px-2 py-0.5 rounded bg-accent text-accent-foreground border border-border/60 shrink-0">
|
||||
{client.code}
|
||||
@@ -98,7 +98,7 @@ export default function ClientGrid({ clients, onEdit, onDelete }: ClientGridProp
|
||||
)}
|
||||
<Link
|
||||
href={`/task/client-detail/${client.id}`}
|
||||
className="font-bold text-base sm:text-lg leading-tight text-foreground hover:text-primary transition-colors truncate"
|
||||
className="font-bold text-base sm:text-lg leading-tight text-foreground hover:text-primary transition-colors truncate min-w-0 max-w-full block"
|
||||
>
|
||||
{client.name}
|
||||
</Link>
|
||||
@@ -110,7 +110,7 @@ export default function ClientGrid({ clients, onEdit, onDelete }: ClientGridProp
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<p className="text-sm leading-relaxed text-muted-foreground line-clamp-3 h-16">
|
||||
<p className="text-xs sm:text-sm leading-relaxed text-muted-foreground line-clamp-3 min-h-[3.75rem] wrap-break-word">
|
||||
{projectCount === 0 && imCount === 0 && woCount === 0 ? (
|
||||
"No active projects, internal memos, or work orders recorded for this client yet."
|
||||
) : (
|
||||
|
||||
@@ -61,8 +61,8 @@ export default function ClientList({ clients, onEdit, onDelete }: ClientListProp
|
||||
{/* Middle Column: Details, Description, Metrics & Breakdown */}
|
||||
<div className="p-4 sm:p-5 flex-1 flex flex-col justify-between gap-3 min-w-0">
|
||||
{/* Header Row: Code + Name + Status */}
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="flex items-center gap-2.5 min-w-0">
|
||||
<div className="flex flex-wrap sm:flex-nowrap items-center justify-between gap-2.5 min-w-0">
|
||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
||||
{client.code && (
|
||||
<span className="text-xs font-mono font-medium px-2 py-0.5 rounded-md bg-accent text-accent-foreground border border-border/60 shrink-0">
|
||||
{client.code}
|
||||
@@ -70,7 +70,7 @@ export default function ClientList({ clients, onEdit, onDelete }: ClientListProp
|
||||
)}
|
||||
<Link
|
||||
href={`/task/client-detail/${client.id}`}
|
||||
className="font-semibold text-base sm:text-lg text-foreground hover:text-primary transition-colors tracking-tight truncate"
|
||||
className="font-semibold text-base sm:text-lg text-foreground hover:text-primary transition-colors tracking-tight truncate min-w-0"
|
||||
>
|
||||
{client.name}
|
||||
</Link>
|
||||
@@ -93,7 +93,7 @@ export default function ClientList({ clients, onEdit, onDelete }: ClientListProp
|
||||
</span>
|
||||
</button>
|
||||
</HoverCardTrigger>
|
||||
<HoverCardContent side="bottom" align="end" className="w-72 p-3 text-xs">
|
||||
<HoverCardContent side="bottom" align="end" className="w-[calc(100vw-3rem)] max-w-xs sm:w-72 p-3 text-xs">
|
||||
<div className="font-semibold text-foreground">Status Summary</div>
|
||||
<p className="text-muted-foreground mt-0.5">Status summary from WO or IM related to this client.</p>
|
||||
<div className="flex flex-col mt-3 gap-2">
|
||||
@@ -114,14 +114,14 @@ export default function ClientList({ clients, onEdit, onDelete }: ClientListProp
|
||||
</div>
|
||||
|
||||
{/* Description & Narrative */}
|
||||
<div className="space-y-1.5">
|
||||
<div className="space-y-1.5 min-w-0">
|
||||
{hasDescription && (
|
||||
<p className="text-xs sm:text-sm text-foreground/90 line-clamp-2 leading-relaxed">
|
||||
<p className="text-xs sm:text-sm text-foreground/90 line-clamp-2 leading-relaxed wrap-break-word">
|
||||
{client.description}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<p className="text-xs leading-relaxed text-muted-foreground line-clamp-2 pt-0.5">
|
||||
<p className="text-xs leading-relaxed text-muted-foreground line-clamp-2 pt-0.5 wrap-break-word">
|
||||
{projectCount === 0 && imCount === 0 && woCount === 0 ? (
|
||||
"No active projects, internal memos, or work orders recorded for this client yet."
|
||||
) : (
|
||||
|
||||
@@ -65,14 +65,14 @@ export default function AssignmentGrid({
|
||||
className="h-full"
|
||||
key={index}
|
||||
>
|
||||
<Card900 className="h-full group hover:border-his/50 transition-all duration-300 hover:shadow-xl hover:-translate-y-1 flex flex-col justify-between p-5 border-border/80 rounded-2xl bg-card gap-4">
|
||||
<Card900 className="h-full group hover:border-his/50 transition-all duration-300 hover:shadow-xl hover:-translate-y-1 flex flex-col justify-between p-4 sm:p-5 border-border/80 rounded-2xl bg-card gap-4 min-w-0">
|
||||
{/* Top Section: 3D Emblem, Badges, and Action Menu */}
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="flex items-center gap-3.5 min-w-0">
|
||||
<div className="flex items-start justify-between gap-2.5 min-w-0">
|
||||
<div className="flex items-center gap-3 min-w-0 flex-1">
|
||||
{/* 3D App Icon / Emblem */}
|
||||
<Link
|
||||
href={assignmentDetailUrl}
|
||||
className="relative w-14 h-14 sm:w-16 sm:h-16 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:scale-105 group-hover:border-his/40 transition-all duration-300"
|
||||
className="relative w-12 h-12 sm:w-16 sm:h-16 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:scale-105 group-hover:border-his/40 transition-all duration-300"
|
||||
>
|
||||
<LazyImage
|
||||
src={illustrationSrc}
|
||||
@@ -83,11 +83,11 @@ export default function AssignmentGrid({
|
||||
</Link>
|
||||
|
||||
{/* Identity & Badges */}
|
||||
<div className="min-w-0 space-y-1.5">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<div className="min-w-0 space-y-1.5 flex-1">
|
||||
<div className="flex items-center gap-1.5 flex-wrap">
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={`text-[10px] font-semibold tracking-wide px-2 py-0.5 gap-1 ${isProject
|
||||
className={`text-[10px] font-semibold tracking-wide px-2 py-0.5 gap-1 shrink-0 ${isProject
|
||||
? 'bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30'
|
||||
: 'bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/30'
|
||||
}`}
|
||||
@@ -99,11 +99,11 @@ export default function AssignmentGrid({
|
||||
{assignmentStatus && <BadgeStatus status={assignmentStatus} />}
|
||||
</div>
|
||||
|
||||
{assignmentCode &&
|
||||
<span className="text-[11px] font-mono font-semibold px-2 py-0.5 rounded-md bg-muted/80 dark:bg-zinc-800 text-muted-foreground border border-border/60 shrink-0">
|
||||
{assignmentCode && (
|
||||
<span className="inline-block text-[11px] font-mono font-semibold px-2 py-0.5 rounded-md bg-muted/80 dark:bg-zinc-800 text-muted-foreground border border-border/60 shrink-0 truncate max-w-full">
|
||||
# {assignmentCode}
|
||||
</span>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -161,12 +161,12 @@ export default function AssignmentGrid({
|
||||
</div>
|
||||
|
||||
{/* Center: Title, Project, Description, Tags */}
|
||||
<div className="space-y-2.5 flex-1">
|
||||
<div className="space-y-2.5 flex-1 min-w-0">
|
||||
{/* Title */}
|
||||
<div>
|
||||
<Link
|
||||
href={assignmentDetailUrl}
|
||||
className="font-bold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block line-clamp-2 tracking-tight"
|
||||
className="font-bold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block line-clamp-2 tracking-tight wrap-break-word"
|
||||
>
|
||||
{assignmentName}
|
||||
</Link>
|
||||
@@ -174,54 +174,54 @@ export default function AssignmentGrid({
|
||||
|
||||
{/* Project Reference */}
|
||||
{assignment.project?.name && (
|
||||
<div className="flex items-center gap-1.5 text-xs text-muted-foreground pt-0.5">
|
||||
<div className="flex items-center gap-1.5 text-xs text-muted-foreground pt-0.5 min-w-0">
|
||||
<FolderGit2 className="w-3.5 h-3.5 text-his shrink-0" />
|
||||
<span className="text-[11px] text-muted-foreground">Project:</span>
|
||||
<span className="text-[11px] text-muted-foreground shrink-0">Project:</span>
|
||||
{projectDetailUrl ? (
|
||||
<Link
|
||||
href={projectDetailUrl}
|
||||
className="font-medium text-foreground hover:text-his truncate hover:underline flex items-center gap-1"
|
||||
className="font-medium text-foreground hover:text-his truncate hover:underline flex items-center gap-1 min-w-0"
|
||||
>
|
||||
<span className="truncate">{assignment.project.name}</span>
|
||||
<ExternalLink className="w-3 h-3 shrink-0 opacity-60" />
|
||||
</Link>
|
||||
) : (
|
||||
<span className="font-medium text-foreground truncate">{assignment.project.name}</span>
|
||||
<span className="font-medium text-foreground truncate min-w-0">{assignment.project.name}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Description */}
|
||||
{assignmentDesc && (
|
||||
<p className="text-xs text-muted-foreground line-clamp-2 leading-relaxed pt-0.5">
|
||||
<p className="text-xs text-muted-foreground line-clamp-2 leading-relaxed pt-0.5 wrap-break-word">
|
||||
{assignmentDesc}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* Client & End User Badges */}
|
||||
<div className="flex flex-wrap items-center gap-2 pt-1 text-xs">
|
||||
<div className="flex flex-wrap items-center gap-1.5 pt-1 text-xs">
|
||||
{assignment.client?.name && !clientId && (
|
||||
<Link
|
||||
href={`/task/client-detail/${assignment.client.id}`}
|
||||
className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/60 hover:bg-muted border border-border/50 text-foreground transition-colors text-[11px]"
|
||||
className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/60 hover:bg-muted border border-border/50 text-foreground transition-colors text-[11px] max-w-full min-w-0"
|
||||
>
|
||||
{assignment.client.photo ?
|
||||
<LazyImage
|
||||
src={assignment.client.photo}
|
||||
alt={assignment.client.name}
|
||||
className="w-3 h-3 rounded-xs bg-transparent"
|
||||
className="w-3 h-3 rounded-xs bg-transparent shrink-0"
|
||||
imgClassName="object-cover"
|
||||
/>
|
||||
:
|
||||
<BuildingComplex className="w-3 h-3 text-muted-foreground" />
|
||||
<BuildingComplex className="w-3 h-3 text-muted-foreground shrink-0" />
|
||||
}
|
||||
<span className="text-muted-foreground">Client:</span>
|
||||
<span className="font-medium truncate max-w-50">{assignment.client.name}</span>
|
||||
<span className="text-muted-foreground shrink-0">Client:</span>
|
||||
<span className="font-medium truncate max-w-32.5 sm:max-w-45">{assignment.client.name}</span>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{assignment.end_user?.name && (
|
||||
<div className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/40 border border-border/40 text-foreground text-[11px]">
|
||||
<div className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/40 border border-border/40 text-foreground text-[11px] max-w-full min-w-0">
|
||||
<div className="w-3.5 h-3.5 rounded-xs overflow-hidden shrink-0 bg-secondary">
|
||||
{assignment.end_user?.photo ? (
|
||||
<LazyImage
|
||||
@@ -234,18 +234,18 @@ export default function AssignmentGrid({
|
||||
<Building className="w-3 h-3 text-muted-foreground" />
|
||||
)}
|
||||
</div>
|
||||
<span className="text-muted-foreground">End User:</span>
|
||||
<span className="font-medium truncate max-w-50">{assignment.end_user.name}</span>
|
||||
<span className="text-muted-foreground shrink-0">End User:</span>
|
||||
<span className="font-medium truncate max-w-32.5 sm:max-w-45">{assignment.end_user.name}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer: Timeline & Team Members */}
|
||||
<div className="pt-3.5 border-t border-border/60 flex items-center justify-between gap-3 text-xs">
|
||||
<div className="flex items-center gap-1.5 text-muted-foreground">
|
||||
<div className="pt-3.5 border-t border-border/60 flex flex-wrap sm:flex-nowrap items-center justify-between gap-2.5 text-xs">
|
||||
<div className="flex items-center gap-1.5 text-muted-foreground min-w-0 flex-1">
|
||||
<Calendar className="w-3.5 h-3.5 shrink-0 text-muted-foreground/80" />
|
||||
<span className="font-medium text-[11px]">
|
||||
<span className="font-medium text-[11px] truncate">
|
||||
{formatAssignmentDate(assignmentStartDate)} - {formatAssignmentDate(assignmentEndDate)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -74,13 +74,13 @@ export default function AssignmentList({
|
||||
className="w-full"
|
||||
key={index}
|
||||
>
|
||||
<Card900 className="group overflow-hidden hover:shadow-md transition-all duration-300 border-border/80 hover:border-his/40 rounded-2xl py-1 bg-card">
|
||||
<CardContent className="p-4 sm:p-5 flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
|
||||
<Card900 className="group overflow-hidden hover:shadow-md transition-all duration-300 border-border/80 hover:border-his/40 rounded-2xl py-1 bg-card min-w-0">
|
||||
<CardContent className="p-3.5 sm:p-5 flex flex-col md:flex-row items-start md:items-center justify-between gap-4 min-w-0">
|
||||
{/* Left: Thumbnail & Visual Indicator */}
|
||||
<div className="flex items-start gap-4 min-w-0 flex-1">
|
||||
<div className="flex items-start gap-3 sm:gap-4 min-w-0 flex-1 w-full">
|
||||
<Link
|
||||
href={assignmentDetailUrl}
|
||||
className="relative w-16 h-16 sm:w-20 sm:h-20 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:border-his/40 group-hover:scale-105 transition-all duration-300"
|
||||
className="relative w-12 h-12 sm:w-16 sm:h-16 md:w-20 md:h-20 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:border-his/40 group-hover:scale-105 transition-all duration-300"
|
||||
>
|
||||
<LazyImage
|
||||
src={illustrationSrc}
|
||||
@@ -93,10 +93,10 @@ export default function AssignmentList({
|
||||
{/* Center Details */}
|
||||
<div className="min-w-0 flex-1 space-y-1.5">
|
||||
{/* Line 1: Type Badge, Status, Code, and Project Reference */}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={`text-[10px] font-semibold px-2 py-0.5 gap-1 ${isProject
|
||||
className={`text-[10px] font-semibold px-2 py-0.5 gap-1 shrink-0 ${isProject
|
||||
? 'bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/30'
|
||||
: 'bg-purple-500/15 text-purple-700 dark:text-purple-400 border-purple-500/30'
|
||||
}`}
|
||||
@@ -112,65 +112,63 @@ export default function AssignmentList({
|
||||
# {assignmentCode}
|
||||
</span>
|
||||
) : null}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{/* Line 2: Assignment Title */}
|
||||
<div>
|
||||
<div className="min-w-0">
|
||||
<Link
|
||||
href={assignmentDetailUrl}
|
||||
className="font-semibold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block tracking-tight line-clamp-1 py-0.5"
|
||||
className="font-semibold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block tracking-tight line-clamp-2 sm:line-clamp-1 py-0.5 wrap-break-word"
|
||||
>
|
||||
{assignmentName}
|
||||
</Link>
|
||||
{assignment.project?.name && (
|
||||
<div className="flex items-center gap-1 text-xs text-muted-foreground ml-auto sm:ml-0 mt-2">
|
||||
<div className="flex items-center gap-1 text-xs text-muted-foreground mt-1 min-w-0">
|
||||
<FolderGit2 className="w-3.5 h-3.5 text-his shrink-0" />
|
||||
<span className="text-[11px] text-muted-foreground hidden sm:inline">Project:</span>
|
||||
<span className="text-[11px] text-muted-foreground hidden sm:inline shrink-0">Project:</span>
|
||||
{projectDetailUrl ? (
|
||||
<Link
|
||||
href={projectDetailUrl}
|
||||
className="font-medium text-foreground hover:text-his truncate hover:underline inline-block"
|
||||
className="font-medium text-foreground hover:text-his truncate hover:underline inline-block min-w-0"
|
||||
>
|
||||
{assignment.project.name}
|
||||
</Link>
|
||||
) : (
|
||||
<span className="font-medium text-foreground truncate">{assignment.project.name}</span>
|
||||
<span className="font-medium text-foreground truncate min-w-0">{assignment.project.name}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Line 3: Metadata, Client, End User, Timeline, Notes */}
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground pt-0.5">
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-muted-foreground pt-0.5 min-w-0">
|
||||
{assignment.client?.name && !clientId && (
|
||||
<Link
|
||||
href={`/task/client-detail/${assignment.client.id}`}
|
||||
className="flex items-center gap-1 text-[11px] font-medium text-foreground hover:text-his transition-colors"
|
||||
className="flex items-center gap-1 text-[11px] font-medium text-foreground hover:text-his transition-colors min-w-0"
|
||||
>
|
||||
<BuildingComplex className="w-3 h-3 text-muted-foreground" />
|
||||
<span className="text-muted-foreground">Client:</span>
|
||||
<span className="truncate max-w-50">{assignment.client.name}</span>
|
||||
<BuildingComplex className="w-3 h-3 text-muted-foreground shrink-0" />
|
||||
<span className="text-muted-foreground shrink-0">Client:</span>
|
||||
<span className="truncate max-w-32.5 sm:max-w-50">{assignment.client.name}</span>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{assignment.end_user?.name && (
|
||||
<div className="flex items-center gap-1 text-[11px] text-foreground">
|
||||
<span className="text-muted-foreground">End User:</span>
|
||||
<span className="font-medium truncate max-w-50">{assignment.end_user.name}</span>
|
||||
<div className="flex items-center gap-1 text-[11px] text-foreground min-w-0">
|
||||
<span className="text-muted-foreground shrink-0">End User:</span>
|
||||
<span className="font-medium truncate max-w-32.5 sm:max-w-50">{assignment.end_user.name}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex items-center gap-1 text-[11px] text-muted-foreground">
|
||||
<Calendar className="w-3.5 h-3.5 text-muted-foreground/80" />
|
||||
<div className="flex items-center gap-1 text-[11px] text-muted-foreground shrink-0">
|
||||
<Calendar className="w-3.5 h-3.5 text-muted-foreground/80 shrink-0" />
|
||||
<span>
|
||||
{formatAssignmentDate(assignmentStartDate)} - {formatAssignmentDate(assignmentEndDate)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{assignment.note && (
|
||||
<span className="text-[11px] italic text-muted-foreground/80 line-clamp-1 max-w-50">
|
||||
<span className="text-[11px] italic text-muted-foreground/80 line-clamp-1 max-w-35 sm:max-w-xs wrap-break-word">
|
||||
Note: {assignment.note}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default async function ClientsPage({ searchParams }: Props) {
|
||||
const filterAssignments = getFilteredAssignments(allAssignments, query, sortBy)
|
||||
|
||||
return (
|
||||
<div className="flex-1 space-y-8 p-6 sm:p-8 pt-6">
|
||||
<div className="flex-1 space-y-8 p-4 sm:p-8 pt-4 sm:pt-6">
|
||||
|
||||
<Suspense fallback={<div className='flex justify-center items-center h-48 gap-2'><Loader2 className="animate-spin" />Loading...</div>}>
|
||||
<HomeTask currentView={view} />
|
||||
|
||||
@@ -51,7 +51,7 @@ const DetailModalComponent: FC<Props> = ({ data, open, onOpenChange, onClose })
|
||||
</div>
|
||||
<div>
|
||||
<p className='text-muted-foreground text-xs md:text-sm font-medium'>Note</p>
|
||||
<p className='wrap-break-words'>{data.note || '-'}</p>
|
||||
<p className='wrap-wrap-break-word'>{data.note || '-'}</p>
|
||||
{data.tag?.length > 0 && data.tag?.map((item: string) =>
|
||||
<Badge variant='secondary' className='mr-1' key={item}>{item}</Badge>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user