Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: changed all the requested changes
ashrafchowdury7bc7da63f1c1
diff --git a/components/documents/stats-card.tsx b/components/documents/stats-card.tsxindex 34be7324..e33bddb2 100644--- a/components/documents/stats-card.tsx+++ b/components/documents/stats-card.tsx@@ -1,8 +1,7 @@import { useStats } from "@/lib/swr/use-stats";import ErrorPage from "next/error";import StatsElement from "./stats-element";-import StatsCardSkeleton from "../skeletons/stats-card-skeleton";-import { BarChart3, ThumbsUp, TimerIcon } from "lucide-react";+import { Skeleton } from "@/components/ui/skeleton";export default function StatsCard() {const { stats, loading, error } = useStats();@@ -15,7 +14,13 @@ export default function StatsCard() {return (<div className="grid grid-cols-1 sm:grid-cols-3 lg:grid-cols-3 border-foreground/5 space-y-2 sm:space-y-0 sm:space-x-2 lg:space-x-3">{Array.from({ length: 3 }).map((_, i) => (- <StatsCardSkeleton key={i} />+ <div+ className="border border-foreground/5 py-6 px-4 sm:px-6 lg:px-8 rounded-lg"+ key={i}+ >+ <Skeleton className="h-6 w-[80%] rounded-sm" />+ <Skeleton className="mt-4 h-8 w-9" />+ </div>))}</div>);@@ -31,19 +36,16 @@ export default function StatsCard() {const statistics = [{name: "Number of visits",- icon: BarChart3,value: stats?.views.length.toString() ?? "0",active: true,},{name: "Number of reactions",- icon: ThumbsUp,value: groupedReactionsTotal,active: true,},{name: "Total average view duration",- icon: TimerIcon,value:stats?.total_duration == null? "46"diff --git a/components/skeletons/stats-chart-skeleton.tsx b/components/documents/stats-chart-skeleton.tsxsimilarity index 100%rename from components/skeletons/stats-chart-skeleton.tsxrename to components/documents/stats-chart-skeleton.tsxdiff --git a/components/documents/stats-chart.tsx b/components/documents/stats-chart.tsxindex 9cef2a09..c558d7d7 100644--- a/components/documents/stats-chart.tsx+++ b/components/documents/stats-chart.tsx@@ -1,7 +1,7 @@import { useStats } from "@/lib/swr/use-stats";import ErrorPage from "next/error";import BarChartComponent from "../charts/bar-chart";-import StatsChartSkeleton from "../skeletons/stats-chart-skeleton";+import StatsChartSkeleton from "./stats-chart-skeleton";export default function StatsChart({documentId,diff --git a/components/documents/stats-element.tsx b/components/documents/stats-element.tsxindex 660dc295..a86aa637 100644--- a/components/documents/stats-element.tsx+++ b/components/documents/stats-element.tsx@@ -1,9 +1,7 @@import { cn } from "@/lib/utils";-import { LucideType } from "lucide-react";interface Stat {name: string;- icon: typeof LucideType;value: string;unit?: string;active: boolean;@@ -27,9 +25,6 @@ export default function StatsElement({ stat, statIdx }: StatsElementProps) {: "text-muted-foreground",)}>- <div className="*:w-5 sm:*:w-6 lg:*:w-5 *:h-5 sm:*:h-6 lg:*:h-5">- <stat.icon />- </div><p className="text-sm font-medium leading-6 whitespace-nowrap capitalize">{stat.name}</p>diff --git a/components/links/link-sheet/domain-section.tsx b/components/links/link-sheet/domain-section.tsxindex 4db7233a..4fdeb00e 100644--- a/components/links/link-sheet/domain-section.tsx+++ b/components/links/link-sheet/domain-section.tsx@@ -7,15 +7,6 @@ import { AddDomainModal } from "@/components/domains/add-domain-modal";import { mutate } from "swr";import Link from "next/link";import { useTeam } from "@/context/team-context";-import {- Select,- SelectGroup,- SelectValue,- SelectTrigger,- SelectContent,- SelectItem,-} from "@/components/ui/select";-import { Input } from "@/components/ui/input";export default function DomainSection({data,@@ -29,7 +20,9 @@ export default function DomainSection({const [isModalOpen, setModalOpen] = useState(false);const teamInfo = useTeam();- const handleDomainChange = (value: string) => {+ const handleDomainChange = (event: React.ChangeEvent<HTMLSelectElement>) => {+ const value = event.target.value;+if (value === "add_domain") {// Redirect to the add domain pagesetModalOpen(true);@@ -39,11 +32,9 @@ export default function DomainSection({setData({ ...data, domain: value });};- const handleSelectFocus = (open: boolean) => {- if (open) {- // Assuming your fetcher key for domains is '/api/teams/:teamId/domains'- mutate(`/api/teams/${teamInfo?.currentTeam?.id}/domains`);- }+ const handleSelectFocus = () => {+ // Assuming your fetcher key for domains is '/api/teams/:teamId/domains'+ mutate(`/api/teams/${teamInfo?.currentTeam?.id}/domains`);};const currentDomain = domains?.find((domain) => domain.slug === data.domain);@@ -52,32 +43,33 @@ export default function DomainSection({return (<><Label htmlFor="link-domain">Domain</Label>- <div className="px-1">- <Select+ <div className="flex">+ <selectvalue={data.domain || "papermark.io"}- onValueChange={handleDomainChange}- onOpenChange={handleSelectFocus}+ onChange={handleDomainChange}+ onFocus={handleSelectFocus}+ className={cn(+ "w-full rounded-l-md border border-r-0 border-border bg-secondary px-5 text-sm text-secondary-foreground focus:border-border focus:outline-none focus:ring-0",+ data.domain && data.domain !== "papermark.io"+ ? ""+ : "rounded-r-md border-r-1",+ )}>- <SelectTrigger>- <SelectValue placeholder="papermark.io" />- </SelectTrigger>- <SelectContent>- <SelectGroup>- <SelectItem key="papermark.io" value="papermark.io">- papermark.io- </SelectItem>- {domains?.map(({ slug }) => (- <SelectItem key={slug} value={slug}>- {slug}- </SelectItem>- ))}- <SelectItem value="add_domain">Add a custom domain ✨</SelectItem>- </SelectGroup>- </SelectContent>- </Select>+ <option key="papermark.io" value="papermark.io">+ papermark.io+ </option>+ {domains+ // ?.filter((domain) => domain.verified)+ ?.map(({ slug }) => (+ <option key={slug} value={slug}>+ {slug}+ </option>+ ))}+ <option value="add_domain">Add a custom domain ✨</option>+ </select>{data.domain && data.domain !== "papermark.io" ? (- <Input+ <inputtype="text"name="key"required@@ -90,10 +82,10 @@ export default function DomainSection({}}autoComplete="off"className={cn(- "hidden w-full mt-5 placeholder:text-muted-foreground",+ "hidden w-full rounded-r-md border-0 py-1.5 text-foreground bg-background shadow-sm ring-1 ring-inset ring-input placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-gray-400 sm:text-sm sm:leading-6",data.domain && data.domain !== "papermark.io" ? "flex" : "",)}- placeholder="Deck"+ placeholder="deck"onChange={(e) => {e.currentTarget.setCustomValidity("");setData({ ...data, slug: e.target.value });@@ -101,21 +93,21 @@ export default function DomainSection({aria-invalid="true"/>) : null}-- {data.domain && data.domain !== "papermark.io" && !isDomainVerified ? (- <div className="text-sm text-red-500 mt-3">- Your domain is not verified yet!{" "}- <Link- className="underline hover:text-red-500/80"- href="/settings/domains"- target="_blank"- >- Verify now- </Link>- </div>- ) : null}</div>+ {data.domain && data.domain !== "papermark.io" && !isDomainVerified ? (+ <div className="text-sm text-red-500 mt-4">+ Your domain is not verified yet!{" "}+ <Link+ className="underline hover:text-red-500/80"+ href="/settings/domains"+ target="_blank"+ >+ Verify now+ </Link>+ </div>+ ) : null}+<AddDomainModal open={isModalOpen} setOpen={setModalOpen} /></>);diff --git a/components/links/links-table.tsx b/components/links/links-table.tsxindex f1ca88cc..4f3a0942 100644--- a/components/links/links-table.tsx+++ b/components/links/links-table.tsx@@ -20,6 +20,7 @@ import {CollapsibleTrigger,} from "@/components/ui/collapsible";import { Button } from "@/components/ui/button";+import { Skeleton } from "@/components/ui/skeleton";import { useDocumentLinks } from "@/lib/swr/use-document";import BarChart from "../shared/icons/bar-chart";@@ -38,8 +39,6 @@ import { toast } from "sonner";import { useRouter } from "next/router";import { usePlan } from "@/lib/swr/use-billing";import { useTeam } from "@/context/team-context";-import { Archive, FilePen } from "lucide-react";-import LinksTableSekeleton from "../skeletons/links-table-sekeleton";import ProcessStatusBar from "../documents/process-status-bar";export default function LinksTable({@@ -266,7 +265,7 @@ export default function LinksTable({<DropdownMenuItemonClick={() => handleEditLink(link)}>- <FilePen className="w-4 h-4 mr-2" /> Edit Link+ Edit Link</DropdownMenuItem><DropdownMenuItemclassName="text-destructive focus:bg-destructive focus:text-destructive-foreground"@@ -278,7 +277,7 @@ export default function LinksTable({)}>- <Archive className="w-4 h-4 mr-2" /> Archive+ Archive</DropdownMenuItem></DropdownMenuContent></DropdownMenu>@@ -294,7 +293,20 @@ export default function LinksTable({</Collapsible>))) : (- <LinksTableSekeleton />+ <TableRow>+ <TableCell className="min-w-[100px]">+ <Skeleton className="h-6 w-full" />+ </TableCell>+ <TableCell className="min-w-[450px]">+ <Skeleton className="h-6 w-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-6 w-24" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-6 w-24" />+ </TableCell>+ </TableRow>)}</TableBody></Table>@@ -406,7 +418,6 @@ export default function LinksTable({)}>- <Archive className="w-4 h-4 mr-2" />Reactivate</DropdownMenuItem></DropdownMenuContent>diff --git a/components/links/links-visitors.tsx b/components/links/links-visitors.tsxindex aca45277..4072ed70 100644--- a/components/links/links-visitors.tsx+++ b/components/links/links-visitors.tsx@@ -1,9 +1,9 @@import { durationFormat, timeAgo } from "@/lib/utils";import { TableCell, TableRow } from "@/components/ui/table";+import { Skeleton } from "@/components/ui/skeleton";import { useLinkVisits } from "@/lib/swr/use-link";import { Gauge } from "@/components/ui/gauge";import { VisitorAvatar } from "@/components/visitors/visitor-avatar";-import LinksVisitorsSkeleton from "../skeletons/links-visitors-skeleton";export default function LinksVisitors({linkId,@@ -62,7 +62,20 @@ export default function LinksVisitors({</TableRow>))) : (- <LinksVisitorsSkeleton />+ <TableRow>+ <TableCell colSpan={2}>+ <div className="flex items-center space-x-2">+ <Skeleton className="h-10 w-10 rounded-full" />+ <Skeleton className="h-6 w-[220px]" />+ </div>+ </TableCell>+ <TableCell>+ <Skeleton className="h-6 w-24" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-6 w-16" />+ </TableCell>+ </TableRow>)}</>);diff --git a/components/skeletons/links-table-sekeleton.tsx b/components/skeletons/links-table-sekeleton.tsxdeleted file mode 100644index caa317a6..00000000--- a/components/skeletons/links-table-sekeleton.tsx+++ /dev/null@@ -1,23 +0,0 @@-import { TableCell, TableRow } from "@/components/ui/table";-import { Skeleton } from "../ui/skeleton";--const LinksTableSekeleton = () => {- return (- <TableRow>- <TableCell className="min-w-[100px]">- <Skeleton className="h-6 w-full" />- </TableCell>- <TableCell className="min-w-[450px]">- <Skeleton className="h-6 w-full" />- </TableCell>- <TableCell>- <Skeleton className="h-6 w-24" />- </TableCell>- <TableCell>- <Skeleton className="h-6 w-24" />- </TableCell>- </TableRow>- );-};--export default LinksTableSekeleton;diff --git a/components/skeletons/links-visitors-skeleton.tsx b/components/skeletons/links-visitors-skeleton.tsxdeleted file mode 100644index 9132b0ed..00000000--- a/components/skeletons/links-visitors-skeleton.tsx+++ /dev/null@@ -1,23 +0,0 @@-import { TableCell, TableRow } from "@/components/ui/table";-import { Skeleton } from "../ui/skeleton";--const LinksVisitorsSkeleton = () => {- return (- <TableRow>- <TableCell colSpan={2}>- <div className="flex items-center space-x-2">- <Skeleton className="h-10 w-10 rounded-full" />- <Skeleton className="h-6 w-[220px]" />- </div>- </TableCell>- <TableCell>- <Skeleton className="h-6 w-24" />- </TableCell>- <TableCell>- <Skeleton className="h-6 w-16" />- </TableCell>- </TableRow>- );-};--export default LinksVisitorsSkeleton;diff --git a/components/skeletons/stats-card-skeleton.tsx b/components/skeletons/stats-card-skeleton.tsxdeleted file mode 100644index e4568352..00000000--- a/components/skeletons/stats-card-skeleton.tsx+++ /dev/null@@ -1,10 +0,0 @@-import { Skeleton } from "../ui/skeleton";--export default function StatsCardSkeleton() {- return (- <div className="border border-foreground/5 py-6 px-4 sm:px-6 lg:px-8 rounded-lg">- <Skeleton className="h-6 w-[80%] rounded-sm" />- <Skeleton className="mt-4 h-8 w-9" />- </div>- );-}diff --git a/components/skeletons/visitors-table-skeleton.tsx b/components/skeletons/visitors-table-skeleton.tsxdeleted file mode 100644index 04628f1e..00000000--- a/components/skeletons/visitors-table-skeleton.tsx+++ /dev/null@@ -1,23 +0,0 @@-import { TableCell, TableRow } from "@/components/ui/table";-import { Skeleton } from "../ui/skeleton";--const VisitorsTableSkeleton = () => {- return (- <TableRow>- <TableCell className="min-w-[100px]">- <Skeleton className="h-6 w-full" />- </TableCell>- <TableCell className="min-w-[450px]">- <Skeleton className="h-6 w-full" />- </TableCell>- <TableCell>- <Skeleton className="h-6 w-24" />- </TableCell>- <TableCell>- <Skeleton className="h-6 w-24" />- </TableCell>- </TableRow>- );-};--export default VisitorsTableSkeleton;diff --git a/components/visitors/visitor-chart.tsx b/components/visitors/visitor-chart.tsxindex aee4a9ff..c86b48a8 100644--- a/components/visitors/visitor-chart.tsx+++ b/components/visitors/visitor-chart.tsx@@ -1,7 +1,7 @@import { useVisitorStats } from "@/lib/swr/use-stats";import ErrorPage from "next/error";import BarChartComponent from "@/components/charts/bar-chart";-import StatsChartSkeleton from "../skeletons/stats-chart-skeleton";+import StatsChartSkeleton from "../documents/stats-chart-skeleton";export default function VisitorChart({documentId,diff --git a/components/visitors/visitors-table.tsx b/components/visitors/visitors-table.tsxindex 66b0d1f6..f7bffba6 100644--- a/components/visitors/visitors-table.tsx+++ b/components/visitors/visitors-table.tsx@@ -12,6 +12,7 @@ import {CollapsibleTrigger,} from "@/components/ui/collapsible";import { Gauge } from "@/components/ui/gauge";+import { Skeleton } from "@/components/ui/skeleton";import { useDocumentVisits } from "@/lib/swr/use-document";import { durationFormat, timeAgo } from "@/lib/utils";@@ -19,7 +20,6 @@ import ChevronDown from "@/components/shared/icons/chevron-down";import VisitorChart from "./visitor-chart";import { VisitorAvatar } from "./visitor-avatar";import BadgeCheck from "../shared/icons/badge-check";-import VisitorsTableSkeleton from "../skeletons/visitors-table-skeleton";export default function VisitorsTable({ numPages }: { numPages: number }) {const { views } = useDocumentVisits();@@ -111,7 +111,7 @@ export default function VisitorsTable({ numPages }: { numPages: number }) {</CollapsibleTrigger></TableCell></TableRow>-+<CollapsibleContent asChild><><TableRow className="hover:bg-transparent">@@ -129,7 +129,20 @@ export default function VisitorsTable({ numPages }: { numPages: number }) {</Collapsible>))) : (- <VisitorsTableSkeleton />+ <TableRow>+ <TableCell className="min-w-[100px]">+ <Skeleton className="h-6 w-full" />+ </TableCell>+ <TableCell className="min-w-[450px]">+ <Skeleton className="h-6 w-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-6 w-24" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-6 w-24" />+ </TableCell>+ </TableRow>)}</TableBody></Table>