mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:46:29 +00:00
Lazy-load task views and dialogs
Dynamically import client and assignment lists, grids, forms, filters, and activity timelines to reduce initial bundle work, with loading placeholders for list and grid views. Also refine client logo corners and assignment activity accents.
This commit is contained in:
@@ -9,10 +9,36 @@ import { IProjectAssignment } from '../../../type.assignment';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import dynamic from 'next/dynamic';
|
||||
import FilterComponent from '../../../component/FilterComponent';
|
||||
import AssignmentGrid from '../../../component/project-assignment/AssignmentGrid';
|
||||
import AssignmentList from '../../../component/project-assignment/AssignmentList';
|
||||
import ProjectAssignmentDashboardStats from '../../../component/project-assignment/ProjectAssignmentDashboardStats';
|
||||
|
||||
const AssignmentList = dynamic(
|
||||
() => import('../../../component/project-assignment/AssignmentList'),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="space-y-6">
|
||||
{[1, 2, 3].map((i) => (
|
||||
<div key={i} className="h-34 w-full animate-pulse rounded-2xl border border-border/80 bg-card p-6" />
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
const AssignmentGrid = dynamic(
|
||||
() => import('../../../component/project-assignment/AssignmentGrid'),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{[1, 2, 3].map((i) => (
|
||||
<div key={i} className="h-68 w-full animate-pulse rounded-2xl border border-border/80 bg-card p-6" />
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
const ModalActionLoader = () => (
|
||||
<div className="fixed inset-0 z-50 bg-black/50 backdrop-blur-xs flex items-center justify-center animate-in fade-in duration-150">
|
||||
<div className="bg-popover border border-border/80 rounded-2xl p-5 shadow-2xl flex items-center gap-3">
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function ClientProfileCard({ client, clientId }: Props) {
|
||||
fallbackSrc={CLIENT_FALLBACK_IMAGE}
|
||||
alt={client.name}
|
||||
className="h-full w-full bg-transparent"
|
||||
imgClassName="object-contain"
|
||||
imgClassName="object-contain rounded"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
+2
-2
@@ -282,13 +282,13 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
<div className="rounded-xl border border-border/70 bg-muted/20 p-3.5 space-y-2.5">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="flex h-6 w-6 items-center justify-center rounded-lg bg-muted text-muted-foreground">
|
||||
<span className="flex h-6 w-6 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-600 dark:text-emerald-400">
|
||||
<Clock className="h-3.5 w-3.5" />
|
||||
</span>
|
||||
<span className="text-xs font-semibold text-muted-foreground tracking-wide">
|
||||
Days Elapsed
|
||||
</span>
|
||||
<span className="text-[10px] font-mono text-muted-foreground bg-muted/60 px-1.5 py-0.5 rounded">
|
||||
<span className="text-[10px] font-mono text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 px-1.5 py-0.5 rounded">
|
||||
Timeline
|
||||
</span>
|
||||
</div>
|
||||
|
||||
+3
-4
@@ -76,7 +76,7 @@ export function DevelopmentActivityLog({
|
||||
<section className="rounded-2xl border border-border/80 bg-card p-5 sm:p-6 transition-all duration-200">
|
||||
<div className="mb-4 flex items-center justify-between gap-3 flex-wrap">
|
||||
<h2 className="flex items-center gap-2.5 text-base font-semibold tracking-tight text-foreground">
|
||||
<span className="flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-muted-foreground">
|
||||
<span className="flex h-7 w-7 items-center justify-center rounded-lg bg-his/10 text-his">
|
||||
<FileText className="h-4 w-4" />
|
||||
</span>
|
||||
Development Activity Log
|
||||
@@ -219,11 +219,10 @@ export function DevelopmentActivityLog({
|
||||
variant={pageNum === safeCurrentPage ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
onClick={() => setCurrentPage(pageNum)}
|
||||
className={`h-7 w-7 p-0 text-xs font-mono ${
|
||||
pageNum === safeCurrentPage
|
||||
className={`h-7 w-7 p-0 text-xs font-mono ${pageNum === safeCurrentPage
|
||||
? 'bg-his text-white hover:bg-his/90'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
}`}
|
||||
}`}
|
||||
>
|
||||
{pageNum}
|
||||
</Button>
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
"use client"
|
||||
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Search, LayoutGrid, List } from 'lucide-react';
|
||||
import { Search, LayoutGrid, List, ListFilter } from 'lucide-react';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import { type FC, useEffect, useState } from 'react';
|
||||
import dynamic from 'next/dynamic';
|
||||
import {
|
||||
Select, SelectContent, SelectItem, SelectTrigger, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { cn } from '@/lib/utils';
|
||||
import useDebounce from '@/hooks/useDebounce';
|
||||
import { FilterModal } from './FilterModal';
|
||||
|
||||
const FilterModal = dynamic(
|
||||
() => import('./FilterModal').then((mod) => mod.FilterModal),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<Button variant="outline" size="sm" className="h-9 px-3 gap-1.5 opacity-60 pointer-events-none">
|
||||
<ListFilter className="w-4 h-4" />
|
||||
<span className="hidden sm:inline">Filter</span>
|
||||
</Button>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
type Props = {
|
||||
hideClient?: boolean
|
||||
|
||||
@@ -6,8 +6,10 @@ import { Plus, Building2, FolderGit2, FileText, ClipboardClock } from 'lucide-re
|
||||
import { motion } from 'motion/react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card900 } from '@/components/ui/card';
|
||||
import FormClient from './client/FormClient';
|
||||
import dynamic from 'next/dynamic';
|
||||
import FilterComponent from './FilterComponent';
|
||||
|
||||
const FormClient = dynamic(() => import('./client/FormClient'), { ssr: false });
|
||||
import { IClient } from '../types';
|
||||
import { calculateOverviewStats } from '../utils/client-overview-helpers';
|
||||
|
||||
|
||||
@@ -5,10 +5,36 @@ import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { Users } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { IClient } from '../../types';
|
||||
import FormClient from './FormClient';
|
||||
import { ConfirmDeleteWithInput } from '@/components/modal/ConfirmDeleteWithInput';
|
||||
import ClientGrid from './ClientGrid';
|
||||
import ClientList from './ClientList';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const ClientGrid = dynamic(() => import('./ClientGrid'), {
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{[1, 2, 3, 4, 5, 6].map((i) => (
|
||||
<div key={i} className="h-80 w-full animate-pulse rounded-2xl border border-border/80 bg-card p-6" />
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
});
|
||||
|
||||
const ClientList = dynamic(() => import('./ClientList'), {
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="flex flex-col gap-6">
|
||||
{[1, 2, 3, 4].map((i) => (
|
||||
<div key={i} className="h-64 w-full animate-pulse rounded-2xl border border-border/80 bg-card p-6" />
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
});
|
||||
|
||||
const FormClient = dynamic(() => import('./FormClient'), { ssr: false });
|
||||
|
||||
const ConfirmDeleteWithInput = dynamic(
|
||||
() => import('@/components/modal/ConfirmDeleteWithInput').then((mod) => mod.ConfirmDeleteWithInput),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
interface ClientProps {
|
||||
clients: IClient[];
|
||||
|
||||
@@ -19,7 +19,21 @@ import BadgeStatus from '@/components/ui/badge-status';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { IClient, CLIENT_FALLBACK_IMAGE } from '../../types';
|
||||
import { getProjectStatusBreakdown } from '../../utils/client-overview-helpers';
|
||||
import ClientMilestoneTimeline from './ClientMilestoneTimeline';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const ClientMilestoneTimeline = dynamic(
|
||||
() => import('./ClientMilestoneTimeline'),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="h-14 w-full rounded-lg bg-muted/20 border border-border/40 animate-pulse flex items-center justify-between px-3 my-1">
|
||||
<div className="h-2 w-12 rounded bg-muted/60" />
|
||||
<div className="h-1 flex-1 mx-3 rounded-full bg-muted/40" />
|
||||
<div className="h-2 w-12 rounded bg-muted/60" />
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
interface ClientGridProps {
|
||||
clients: IClient[];
|
||||
@@ -148,7 +162,7 @@ export default function ClientGrid({ clients, onEdit, onDelete }: ClientGridProp
|
||||
fallbackSrc={CLIENT_FALLBACK_IMAGE}
|
||||
alt={client.name}
|
||||
className="h-full w-auto bg-transparent max-h-12"
|
||||
imgClassName="object-contain object-left max-h-12 group-hover/logo:scale-105 transition-transform"
|
||||
imgClassName="object-contain object-left rounded max-h-12 group-hover/logo:scale-105 transition-transform"
|
||||
/>
|
||||
|
||||
</Link>
|
||||
|
||||
@@ -19,7 +19,21 @@ import BadgeStatus from '@/components/ui/badge-status';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { IClient, CLIENT_FALLBACK_IMAGE } from '../../types';
|
||||
import { getProjectStatusBreakdown } from '../../utils/client-overview-helpers';
|
||||
import ClientMilestoneTimeline from './ClientMilestoneTimeline';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const ClientMilestoneTimeline = dynamic(
|
||||
() => import('./ClientMilestoneTimeline'),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="h-14 sm:h-16 w-full rounded-xl bg-muted/20 border border-border/40 animate-pulse flex items-center justify-between px-4 my-1">
|
||||
<div className="h-2.5 w-16 sm:w-20 rounded bg-muted/60" />
|
||||
<div className="h-1 flex-1 mx-4 sm:mx-8 rounded-full bg-muted/40" />
|
||||
<div className="h-2.5 w-14 sm:w-16 rounded bg-muted/60" />
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
interface ClientListProps {
|
||||
clients: IClient[];
|
||||
@@ -120,7 +134,7 @@ export default function ClientList({ clients, onEdit, onDelete }: ClientListProp
|
||||
fallbackSrc={CLIENT_FALLBACK_IMAGE}
|
||||
alt={client.name}
|
||||
className="h-full w-auto bg-transparent max-h-12"
|
||||
imgClassName="object-contain object-left max-h-12 group-hover/logo:scale-105 transition-transform"
|
||||
imgClassName="object-contain rounded object-left max-h-12 group-hover/logo:scale-105 transition-transform"
|
||||
/>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user