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
36 changes: 28 additions & 8 deletions app/home/[id]/pdf/[pdfId]/PdfViewerPageClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import { useHoverTooltip } from "@/hooks/useHoverTooltip";
import PdfSettings from "@/components/home-components/PdfSettings";

GlobalWorkerOptions.workerSrc = new URL(
"pdfjs-dist/legacy/build/pdf.worker.mjs",
Expand Down Expand Up @@ -447,7 +448,7 @@ function PageNavigator() {
}}
inputMode="numeric"
aria-label="current-page-input"
className="h-7 w-7 p-0 mx-1 mb-0.5 bg-transparent border-0 text-center text-sm font-medium text-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"
className="h-7 w-7 p-0 mx-1 mb-0 bg-transparent border-0 text-center text-sm font-medium text-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"
/>
<span className=" mr-3"> of {pages || 1}</span>
<Button
Expand All @@ -468,9 +469,13 @@ function PageNavigator() {
function PdfViewerContent({
fileUrl,
title,
pdfId,
pdftitle,
}: {
fileUrl: string;
title: string;
pdfId: Id<"pdfs">;
pdftitle: string;
}) {
const [query, setQuery] = useState("");
const [panelMode, setPanelMode] = useState<PanelMode>(null);
Expand All @@ -486,7 +491,7 @@ function PdfViewerContent({
}
>
<div className=" relative min-w-full min-h-full bg-transparent ">
<div className="pointer-events-none absolute inset-x-0 top-10 z-50">
<div className="pointer-events-none absolute inset-x-0 top-1 z-50">
<div className="pointer-events-auto mx-auto flex w-fit flex-nowrap items-center justify-between gap-3 app-radius-lg border border-border bg-card/95 px-0.5 py-0.5 backdrop-blur-xl">
<div className="flex items-center gap-0">
<Tooltip open={searchTooltip.open}>
Expand Down Expand Up @@ -535,7 +540,7 @@ function PdfViewerContent({
{panelMode === "thumbnails" ? (
<X size={16} />
) : (
<span className="text-[11px] font-semibold">Pg</span>
<span className="text-[11px] pb-1 font-semibold">Pg</span>
)}
</Button>
</TooltipTrigger>
Expand All @@ -548,6 +553,13 @@ function PdfViewerContent({
<ZoomDropdown />
</div>
<PageNavigator />
<PdfSettings
pdfId={pdfId}
pdfTitle={pdftitle}
iconVariant="horizontal_icon"
dropdownMenuContentAlign="end"
tooltipContentAlign="end"
/>
</div>
</div>

Expand All @@ -567,11 +579,8 @@ function PdfViewerContent({
<ThumbnailsPanel onClose={() => setPanelMode(null)} />
</div>
) : null}

<div className=" absolute inset-y-0 right-0 z-30 flex h-screen w-full items-center justify-center border-b border-border bg-background">
<div
className=" absolute top-0 left-0 w-full h-[4rem] bg-gradient-to-b from-background from-0% via-background/75 via-45% to-100% to-transparent z-[900000] pointer-events-none"
aria-hidden
/>
<Pages className="h-full min-h-0 w-full transition-all scroll-smooth scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent">
<Page>
<CanvasLayer />
Expand All @@ -588,9 +597,13 @@ function PdfViewerContent({
function PdfViewerShell({
fileUrl,
title,
pdfId,
pdftitle,
}: {
fileUrl: string;
title: string;
pdfId: Id<"pdfs">;
pdftitle: string;
}) {
return (
<Root
Expand All @@ -607,7 +620,12 @@ function PdfViewerShell({
maxZoom: 10,
}}
>
<PdfViewerContent fileUrl={fileUrl} title={title} />
<PdfViewerContent
fileUrl={fileUrl}
title={title}
pdfId={pdfId}
pdftitle={pdftitle}
/>
</Root>
);
}
Expand Down Expand Up @@ -701,6 +719,8 @@ export default function PdfViewerPageClient({ pdfId }: { pdfId: Id<"pdfs"> }) {
<PdfViewerShell
fileUrl={pdf.fileUrl}
title={pdf.title || "Untitled PDF"}
pdfId={pdf._id}
pdftitle={pdf.title || "Untitled PDF"}
/>
) : (
<div className="flex-1 bg-card animate-pulse" />
Expand Down
13 changes: 1 addition & 12 deletions components/home-components/HomeClientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const HomeContent = memo(({ children }: { children: ReactNode }) => {
<div className="flex justify-between items-center w-full px-4 py-2 ">
<div className="flex justify-start items-center gap-3">
{(!open || isMobile) && <SidebarTrigger />}
<BreadcrumbWithCustomSeparator />
{!isPdfRoute ? <BreadcrumbWithCustomSeparator /> : null}
</div>
<div>
{!isPdfRoute && noteid && noteTitle && (
Expand All @@ -114,17 +114,6 @@ const HomeContent = memo(({ children }: { children: ReactNode }) => {
/>
</span>
)}
{isPdfRoute && currentPdf && (
<span className="flex justify-between items-center gap-2">
<PdfSettings
pdfId={currentPdf._id}
pdfTitle={currentPdf.title}
iconVariant="horizontal_icon"
dropdownMenuContentAlign="end"
tooltipContentAlign="end"
/>
</span>
)}
</div>
</div>
</div>
Expand Down
53 changes: 27 additions & 26 deletions components/home-components/PdfSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,32 +171,33 @@ export default function PdfSettings({
}}
>
<Tooltip open={tooltip.open}>
<DropdownMenuTrigger asChild>
<TooltipTrigger asChild>
<Button
variant="Trigger"
className={cn("px-0.5 h-8 mt-0.5", btnClassName)}
{...tooltip.triggerProps}
aria-label="upload-options"
>
{iconVariant === "vertical_icon" ? (
<FaEllipsisVertical
size={18}
className="text-muted-foreground"
/>
) : (
<FaEllipsis size={22} className="text-muted-foreground" />
)}
</Button>
</TooltipTrigger>
</DropdownMenuTrigger>
<TooltipContent
side="bottom"
alignOffset={1}
align={tooltipContentAlign}
>
Rename, Pin, Move, Download, Delete
</TooltipContent>
<DropdownMenuTrigger asChild>
<TooltipTrigger asChild>
<Button
variant="outline"
className="h-8 w-8 "
size="icon"
{...tooltip.triggerProps}
aria-label="upload-options"
>
{iconVariant === "vertical_icon" ? (
<FaEllipsisVertical
size={18}
className="text-muted-foreground"
/>
) : (
<FaEllipsis size={22} className="text-muted-foreground" />
)}
</Button>
</TooltipTrigger>
</DropdownMenuTrigger>
<TooltipContent
side="bottom"
alignOffset={1}
align={tooltipContentAlign}
>
Rename, Pin, Move, Download, Delete
</TooltipContent>
</Tooltip>

<DropdownMenuContent
Expand Down