Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions app/components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { Edit, ExternalLink, FolderPlus, Globe, Loader2, Lock, MoreHorizontal, Search, Trash2, Sparkles } from 'lucide-react'
import { Edit, ExternalLink, FolderPlus, Globe, Lock, MoreHorizontal, Search, Trash2, Sparkles } from 'lucide-react'
import { Tooltip } from 'react-tooltip'
import { useEffect, useMemo, useRef, useState } from 'react'
import { useAuth } from '../contexts/AuthContext'
Expand All @@ -9,6 +9,7 @@ import { authFetch } from '../lib/authFetch'
import { CollectionsSidebar } from './collections/CollectionsSidebar'
import { ResourceCollectionManager } from './collections/ResourceCollectionManager'
import { EditResource } from './EditResource'
import { ResourceSkeleton } from './ui/ResourceSkeleton'

function formatDate(dateValue: any): string {
if (!dateValue) return ''
Expand Down Expand Up @@ -126,13 +127,7 @@ export function Dashboard({ onNavigate }: { onNavigate?: (page: 'dashboard' | 'a
}
}

if (loading) {
return (
<div className="flex h-64 items-center justify-center">
<Loader2 className="h-8 w-8 animate-spin text-blue-600" />
</div>
)
}
// We render inline skeletons inside the feed area below rather than block the entire dashboard UI

return (
<>
Expand Down Expand Up @@ -220,7 +215,13 @@ export function Dashboard({ onNavigate }: { onNavigate?: (page: 'dashboard' | 'a
</div>
</div>

{resources.length === 0 ? (
{loading ? (
<div className="grid grid-cols-1 gap-4 xl:grid-cols-2">
{Array.from({ length: 6 }).map((_, idx) => (
<ResourceSkeleton key={idx} />
))}
</div>
) : resources.length === 0 ? (
<div className="app-panel p-8 md:p-10 space-y-6">
<div className="flex items-center gap-3">
<div className="flex h-12 w-12 items-center justify-center rounded-2xl bg-blue-100 text-blue-600 dark:bg-blue-950 dark:text-blue-400">
Expand Down
52 changes: 52 additions & 0 deletions app/components/ui/ResourceSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use client'

import { MoreHorizontal } from 'lucide-react'

export function ResourceSkeleton() {
return (
<div className="app-panel p-4 space-y-4 animate-pulse border border-slate-200/60 dark:border-slate-800/60">
{/* Card Header Chips */}
<div className="flex items-start justify-between gap-3">
<div className="flex flex-wrap items-center gap-2">
{/* Tag Chip */}
<div className="h-6 w-16 rounded-full bg-slate-200 dark:bg-slate-800" />
{/* Index Status Chip */}
<div className="h-6 w-14 rounded-full bg-slate-200 dark:bg-slate-800" />
{/* Visibility Chip */}
<div className="flex h-6 w-16 items-center gap-1 rounded-full bg-slate-200 px-2 dark:bg-slate-800" />
</div>

{/* Actions Button Skeleton */}
<div className="rounded-lg p-2 text-slate-200 dark:text-slate-800">
<MoreHorizontal className="h-5 w-5 opacity-40" />
</div>
</div>

{/* Resource Title */}
<div className="space-y-2">
<div className="h-5 w-11/12 rounded bg-slate-200 dark:bg-slate-800" />
<div className="h-5 w-2/3 rounded bg-slate-200 dark:bg-slate-800" />
</div>

{/* Note Content */}
<div className="space-y-1.5 pt-1">
<div className="h-4 w-full rounded bg-slate-100 dark:bg-slate-900" />
<div className="h-4 w-5/6 rounded bg-slate-100 dark:bg-slate-900" />
</div>

{/* Collection Chips */}
<div className="flex flex-wrap gap-2 pt-2">
<div className="h-5 w-20 rounded bg-slate-200 dark:bg-slate-800" />
<div className="h-5 w-24 rounded bg-slate-200 dark:bg-slate-800" />
</div>

{/* Card Footer */}
<div className="flex items-center justify-between border-t border-slate-100 pt-3 text-xs dark:border-slate-800/80">
{/* Date skeleton */}
<div className="h-3 w-16 rounded bg-slate-200 dark:bg-slate-800" />
{/* Open link skeleton */}
<div className="h-4 w-12 rounded bg-slate-200 dark:bg-slate-800" />
</div>
</div>
)
}
Loading