feat: improved onboarding

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-11-16 15:54:54 -08:00
parent 2b82f32b8c
commit cc73e8e565
13 changed files with 999 additions and 887 deletions

View file

@ -1,7 +1,8 @@
"use client";
import { ChevronDown, ChevronUp, FileX } from "lucide-react";
import { ChevronDown, ChevronUp, FileX, Plus } from "lucide-react";
import { motion } from "motion/react";
import { useParams, useRouter } from "next/navigation";
import { useTranslations } from "next-intl";
import React from "react";
import { DocumentViewer } from "@/components/document-viewer";
@ -68,6 +69,10 @@ export function DocumentsTableShell({
onSortChange: (key: SortKey) => void;
}) {
const t = useTranslations("documents");
const router = useRouter();
const params = useParams();
const searchSpaceId = params.search_space_id;
const sorted = React.useMemo(
() => sortDocuments(documents, sortKey, sortDesc),
[documents, sortKey, sortDesc]
@ -117,10 +122,29 @@ export function DocumentsTableShell({
</div>
) : sorted.length === 0 ? (
<div className="flex h-[400px] w-full items-center justify-center">
<div className="flex flex-col items-center gap-2">
<FileX className="h-8 w-8 text-muted-foreground" />
<p className="text-sm text-muted-foreground">{t("no_documents")}</p>
</div>
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4 }}
className="flex flex-col items-center gap-4 max-w-md px-4 text-center"
>
<div className="rounded-full bg-muted p-4">
<FileX className="h-8 w-8 text-muted-foreground" />
</div>
<div className="space-y-2">
<h3 className="text-lg font-semibold">{t("no_documents")}</h3>
<p className="text-sm text-muted-foreground">
Get started by adding your first data source.
</p>
</div>
<Button
onClick={() => router.push(`/dashboard/${searchSpaceId}/sources/add`)}
className="mt-2"
>
<Plus className="mr-2 h-4 w-4" />
Add Sources
</Button>
</motion.div>
</div>
) : (
<>