Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat:mbolie

Iuliia Shnaibbd4be70c257
diff --git a/components/datarooms/dataroom-document-card.tsx b/components/datarooms/dataroom-document-card.tsx
index 6136fa5b..2ecd72f6 100644
--- a/components/datarooms/dataroom-document-card.tsx
+++ b/components/datarooms/dataroom-document-card.tsx
@@ -215,9 +215,9 @@ export default function DataroomDocumentCard({
isProcessing && "opacity-60",
)}
>
- <div className="flex min-w-0 shrink items-center space-x-2 sm:space-x-4">
+ <div className="flex min-w-0 flex-1 shrink items-center space-x-2 sm:space-x-4">
{!isSelected && !isHovered ? (
- <div className="mx-0.5 flex w-8 items-center justify-center text-center sm:mx-1">
+ <div className="mx-0.5 flex w-8 shrink-0 items-center justify-center text-center sm:mx-1">
{fileIcon({
fileType: dataroomDocument.document.type ?? "",
className: "h-8 w-8",
@@ -225,19 +225,19 @@ export default function DataroomDocumentCard({
})}
</div>
) : (
- <div className="mx-0.5 w-8 sm:mx-1"></div>
+ <div className="mx-0.5 w-8 shrink-0 sm:mx-1"></div>
)}
- <div className="flex-col">
- <div className="flex items-center">
+ <div className="flex min-w-0 flex-1 flex-col overflow-hidden">
+ <div className="flex min-w-0 items-center">
<h2
- className="min-w-0 max-w-[150px] truncate text-sm font-semibold leading-6 text-foreground sm:max-w-md"
+ className="min-w-0 flex-1 truncate text-sm font-semibold leading-6 text-foreground sm:max-w-none"
style={HIERARCHICAL_DISPLAY_STYLE}
>
{displayName}
</h2>
</div>
- <div className="mt-1 flex items-center space-x-1 text-xs leading-5 text-muted-foreground">
+ <div className="mt-1 flex min-w-0 items-center space-x-1 overflow-hidden text-xs leading-5 text-muted-foreground">
<p className="truncate">
{timeAgo(dataroomDocument.createdAt)}
</p>
@@ -257,13 +257,13 @@ export default function DataroomDocumentCard({
</div>
</div>
- <div className="flex flex-row space-x-2">
+ <div className="flex shrink-0 flex-row space-x-2">
<Link
onClick={(e) => {
e.stopPropagation();
}}
href={`/documents/${dataroomDocument.document.id}`}
- className="z-10 flex items-center space-x-1 rounded-md bg-gray-200 px-1.5 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100 dark:bg-gray-700 sm:px-2"
+ className="z-10 flex shrink-0 items-center space-x-1 rounded-md bg-gray-200 px-1.5 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100 dark:bg-gray-700 sm:px-2"
>
<BarChart className="h-3 w-3 text-muted-foreground sm:h-4 sm:w-4" />
<p className="whitespace-nowrap text-xs text-muted-foreground sm:text-sm">
@@ -285,7 +285,7 @@ export default function DataroomDocumentCard({
}
variant="outline"
size="icon"
- className="z-10 h-8 w-8 border-gray-200 bg-transparent hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
+ className="z-10 h-8 w-8 shrink-0 border-gray-200 bg-transparent hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
/>
<DropdownMenu open={menuOpen} onOpenChange={handleMenuStateChange}>
@@ -293,7 +293,7 @@ export default function DataroomDocumentCard({
<Button
onClick={(e) => e.stopPropagation()}
variant="outline"
- className="z-10 h-8 w-8 border-gray-200 bg-transparent p-0 hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
+ className="z-10 h-8 w-8 shrink-0 border-gray-200 bg-transparent p-0 hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
>
<span className="sr-only">Open menu</span>
<MoreVertical className="h-4 w-4" />
diff --git a/components/datarooms/stats-card.tsx b/components/datarooms/stats-card.tsx
index c2014b3d..9b3f7773 100644
--- a/components/datarooms/stats-card.tsx
+++ b/components/datarooms/stats-card.tsx
@@ -14,14 +14,14 @@ export default function StatsCard() {
if (loading) {
return (
- <div className="grid grid-cols-1 space-y-2 border-foreground/5 sm:grid-cols-3 sm:space-x-2 sm:space-y-0 lg:grid-cols-3 lg:space-x-3">
+ <div className="grid grid-cols-3 gap-1.5 border-foreground/5 sm:gap-2 lg:gap-3">
{Array.from({ length: 3 }).map((_, i) => (
<div
- className="rounded-lg border border-foreground/5 px-4 py-6 sm:px-6 lg:px-8"
+ className="rounded-lg border border-foreground/5 px-2 py-2 sm:px-6 sm:py-6 lg:px-8"
key={i}
>
- <Skeleton className="h-6 w-[80%] rounded-sm" />
- <Skeleton className="mt-4 h-8 w-9" />
+ <Skeleton className="h-3 w-[85%] rounded-sm sm:h-6 sm:w-[80%]" />
+ <Skeleton className="mt-2 h-6 w-8 rounded-sm sm:mt-4 sm:h-8 sm:w-9" />
</div>
))}
</div>
@@ -31,16 +31,19 @@ export default function StatsCard() {
const statistics = [
{
name: "Number of views",
+ shortName: "Views",
value: stats?.dataroomViews.length.toString() ?? "0",
active: true,
},
{
name: "Number of documents views",
+ shortName: "Doc views",
value: stats?.documentViews.length.toString() ?? "0",
active: true,
},
{
name: "Total time spent",
+ shortName: "Time",
value:
stats?.total_duration == null
? "46"
@@ -57,7 +60,7 @@ export default function StatsCard() {
];
return stats && stats.dataroomViews.length > 0 ? (
- <div className="grid grid-cols-1 space-y-2 border-foreground/5 sm:grid-cols-3 sm:space-x-2 sm:space-y-0 lg:grid-cols-3 lg:space-x-3">
+ <div className="grid grid-cols-3 gap-1.5 border-foreground/5 sm:gap-2 lg:gap-3">
{statistics.map((stat, statIdx) => (
<StatsElement key={statIdx} stat={stat} statIdx={statIdx} />
))}
diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsx
index 99ff7098..fede4f82 100644
--- a/components/documents/document-card.tsx
+++ b/components/documents/document-card.tsx
@@ -311,9 +311,9 @@ export default function DocumentsCard({
isHovered && "bg-secondary ring-gray-300 dark:ring-gray-500",
)}
>
- <div className="flex min-w-0 shrink items-center space-x-2 sm:space-x-4">
+ <div className="flex min-w-0 flex-1 shrink items-center space-x-2 sm:space-x-4">
{!isSelected && !isHovered ? (
- <div className="mx-0.5 flex w-8 items-center justify-center text-center sm:mx-1">
+ <div className="mx-0.5 flex w-8 shrink-0 items-center justify-center text-center sm:mx-1">
{fileIcon({
fileType: prismaDocument.type ?? "",
className: "h-8 w-8",
@@ -321,22 +321,25 @@ export default function DocumentsCard({
})}
</div>
) : (
- <div className="mx-0.5 w-8 sm:mx-1"></div>
+ <div className="mx-0.5 w-8 shrink-0 sm:mx-1"></div>
)}
- <div className="flex-col">
- <div className="flex items-center">
- <h2 className="min-w-0 max-w-[250px] truncate text-sm font-semibold leading-6 text-foreground sm:max-w-md">
+ <div className="relative flex min-w-0 flex-1 flex-col overflow-hidden">
+ <div className="flex min-w-0 items-center gap-1">
+ <h2 className="min-w-0 flex-1 truncate text-sm font-semibold leading-6 text-foreground sm:max-w-none">
<Link
href={`/documents/${prismaDocument.id}`}
- className="w-full truncate"
+ className="relative block w-full min-w-0 truncate"
>
- <span>{prismaDocument.name}</span>
- <span className="absolute inset-0" />
+ <span className="block truncate">{prismaDocument.name}</span>
+ <span
+ className="absolute inset-0 z-0"
+ aria-hidden
+ />
</Link>
</h2>
{prismaDocument._count.datarooms > 0 && (
- <div className="z-20">
+ <div className="z-20 shrink-0">
<BadgeTooltip
content={`In ${prismaDocument._count.datarooms} dataroom${prismaDocument._count.datarooms > 1 ? "s" : ""}`}
key="dataroom"
@@ -346,7 +349,7 @@ export default function DocumentsCard({
</div>
)}
</div>
- <div className="mt-1 flex items-center space-x-1 text-xs leading-5 text-muted-foreground">
+ <div className="mt-1 flex min-w-0 items-center space-x-1 overflow-hidden text-xs leading-5 text-muted-foreground">
<p className="truncate">{timeAgo(prismaDocument.createdAt)}</p>
<p>•</p>
<p className="truncate">
@@ -394,13 +397,13 @@ export default function DocumentsCard({
</div>
</div>
- <div className="flex flex-row space-x-2">
+ <div className="flex shrink-0 flex-row space-x-2">
<Link
onClick={(e) => {
e.stopPropagation();
}}
href={`/documents/${prismaDocument.id}`}
- className="z-20 flex items-center space-x-1 rounded-md bg-gray-200 px-1.5 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100 dark:bg-gray-700 sm:px-2"
+ className="z-20 flex shrink-0 items-center space-x-1 rounded-md bg-gray-200 px-1.5 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100 dark:bg-gray-700 sm:px-2"
>
<BarChart className="h-3 w-3 text-muted-foreground sm:h-4 sm:w-4" />
<p className="whitespace-nowrap text-xs text-muted-foreground sm:text-sm">
@@ -414,7 +417,7 @@ export default function DocumentsCard({
<Button
// size="icon"
variant="outline"
- className="z-20 h-8 w-8 border-gray-200 bg-transparent p-0 hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
+ className="z-20 h-8 w-8 shrink-0 border-gray-200 bg-transparent p-0 hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
>
<span className="sr-only">Open menu</span>
<MoreVertical className="h-4 w-4" />
diff --git a/components/documents/document-preview-button.tsx b/components/documents/document-preview-button.tsx
index 86d90532..a6a98d75 100644
--- a/components/documents/document-preview-button.tsx
+++ b/components/documents/document-preview-button.tsx
@@ -2,6 +2,8 @@ import { useState } from "react";
import { EyeIcon, EyeOffIcon } from "lucide-react";
+import { cn } from "@/lib/utils";
+
import { Button } from "@/components/ui/button";
import { ButtonTooltip } from "@/components/ui/tooltip";
@@ -76,12 +78,18 @@ export function DocumentPreviewButton({
size={size}
onClick={handlePreviewClick}
disabled={isProcessing}
- className={className}
+ className={cn(
+ size !== "icon" &&
+ "max-md:h-8 max-md:w-8 max-md:min-w-8 max-md:shrink-0 max-md:gap-0 max-md:px-0 max-md:[&_svg]:size-4",
+ className,
+ )}
>
{children || (
<>
<EyeIcon className="h-4 w-4" />
- {size !== "icon" && <span className="ml-1">Preview</span>}
+ {size !== "icon" && (
+ <span className="ml-1 hidden md:inline">Preview</span>
+ )}
</>
)}
</Button>
diff --git a/components/documents/hidden-document-card.tsx b/components/documents/hidden-document-card.tsx
index de316078..2fe7cdf6 100644
--- a/components/documents/hidden-document-card.tsx
+++ b/components/documents/hidden-document-card.tsx
@@ -175,10 +175,10 @@ export function HiddenDocumentCard({
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
- <div className="flex min-w-0 shrink items-center space-x-2 sm:space-x-4">
+ <div className="flex min-w-0 flex-1 shrink items-center space-x-2 sm:space-x-4">
{isSelected || isHovered ? (
<div
- className="mx-0.5 flex w-8 items-center justify-center sm:mx-1"
+ className="mx-0.5 flex w-8 shrink-0 items-center justify-center sm:mx-1"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
@@ -192,7 +192,7 @@ export function HiddenDocumentCard({
/>
</div>
) : (
- <div className="mx-0.5 flex w-8 items-center justify-center text-center sm:mx-1">
+ <div className="mx-0.5 flex w-8 shrink-0 items-center justify-center text-center sm:mx-1">
{fileIcon({
fileType: prismaDocument.type ?? "",
className: "h-8 w-8",
@@ -201,19 +201,19 @@ export function HiddenDocumentCard({
</div>
)}
- <div className="flex-col">
- <div className="flex items-center">
- <h2 className="min-w-0 max-w-[250px] truncate text-sm font-semibold leading-6 text-foreground sm:max-w-md">
+ <div className="relative flex min-w-0 flex-1 flex-col overflow-hidden">
+ <div className="flex min-w-0 items-center gap-1">
+ <h2 className="min-w-0 flex-1 truncate text-sm font-semibold leading-6 text-foreground sm:max-w-none">
<Link
href={`/documents/${prismaDocument.id}`}
- className="w-full truncate"
+ className="relative block w-full min-w-0 truncate"
>
- <span>{prismaDocument.name}</span>
- <span className="absolute inset-0" />
+ <span className="block truncate">{prismaDocument.name}</span>
+ <span className="absolute inset-0 z-0" aria-hidden />
</Link>
</h2>
{prismaDocument._count.datarooms > 0 && (
- <div className="z-20">
+ <div className="z-20 shrink-0">
<BadgeTooltip
content={`In ${prismaDocument._count.datarooms} dataroom${prismaDocument._count.datarooms > 1 ? "s" : ""}`}
key="dataroom"
@@ -223,7 +223,7 @@ export function HiddenDocumentCard({
</div>
)}
</div>
- <div className="mt-1 flex items-center space-x-1 text-xs leading-5 text-muted-foreground">
+ <div className="mt-1 flex min-w-0 items-center space-x-1 overflow-hidden text-xs leading-5 text-muted-foreground">
<p className="truncate">{timeAgo(prismaDocument.createdAt)}</p>
<p>•</p>
<p className="truncate">
@@ -240,13 +240,13 @@ export function HiddenDocumentCard({
</div>
</div>
- <div className="flex flex-row space-x-2">
+ <div className="flex shrink-0 flex-row space-x-2">
<Link
onClick={(e) => {
e.stopPropagation();
}}
href={`/documents/${prismaDocument.id}`}
- className="z-20 flex items-center space-x-1 rounded-md bg-gray-200 px-1.5 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100 dark:bg-gray-700 sm:px-2"
+ className="z-20 flex shrink-0 items-center space-x-1 rounded-md bg-gray-200 px-1.5 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100 dark:bg-gray-700 sm:px-2"
>
<BarChart className="h-3 w-3 text-muted-foreground sm:h-4 sm:w-4" />
<p className="whitespace-nowrap text-xs text-muted-foreground sm:text-sm">
@@ -259,7 +259,7 @@ export function HiddenDocumentCard({
<DropdownMenuTrigger asChild>
<Button
variant="outline"
- className="z-20 h-8 w-8 border-gray-200 bg-transparent p-0 hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
+ className="z-20 h-8 w-8 shrink-0 border-gray-200 bg-transparent p-0 hover:bg-gray-200 dark:border-gray-700 hover:dark:bg-gray-700 lg:h-9 lg:w-9"
>
<span className="sr-only">Open menu</span>
<MoreVertical className="h-4 w-4" />
diff --git a/components/documents/stats-card.tsx b/components/documents/stats-card.tsx
index 5f46cd5d..053946cc 100644
--- a/components/documents/stats-card.tsx
+++ b/components/documents/stats-card.tsx
@@ -19,14 +19,14 @@ export default function StatsCard({
if (loading) {
return (
- <div className="grid grid-cols-1 space-y-2 border-foreground/5 sm:grid-cols-3 sm:space-x-2 sm:space-y-0 lg:grid-cols-3 lg:space-x-3">
+ <div className="grid grid-cols-3 gap-1.5 border-foreground/5 sm:gap-2 lg:gap-3">
{Array.from({ length: 3 }).map((_, i) => (
<div
- className="rounded-lg border border-foreground/5 px-4 py-6 sm:px-6 lg:px-8"
+ className="rounded-lg border border-foreground/5 px-2 py-2 sm:px-6 sm:py-6 lg:px-8"
key={i}
>
- <Skeleton className="h-6 w-[80%] rounded-sm" />
- <Skeleton className="mt-4 h-8 w-9" />
+ <Skeleton className="h-3 w-[85%] rounded-sm sm:h-6 sm:w-[80%]" />
+ <Skeleton className="mt-2 h-6 w-8 rounded-sm sm:mt-4 sm:h-8 sm:w-9" />
</div>
))}
</div>
@@ -36,16 +36,19 @@ export default function StatsCard({
const statistics = [
{
name: "Number of views",
+ shortName: "Views",
value: stats?.totalViews.toString() ?? "0",
active: true,
},
{
name: "Average view completion",
+ shortName: "Avg. completion",
value: `${stats?.avgCompletionRate ?? 0}%`,
active: true,
},
{
name: "Total average view duration",
+ shortName: "Duration",
value:
stats?.total_duration == null
? "46"
@@ -62,7 +65,7 @@ export default function StatsCard({
];
return stats && stats.views.length > 0 ? (
- <div className="grid grid-cols-1 space-y-2 border-foreground/5 sm:grid-cols-3 sm:space-x-2 sm:space-y-0 lg:grid-cols-3 lg:space-x-3">
+ <div className="grid grid-cols-3 gap-1.5 border-foreground/5 sm:gap-2 lg:gap-3">
{statistics.map((stat, statIdx) => (
<StatsElement key={statIdx} stat={stat} statIdx={statIdx} />
))}
diff --git a/components/documents/stats-element.tsx b/components/documents/stats-element.tsx
index 979bc190..92bd6d49 100644
--- a/components/documents/stats-element.tsx
+++ b/components/documents/stats-element.tsx
@@ -2,6 +2,8 @@ import { cn } from "@/lib/utils";
interface Stat {
name: string;
+ /** Shown below `sm` when set; avoids long labels in narrow 3-up layout */
+ shortName?: string;
value: string;
unit?: string;
active: boolean;
@@ -12,31 +14,38 @@ interface StatsElementProps {
}
export default function StatsElement({ stat, statIdx }: StatsElementProps) {
+ const label = (
+ <>
+ <span className="sm:hidden">{stat.shortName ?? stat.name}</span>
+ <span className="hidden sm:inline">{stat.name}</span>
+ </>
+ );
+
return (
<div
key={statIdx}
- className="overflow-hidden rounded-lg border border-foreground/5 px-6 py-6 xl:px-8"
+ className="min-w-0 overflow-hidden rounded-lg border border-foreground/5 px-2 py-2 sm:px-6 sm:py-6 xl:px-8"
>
<div
className={cn(
- "flex items-center space-x-2 sm:flex-col sm:items-start sm:space-x-0 sm:space-y-2 lg:flex-row lg:items-center lg:space-x-2 lg:space-y-0",
+ "flex flex-col gap-0.5 sm:flex-col sm:items-start sm:gap-2 lg:flex-row lg:items-center lg:gap-2",
!stat.active
? "text-gray-300 dark:text-gray-700"
: "text-muted-foreground",
)}
>
- <p className="whitespace-nowrap text-sm font-medium capitalize leading-6">
- {stat.name}
+ <p className="text-[10px] font-medium capitalize leading-tight sm:whitespace-nowrap sm:text-sm sm:leading-6">
+ {label}
</p>
</div>
- <p className="mt-3 flex items-baseline gap-x-2">
+ <p className="mt-1 flex min-w-0 flex-wrap items-baseline gap-x-0.5 sm:mt-3 sm:gap-x-2">
<span
className={cn(
!stat.active
? "text-gray-300 dark:text-gray-700"
: "text-foreground",
- "text-4xl font-semibold tracking-tight ",
+ "truncate text-lg font-semibold tabular-nums tracking-tight sm:text-4xl",
)}
>
{stat.value}
@@ -47,7 +56,7 @@ export default function StatsElement({ stat, statIdx }: StatsElementProps) {
!stat.active
? "text-gray-300 dark:text-gray-700"
: "text-muted-foreground",
- "text-sm",
+ "text-[10px] leading-none sm:text-sm",
)}
>
{stat.unit}
diff --git a/components/documents/video-analytics.tsx b/components/documents/video-analytics.tsx
index 41b8dd3e..9f23876f 100644
--- a/components/documents/video-analytics.tsx
+++ b/components/documents/video-analytics.tsx
@@ -63,17 +63,20 @@ export default function VideoAnalytics({
const emptyStats = [
{
name: "Total views",
+ shortName: "Views",
value: "0",
active: false,
},
{
name: "Watch time",
+ shortName: "Watch time",
value: "0:00",
unit: "minutes",
active: false,
},
{
name: "Average view duration",
+ shortName: "Avg. duration",
value: "0:00",
unit: "minutes",
active: false,
@@ -83,7 +86,7 @@ export default function VideoAnalytics({
return (
<div className="space-y-4">
<VideoChartPlaceholder length={primaryVersion.length} />
- <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
+ <div className="grid grid-cols-3 gap-1.5 sm:gap-4 lg:gap-4">
{emptyStats.map((stat, index) => (
<StatsElement key={stat.name} stat={stat} statIdx={index} />
))}
@@ -133,17 +136,20 @@ export default function VideoAnalytics({
const stats = [
{
name: "Total views",
+ shortName: "Views",
value: data.overall.unique_views.toString(),
active: true,
},
{
name: "View time",
+ shortName: "View time",
value: formatTime(data.overall.total_watch_time),
unit: "minutes",
active: true,
},
{
name: "Average view duration",
+ shortName: "Avg. duration",
value: formatTime(data.overall.avg_view_duration),
unit: "minutes",
active: true,
@@ -221,7 +227,7 @@ export default function VideoAnalytics({
</ResponsiveContainer>
</div>
- <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
+ <div className="grid grid-cols-3 gap-1.5 sm:gap-4 lg:gap-4">
{stats.map((stat, index) => (
<StatsElement key={stat.name} stat={stat} statIdx={index} />
))}
diff --git a/components/layouts/app.tsx b/components/layouts/app.tsx
index f8754195..5b661947 100644
--- a/components/layouts/app.tsx
+++ b/components/layouts/app.tsx
@@ -5,6 +5,8 @@ import { useCallback, useState } from "react";
import Cookies from "js-cookie";
import { AppBreadcrumb } from "@/components/layouts/breadcrumb";
+import { MobileBottomNav } from "@/components/layouts/mobile-bottom-nav";
+import { MobileHeader } from "@/components/layouts/mobile-header";
import TrialBanner from "@/components/layouts/trial-banner";
import { SidebarPanels } from "@/components/sidebar/sidebar-panels";
import { Separator } from "@/components/ui/separator";
@@ -50,28 +52,35 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
return (
<SidebarProvider open={sidebarOpen} onOpenChange={handleSidebarOpenChange}>
- <div className="flex min-w-0 flex-1 flex-col gap-x-1 bg-gray-50 dark:bg-black md:flex-row">
- <Sidebar
- className="bg-gray-50 dark:bg-black"
- sidebarClassName="bg-gray-50 dark:bg-black"
- side="left"
- variant="inset"
- collapsible="icon"
- >
- <SidebarPanels />
- </Sidebar>
- <SidebarInset className="min-w-0 ring-1 ring-gray-200 dark:ring-gray-800">
- <header className="flex h-10 shrink-0 items-center gap-2">
- <div className="flex items-center gap-2 px-4">
- <SidebarTrigger className="-ml-1" />
- <Separator orientation="vertical" className="mr-1 h-4" />
- <AppBreadcrumb />
- </div>
- </header>
- <TrialBanner />
- <BlockingModal />
- <main className="min-w-0 flex-1">{children}</main>
- </SidebarInset>
+ {/* Single flex child of SidebarProvider so fixed mobile chrome is not laid out as extra row siblings (WebKit / in-app browsers). */}
+ <div className="relative flex min-h-0 min-w-0 flex-1 flex-col">
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col gap-x-1 overflow-x-hidden bg-gray-50 dark:bg-black md:flex-row">
+ <Sidebar
+ className="bg-gray-50 dark:bg-black"
+ sidebarClassName="bg-gray-50 dark:bg-black"
+ side="left"
+ variant="inset"
+ collapsible="icon"
+ >
+ <SidebarPanels />
+ </Sidebar>
+ <SidebarInset className="min-w-0 overflow-x-hidden ring-0 md:ring-1 md:ring-gray-200 md:dark:ring-gray-800">
+ <header className="hidden h-10 shrink-0 items-center gap-2 md:flex">
+ <div className="flex items-center gap-2 px-4">
+ <SidebarTrigger className="-ml-1" />
+ <Separator orientation="vertical" className="mr-1 h-4" />
+ <AppBreadcrumb />
+ </div>
+ </header>
+ <TrialBanner />
+ <BlockingModal />
+ <main className="min-w-0 flex-1 overflow-x-hidden pt-[calc(3.5rem+env(safe-area-inset-top,0px))] pb-[calc(4rem+env(safe-area-inset-bottom,0px))] md:pt-0 md:pb-0">
+ {children}
+ </main>
+ </SidebarInset>
+ </div>
+ <MobileHeader />
+ <MobileBottomNav />
</div>
</SidebarProvider>
);
diff --git a/components/layouts/mobile-bottom-nav.tsx b/components/layouts/mobile-bottom-nav.tsx
index 4ffd2e2d..a3a9d394 100644
--- a/components/layouts/mobile-bottom-nav.tsx
+++ b/components/layouts/mobile-bottom-nav.tsx
@@ -4,10 +4,12 @@ import { useRouter } from "next/router";
import { useState } from "react";
import {
+ BarChart3Icon,
FolderIcon,
HouseIcon,
MoreHorizontalIcon,
ServerIcon,
+ ShieldCheckIcon,
} from "lucide-react";
import { usePlan } from "@/lib/swr/use-billing";
@@ -16,14 +18,21 @@ import { cn } from "@/lib/utils";
import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import { MobileDataroomMoreMenu } from "./mobile-dataroom-more-menu";
import { MobileMoreMenu } from "./mobile-more-menu";
+import { MobileShareFab } from "./mobile-share-fab";
export function MobileBottomNav() {
const router = useRouter();
const [moreOpen, setMoreOpen] = useState(false);
const { isBusiness, isDatarooms, isDataroomsPlus, isTrial } = usePlan();
- const dataroomsEnabled = isBusiness || isDatarooms || isDataroomsPlus || isTrial;
+ const dataroomsEnabled =
+ isBusiness || isDatarooms || isDataroomsPlus || isTrial;
+
+ const dataroomId = router.query.id as string | undefined;
+ const inDataroomDetail =
+ router.pathname.startsWith("/datarooms/[id]") && !!dataroomId;
const isActive = (match: string) => {
if (match === "documents") {
@@ -40,16 +49,88 @@ export function MobileBottomNav() {
const tabClass = (active: boolean) =>
cn(
- "flex flex-1 flex-col items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors",
+ "flex min-w-0 flex-1 flex-col items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors",
active
? "text-foreground"
: "text-muted-foreground hover:text-foreground",
);
+ const documentsTabActive =
+ inDataroomDetail &&
+ (router.pathname === "/datarooms/[id]" ||
+ router.pathname.startsWith("/datarooms/[id]/documents"));
+
+ const permissionsTabActive =
+ inDataroomDetail &&
+ ((router.pathname.includes("permissions") &&
+ !router.pathname.includes("settings")) ||
+ router.pathname.includes("/groups"));
+
+ const analyticsTabActive =
+ inDataroomDetail &&
+ router.pathname.includes("analytics") &&
+ !router.pathname.includes("/groups");
+
+ const dataroomMoreTabActive =
+ inDataroomDetail &&
+ !documentsTabActive &&
+ !permissionsTabActive &&
+ !analyticsTabActive;
+
+ if (inDataroomDetail && dataroomId) {
+ const base = `/datarooms/${dataroomId}`;
+ return (
+ <>
+ <nav className="fixed inset-x-0 bottom-0 z-50 border-t border-border bg-background pb-[env(safe-area-inset-bottom,0px)] [-webkit-tap-highlight-color:transparent] touch-manipulation md:hidden">
+ <div className="flex min-h-[4.5rem] items-end justify-between gap-0.5 px-0.5">
+ <Link
+ href={`${base}/documents`}
+ className={tabClass(!!documentsTabActive)}
+ >
+ <FolderIcon className="h-6 w-6" />
+ <span>Documents</span>
+ </Link>
+ <Link
+ href={`${base}/permissions`}
+ className={tabClass(!!permissionsTabActive)}
+ >
+ <ShieldCheckIcon className="h-6 w-6" />
+ <span>Permissions</span>
+ </Link>
+ <div className="flex w-12 shrink-0 items-center justify-center self-center">
+ <MobileShareFab mode="dataroom" dataroomId={dataroomId} />
+ </div>
+ <Link
+ href={`${base}/analytics`}
+ className={tabClass(!!analyticsTabActive)}
+ >
+ <BarChart3Icon className="h-6 w-6" />
+ <span>Analytics</span>
+ </Link>
+ <button
+ type="button"
+ onClick={() => setMoreOpen(true)}
+ className={tabClass(!!dataroomMoreTabActive)}
+ >
+ <MoreHorizontalIcon className="h-6 w-6" />
+ <span>More</span>
+ </button>
+ </div>
+ </nav>
+
+ <MobileDataroomMoreMenu
+ open={moreOpen}
+ onClose={() => setMoreOpen(false)}
+ dataroomId={dataroomId}
+ />
+ </>
+ );
+ }
+
return (
<>
- <nav className="fixed inset-x-0 bottom-0 z-40 border-t border-border bg-background pb-[env(safe-area-inset-bottom)] md:hidden">
- <div className="flex h-16 items-center justify-around">
+ <nav className="fixed inset-x-0 bottom-0 z-50 border-t border-border bg-background pb-[env(safe-area-inset-bottom,0px)] [-webkit-tap-highlight-color:transparent] touch-manipulation md:hidden">
+ <div className="flex min-h-[4.5rem] items-end justify-between gap-0.5 px-0.5">
<Link href="/dashboard" className={tabClass(isActive("dashboard"))}>
<HouseIcon className="h-6 w-6" />
<span>Dashboard</span>
@@ -58,6 +139,9 @@ export function MobileBottomNav() {
<FolderIcon className="h-6 w-6" />
<span>Documents</span>
</Link>
+ <div className="flex w-12 shrink-0 items-center justify-center self-center">
+ <MobileShareFab mode="global" />
+ </div>
{dataroomsEnabled ? (
<Link href="/datarooms" className={tabClass(isActive("datarooms"))}>
<ServerIcon className="h-6 w-6" />
@@ -69,13 +153,14 @@ export function MobileBottomNav() {
trigger="mobile_nav_datarooms"
highlightItem={["datarooms"]}
>
- <button className={tabClass(false)}>
+ <button type="button" className={tabClass(false)}>
<ServerIcon className="h-6 w-6" />
<span>Datarooms</span>
</button>
</UpgradePlanModal>
)}
<button
+ type="button"
onClick={() => setMoreOpen(true)}
className={tabClass(moreIsActive)}
>
diff --git a/components/layouts/mobile-dataroom-more-menu.tsx b/components/layouts/mobile-dataroom-more-menu.tsx
new file mode 100644
index 00000000..a46f4473
--- /dev/null
+++ b/components/layouts/mobile-dataroom-more-menu.tsx
@@ -0,0 +1,330 @@
+"use client";
+
+import Link from "next/link";
+import { useRouter } from "next/router";
+
+import { useEffect, useState } from "react";
+
+import { PlanEnum } from "@/ee/stripe/constants";
+import {
+ BarChart3Icon,
+ BrushIcon,
+ ChevronDownIcon,
+ CogIcon,
+ ContactIcon,
+ HouseIcon,
+ LinkIcon,
+ LogsIcon,
+ MessageSquareIcon,
+ ServerIcon,
+ ShieldCheckIcon,
+ UsersIcon,
+ XIcon,
+} from "lucide-react";
+
+import useLimits from "@/lib/swr/use-limits";
+import { cn } from "@/lib/utils";
+
+import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import { DataroomLinkSheet } from "@/components/links/link-sheet/dataroom-link-sheet";
+import { Button } from "@/components/ui/button";
+import { Separator } from "@/components/ui/separator";
+
+interface MobileDataroomMoreMenuProps {
+ open: boolean;
+ onClose: () => void;
+ dataroomId: string;
+}
+
+function permissionsSectionActive(pathname: string) {
+ return (
+ (pathname.includes("permissions") && !pathname.includes("settings")) ||
+ pathname.includes("/groups")
+ );
+}
+
+function analyticsSubActive(pathname: string) {
+ return pathname.includes("audit-log");
+}
+
+export function MobileDataroomMoreMenu({
+ open,
+ onClose,
+ dataroomId,
+}: MobileDataroomMoreMenuProps) {
+ const router = useRouter();
+ const { limits } = useLimits();
+ const [settingsExpanded, setSettingsExpanded] = useState(() =>
+ router.pathname.includes("/settings"),
+ );
+ const [permissionsExpanded, setPermissionsExpanded] = useState(() =>
+ permissionsSectionActive(router.pathname),
+ );
+ const [analyticsExpanded, setAnalyticsExpanded] = useState(() =>
+ analyticsSubActive(router.pathname),
+ );
+ const [linkSheetOpen, setLinkSheetOpen] = useState(false);
+
+ useEffect(() => {
+ if (open) {
+ document.body.style.overflow = "hidden";
+ setPermissionsExpanded(permissionsSectionActive(router.pathname));
+ setAnalyticsExpanded(analyticsSubActive(router.pathname));
+ if (router.pathname.includes("/settings")) {
+ setSettingsExpanded(true);
+ }
+ } else {
+ document.body.style.overflow = "";
+ }
+ return () => {
+ document.body.style.overflow = "";
+ };
+ }, [open, router.pathname]);
+
+ const rowClass = (active: boolean) =>
+ cn(
+ "flex w-full items-center gap-3 rounded-lg px-3 py-3 text-sm font-medium transition-colors",
+ active
+ ? "bg-muted text-foreground"
+ : "text-muted-foreground hover:bg-muted hover:text-foreground",
+ );
+
+ const subLinkClass = (href: string) =>
+ cn(
+ "block rounded-md px-3 py-2 text-sm transition-colors",
+ router.asPath.split("?")[0] === href ||
+ router.asPath.split("?")[0].startsWith(`${href}/`)
+ ? "font-medium text-foreground"
+ : "text-muted-foreground hover:text-foreground",
+ );
+
+ const base = `/datarooms/${dataroomId}`;
+
+ const settingsSubItems = [
+ { label: "General", href: `${base}/settings` },
+ { label: "Introduction", href: `${base}/settings/introduction` },
+ { label: "Notifications", href: `${base}/settings/notifications` },
+ { label: "Downloads", href: `${base}/settings/downloads` },
+ { label: "File Permissions", href: `${base}/settings/file-permissions` },
+ ];
+
+ return (
+ <>
+ {open ? (
+ <div className="fixed inset-0 z-50 flex flex-col bg-background pt-[env(safe-area-inset-top,0px)] pb-[env(safe-area-inset-bottom,0px)] [-webkit-tap-highlight-color:transparent] touch-manipulation md:hidden">
+ <div className="flex h-14 shrink-0 items-center justify-between border-b border-border px-4">
+ <span className="text-lg font-semibold">More</span>
+ <button
+ type="button"
+ onClick={onClose}
+ className="rounded-full p-2 text-muted-foreground hover:bg-muted hover:text-foreground"
+ >
+ <XIcon className="h-5 w-5" />
+ </button>
+ </div>
+
+ <div className="min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-4 py-4">
+ <div className="space-y-1">
+ <Button
+ type="button"
+ variant="secondary"
+ className="mb-3 w-full"
+ onClick={() => {
+ onClose();
+ setLinkSheetOpen(true);
+ }}
+ >
+ Share dataroom
+ </Button>
+
+ <Link
+ href="/dashboard"
+ onClick={onClose}
+ className={rowClass(false)}
+ >
+ <HouseIcon className="h-5 w-5" />
+ Dashboard
+ </Link>
+
+ <Link
+ href="/datarooms"
+ onClick={onClose}
+ className={rowClass(false)}
+ >
+ <ServerIcon className="h-5 w-5" />
+ All datarooms
+ </Link>
+
+ <Separator className="my-3" />
+
+ <div>
+ <button
+ type="button"
+ onClick={() => setPermissionsExpanded((v) => !v)}
+ className={rowClass(
+ permissionsSectionActive(router.pathname),
+ )}
+ >
+ <ShieldCheckIcon className="h-5 w-5" />
+ Permissions
+ <ChevronDownIcon
+ className={cn(
+ "ml-auto h-4 w-4 transition-transform",
+ permissionsExpanded && "rotate-180",
+ )}
+ />
+ </button>
+ {permissionsExpanded && (
+ <div className="ml-8 mt-1 space-y-0.5 border-l border-border pl-3">
+ <Link
+ href={`${base}/permissions`}
+ onClick={onClose}
+ className={subLinkClass(`${base}/permissions`)}
+ >
+ <span className="flex items-center gap-2">
+ <LinkIcon className="h-4 w-4 shrink-0" />
+ Links
+ </span>
+ </Link>
+ <Link
+ href={`${base}/groups`}
+ onClick={onClose}
+ className={subLinkClass(`${base}/groups`)}
+ >
+ <span className="flex items-center gap-2">
+ <UsersIcon className="h-4 w-4 shrink-0" />
+ Groups
+ </span>
+ </Link>
+ </div>
+ )}
+ </div>
+
+ <div>
+ <button
+ type="button"
+ onClick={() => setAnalyticsExpanded((v) => !v)}
+ className={rowClass(analyticsSubActive(router.pathname))}
+ >
+ <BarChart3Icon className="h-5 w-5" />
+ Analytics
+ <ChevronDownIcon
+ className={cn(
+ "ml-auto h-4 w-4 transition-transform",
+ analyticsExpanded && "rotate-180",
+ )}
+ />
+ </button>
+ {analyticsExpanded && (
+ <div className="ml-8 mt-1 space-y-0.5 border-l border-border pl-3">
+ <Link
+ href={`${base}/analytics`}
+ onClick={onClose}
+ className={subLinkClass(`${base}/analytics`)}
+ >
+ <span className="flex items-center gap-2">
+ <BarChart3Icon className="h-4 w-4 shrink-0" />
+ Overview
+ </span>
+ </Link>
+ <Link
+ href={`${base}/analytics/audit-log`}
+ onClick={onClose}
+ className={subLinkClass(`${base}/analytics/audit-log`)}
+ >
+ <span className="flex items-center gap-2">
+ <LogsIcon className="h-4 w-4 shrink-0" />
+ Audit log
+ </span>
+ </Link>
+ </div>
+ )}
+ </div>
+
+ <Separator className="my-3" />
+
+ {!limits?.conversationsInDataroom ? (
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.DataRoomsPlus}
+ trigger="mobile_dataroom_more_qa"
+ highlightItem={["qa"]}
+ >
+ <button type="button" className={rowClass(false)}>
+ <MessageSquareIcon className="h-5 w-5" />
+ Q&A
+ </button>
+ </UpgradePlanModal>
+ ) : (
+ <Link
+ href={`${base}/conversations`}
+ onClick={onClose}
+ className={rowClass(
+ router.pathname.includes("conversations"),
+ )}
+ >
+ <MessageSquareIcon className="h-5 w-5" />
+ Q&A
+ </Link>
+ )}
+
+ <Link
+ href={`${base}/users`}
+ onClick={onClose}
+ className={rowClass(router.pathname.includes("/users"))}
+ >
+ <ContactIcon className="h-5 w-5" />
+ Visitors
+ </Link>
+
+ <Link
+ href={`${base}/branding`}
+ onClick={onClose}
+ className={rowClass(router.pathname.includes("branding"))}
+ >
+ <BrushIcon className="h-5 w-5" />
+ Branding
+ </Link>
+
+ <div>
+ <button
+ type="button"
+ onClick={() => setSettingsExpanded((v) => !v)}
+ className={rowClass(router.pathname.includes("/settings"))}
+ >
+ <CogIcon className="h-5 w-5" />
+ Settings
+ <ChevronDownIcon
+ className={cn(
+ "ml-auto h-4 w-4 transition-transform",
+ settingsExpanded && "rotate-180",
+ )}
+ />
+ </button>
+ {settingsExpanded && (
+ <div className="ml-8 mt-1 space-y-0.5 border-l border-border pl-3">
+ {settingsSubItems.map((sub) => (
+ <Link
+ key={sub.href}
+ href={sub.href}
+ onClick={onClose}
+ className={subLinkClass(sub.href)}
+ >
+ {sub.label}
+ </Link>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+ </div>
+ </div>
+ ) : null}
+
+ <DataroomLinkSheet
+ isOpen={linkSheetOpen}
+ setIsOpen={setLinkSheetOpen}
+ linkType="DATAROOM_LINK"
+ />
+ </>
+ );
+}
diff --git a/components/layouts/mobile-header.tsx b/components/layouts/mobile-header.tsx
index 4a5b253b..d28b0057 100644
--- a/components/layouts/mobile-header.tsx
+++ b/components/layouts/mobile-header.tsx
@@ -1,14 +1,17 @@
import Link from "next/link";
+import { useRouter } from "next/router";
import {
+ ChevronLeftIcon,
CircleUserRound,
- LifeBuoyIcon,
LogOut,
MailIcon,
} from "lucide-react";
import { signOut, useSession } from "next-auth/react";
import { toast } from "sonner";
+import { useDataroom } from "@/lib/swr/use-dataroom";
+
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import {
DropdownMenu,
@@ -24,94 +27,125 @@ import { ModeToggle } from "../theme-toggle";
export function MobileHeader() {
const { data: session } = useSession();
+ const router = useRouter();
+
+ const inDataroom =
+ router.pathname.startsWith("/datarooms/[id]") && !!router.query.id;
+ const { dataroom } = useDataroom();
return (
- <header className="fixed inset-x-0 top-0 z-40 flex h-14 items-center justify-between border-b border-border bg-background px-4 md:hidden">
- <Link
- href="/dashboard"
- className="text-xl font-bold tracking-tighter text-foreground"
- >
- Papermark
- </Link>
+ <header className="fixed inset-x-0 top-0 z-50 flex flex-col border-b border-border bg-background pt-[env(safe-area-inset-top,0px)] md:hidden">
+ <div className="flex h-14 shrink-0 touch-manipulation items-center justify-between gap-2 px-4">
+ {inDataroom && dataroom?.name ? (
+ <div className="flex min-w-0 flex-1 items-center gap-1">
+ <Link
+ href="/datarooms"
+ className="-ml-1 flex shrink-0 items-center justify-center rounded-md p-1 text-muted-foreground active:bg-muted"
+ aria-label="Back to datarooms"
+ >
+ <ChevronLeftIcon className="h-5 w-5" />
+ </Link>
+ <p className="min-w-0 truncate text-base font-semibold tracking-tight text-foreground">
+ {dataroom.name}
+ </p>
+ </div>
+ ) : (
+ <Link
+ href="/dashboard"
+ className="text-xl font-bold tracking-tighter text-foreground"
+ >
+ Papermark
+ </Link>
+ )}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button className="rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring">
- <Avatar className="h-8 w-8">
- <AvatarImage
- src={session?.user?.image || ""}
- alt={session?.user?.name || ""}
- />
- <AvatarFallback className="text-xs">
- {session?.user?.name?.charAt(0) ||
- session?.user?.email?.charAt(0)}
- </AvatarFallback>
- </Avatar>
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="w-56 rounded-lg"
- side="bottom"
- align="end"
- sideOffset={8}
- >
- <DropdownMenuLabel className="p-0 font-normal">
- <div className="flex items-center gap-2 px-2 py-1.5 text-left text-sm">
- <Avatar className="h-8 w-8 rounded-lg">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ className="rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <Avatar className="h-8 w-8">
<AvatarImage
src={session?.user?.image || ""}
alt={session?.user?.name || ""}
/>
- <AvatarFallback className="rounded-lg">
+ <AvatarFallback className="text-xs">
{session?.user?.name?.charAt(0) ||
session?.user?.email?.charAt(0)}
</AvatarFallback>
</Avatar>
- <div className="grid flex-1 text-left text-sm leading-tight">
- <span className="truncate font-semibold">
- {session?.user?.name || ""}
- </span>
- <span className="truncate text-xs text-muted-foreground">
- {session?.user?.email || ""}
- </span>
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ collisionPadding={{
+ top: 8,
+ bottom: 8,
+ left: 12,
+ right: 12,
+ }}
+ className="w-56 rounded-lg"
+ side="bottom"
+ align="end"
+ sideOffset={8}
+ >
+ <DropdownMenuLabel className="p-0 font-normal">
+ <div className="flex items-center gap-2 px-2 py-1.5 text-left text-sm">
+ <Avatar className="h-8 w-8 rounded-lg">
+ <AvatarImage
+ src={session?.user?.image || ""}
+ alt={session?.user?.name || ""}
+ />
+ <AvatarFallback className="rounded-lg">
+ {session?.user?.name?.charAt(0) ||
+ session?.user?.email?.charAt(0)}
+ </AvatarFallback>
+ </Avatar>
+ <div className="grid flex-1 text-left text-sm leading-tight">
+ <span className="truncate font-semibold">
+ {session?.user?.name || ""}
+ </span>
+ <span className="truncate text-xs text-muted-foreground">
+ {session?.user?.email || ""}
+ </span>
+ </div>
</div>
- </div>
- </DropdownMenuLabel>
- <DropdownMenuSeparator />
- <ModeToggle />
- <DropdownMenuGroup>
- <Link href="/account/general">
- <DropdownMenuItem>
- <CircleUserRound className="mr-2 h-4 w-4" />
- User Settings
+ </DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ <ModeToggle />
+ <DropdownMenuGroup>
+ <Link href="/account/general">
+ <DropdownMenuItem>
+ <CircleUserRound className="mr-2 h-4 w-4" />
+ User Settings
+ </DropdownMenuItem>
+ </Link>
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ <DropdownMenuGroup>
+ <DropdownMenuItem
+ onClick={() => {
+ navigator.clipboard.writeText("[email protected]");
+ toast.success("[email protected] copied to clipboard");
+ }}
+ >
+ <MailIcon className="mr-2 h-4 w-4" />
+ Contact Support
</DropdownMenuItem>
- </Link>
- </DropdownMenuGroup>
- <DropdownMenuSeparator />
- <DropdownMenuGroup>
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
<DropdownMenuItem
- onClick={() => {
- navigator.clipboard.writeText("[email protected]");
- toast.success("[email protected] copied to clipboard");
- }}
+ onClick={() =>
+ signOut({
+ callbackUrl: `${window.location.origin}`,
+ })
+ }
>
- <MailIcon className="mr-2 h-4 w-4" />
- Contact Support
+ <LogOut className="mr-2 h-4 w-4" />
+ Log out
</DropdownMenuItem>
- </DropdownMenuGroup>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onClick={() =>
- signOut({
- callbackUrl: `${window.location.origin}`,
- })
- }
- >
- <LogOut className="mr-2 h-4 w-4" />
- Log out
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
</header>
);
}
diff --git a/components/layouts/mobile-more-menu.tsx b/components/layouts/mobile-more-menu.tsx
index 293871af..631400a9 100644
--- a/components/layouts/mobile-more-menu.tsx
+++ b/components/layouts/mobile-more-menu.tsx
@@ -74,10 +74,11 @@ export function MobileMoreMenu({ open, onClose }: MobileMoreMenuProps) {
];
return (
- <div className="fixed inset-0 z-50 flex flex-col bg-background md:hidden">
- <div className="flex h-14 items-center justify-between border-b border-border px-4">
+ <div className="fixed inset-0 z-50 flex flex-col bg-background pt-[env(safe-area-inset-top,0px)] pb-[env(safe-area-inset-bottom,0px)] [-webkit-tap-highlight-color:transparent] touch-manipulation md:hidden">
+ <div className="flex h-14 shrink-0 items-center justify-between border-b border-border px-4">
<span className="text-lg font-semibold">More</span>
<button
+ type="button"
onClick={onClose}
className="rounded-full p-2 text-muted-foreground hover:bg-muted hover:text-foreground"
>
@@ -85,7 +86,7 @@ export function MobileMoreMenu({ open, onClose }: MobileMoreMenuProps) {
</button>
</div>
- <div className="flex-1 overflow-y-auto px-4 py-4">
+ <div className="min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-4 py-4">
<div className="space-y-1">
{isFree && !isTrial ? (
<UpgradePlanModal
diff --git a/components/layouts/mobile-share-fab.tsx b/components/layouts/mobile-share-fab.tsx
new file mode 100644
index 00000000..050f6140
--- /dev/null
+++ b/components/layouts/mobile-share-fab.tsx
@@ -0,0 +1,321 @@
+"use client";
+
+import { useRouter } from "next/router";
+
+import { useCallback, useEffect, useState } from "react";
+
+import { LinkType } from "@prisma/client";
+import {
+ FileTextIcon,
+ FolderArchiveIcon,
+ Link2Icon,
+ ServerIcon,
+ XIcon,
+} from "lucide-react";
+import useSWR from "swr";
+
+import { useTeam } from "@/context/team-context";
+import useDataroomsSimple from "@/lib/swr/use-datarooms-simple";
+import { DocumentWithLinksAndLinkCountAndViewCount } from "@/lib/types";
+import { cn, fetcher } from "@/lib/utils";
+
+import LinkSheet from "@/components/links/link-sheet";
+import { DataroomLinkSheet } from "@/components/links/link-sheet/dataroom-link-sheet";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { ScrollArea } from "@/components/ui/scroll-area";
+import {
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle,
+} from "@/components/ui/sheet";
+
+type MobileShareFabProps = {
+ mode: "global" | "dataroom";
+ /** Current dataroom id when `mode === "dataroom"` */
+ dataroomId?: string;
+};
+
+export function MobileShareFab({ mode, dataroomId }: MobileShareFabProps) {
+ const router = useRouter();
+ const teamInfo = useTeam();
+ const teamId = teamInfo?.currentTeam?.id;
+ const { datarooms: dataroomList, loading: dataroomsLoading } =
+ useDataroomsSimple();
+
+ const [chooseOpen, setChooseOpen] = useState(false);
+ const [docPickerOpen, setDocPickerOpen] = useState(false);
+ const [drPickerOpen, setDrPickerOpen] = useState(false);
+ const [docLinkOpen, setDocLinkOpen] = useState(false);
+ const [drLinkOpen, setDrLinkOpen] = useState(false);
+ const [dataroomLinkOpen, setDataroomLinkOpen] = useState(false);
+ const [pickedDocumentId, setPickedDocumentId] = useState<string | null>(null);
+ const [pickedDataroomId, setPickedDataroomId] = useState<string | null>(null);
+ const [docSearch, setDocSearch] = useState("");
+ const [debouncedDocSearch, setDebouncedDocSearch] = useState("");
+
+ useEffect(() => {
+ const t = setTimeout(() => setDebouncedDocSearch(docSearch), 300);
+ return () => clearTimeout(t);
+ }, [docSearch]);
+
+ useEffect(() => {
+ if (!docLinkOpen) {
+ setPickedDocumentId(null);
+ }
+ }, [docLinkOpen]);
+
+ useEffect(() => {
+ if (!drLinkOpen) {
+ setPickedDataroomId(null);
+ }
+ }, [drLinkOpen]);
+
+ const documentsUrl =
+ teamId && docPickerOpen
+ ? `/api/teams/${teamId}/documents?sort=createdAt&page=1&limit=25${
+ debouncedDocSearch
+ ? `&query=${encodeURIComponent(debouncedDocSearch)}`
+ : ""
+ }`
+ : null;
+
+ const { data: docListData, isLoading: docListLoading } = useSWR<{
+ documents: DocumentWithLinksAndLinkCountAndViewCount[];
+ }>(documentsUrl, fetcher, { keepPreviousData: true });
+
+ const documents = docListData?.documents ?? [];
+
+ const openDataroomLinkFor = useCallback((id: string) => {
+ setPickedDataroomId(id);
+ setDrPickerOpen(false);
+ setChooseOpen(false);
+ setDrLinkOpen(true);
+ }, []);
+
+ const handlePlusClick = () => {
+ if (mode === "dataroom" && dataroomId) {
+ setDataroomLinkOpen(true);
+ return;
+ }
+ setChooseOpen(true);
+ };
+
+ const handlePickDocument = (id: string) => {
+ setPickedDocumentId(id);
+ setDocPickerOpen(false);
+ setChooseOpen(false);
+ setDocLinkOpen(true);
+ };
+
+ const handlePickDataroom = (id: string) => {
+ openDataroomLinkFor(id);
+ };
+
+ const afterDocumentLinkCreated = useCallback(
+ (id: string) => {
+ setDocLinkOpen(false);
+ void router.push(`/documents/${id}`);
+ },
+ [router],
+ );
+
+ return (
+ <>
+ <button
+ type="button"
+ onClick={handlePlusClick}
+ aria-label="Create share link"
+ className="flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-black text-white shadow-md ring-4 ring-background [-webkit-tap-highlight-color:transparent] touch-manipulation dark:ring-background"
+ >
+ <Link2Icon className="h-5 w-5" strokeWidth={2.25} />
+ </button>
+
+ {mode === "dataroom" && dataroomId ? (
+ <DataroomLinkSheet
+ isOpen={dataroomLinkOpen}
+ setIsOpen={setDataroomLinkOpen}
+ linkType={LinkType.DATAROOM_LINK}
+ linkTargetId={dataroomId}
+ />
+ ) : null}
+
+ <Sheet open={chooseOpen} onOpenChange={setChooseOpen}>
+ <SheetContent
+ side="bottom"
+ className="rounded-t-xl border-t px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2 md:hidden"
+ >
+ <SheetHeader className="text-left">
+ <SheetTitle>Share</SheetTitle>
+ </SheetHeader>
+ <div className="mt-4 grid gap-3">
+ <Button
+ type="button"
+ variant="outline"
+ className="h-auto justify-start gap-3 py-4 text-left"
+ onClick={() => {
+ setChooseOpen(false);
+ setDocPickerOpen(true);
+ }}
+ >
+ <FileTextIcon className="h-5 w-5 shrink-0" />
+ <span>
+ <span className="block font-medium">Document</span>
+ <span className="text-xs font-normal text-muted-foreground">
+ Create a link to a document
+ </span>
+ </span>
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ className="h-auto justify-start gap-3 py-4 text-left"
+ onClick={() => {
+ setChooseOpen(false);
+ setDrPickerOpen(true);
+ }}
+ >
+ <FolderArchiveIcon className="h-5 w-5 shrink-0" />
+ <span>
+ <span className="block font-medium">Dataroom</span>
+ <span className="text-xs font-normal text-muted-foreground">
+ Create a link to a data room
+ </span>
+ </span>
+ </Button>
+ </div>
+ </SheetContent>
+ </Sheet>
+
+ <Sheet open={docPickerOpen} onOpenChange={setDocPickerOpen}>
+ <SheetContent
+ side="bottom"
+ className="flex max-h-[85dvh] flex-col rounded-t-xl border-t px-0 pb-[max(0.5rem,env(safe-area-inset-bottom))] pt-2 md:hidden"
+ >
+ <SheetHeader className="space-y-3 px-4 text-left">
+ <div className="flex items-center justify-between gap-2">
+ <SheetTitle>Choose document</SheetTitle>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ className="shrink-0"
+ onClick={() => setDocPickerOpen(false)}
+ >
+ <XIcon className="h-5 w-5" />
+ </Button>
+ </div>
+ <Input
+ placeholder="Search documents…"
+ value={docSearch}
+ onChange={(e) => setDocSearch(e.target.value)}
+ className="bg-muted/50"
+ />
+ </SheetHeader>
+ <ScrollArea className="mt-2 min-h-0 flex-1 px-2">
+ <div className="space-y-0.5 pb-4">
+ {docListLoading && !documents.length ? (
+ <p className="px-3 py-6 text-center text-sm text-muted-foreground">
+ Loading…
+ </p>
+ ) : documents.length === 0 ? (
+ <p className="px-3 py-6 text-center text-sm text-muted-foreground">
+ No documents found.
+ </p>
+ ) : (
+ documents.map((doc) => (
+ <button
+ key={doc.id}
+ type="button"
+ onClick={() => handlePickDocument(doc.id)}
+ className={cn(
+ "flex w-full items-center gap-3 rounded-lg px-3 py-3 text-left text-sm transition-colors",
+ "hover:bg-muted",
+ )}
+ >
+ <FileTextIcon className="h-4 w-4 shrink-0 text-muted-foreground" />
+ <span className="min-w-0 flex-1 truncate font-medium">
+ {doc.name}
+ </span>
+ </button>
+ ))
+ )}
+ </div>
+ </ScrollArea>
+ </SheetContent>
+ </Sheet>
+
+ <Sheet open={drPickerOpen} onOpenChange={setDrPickerOpen}>
+ <SheetContent
+ side="bottom"
+ className="flex max-h-[85dvh] flex-col rounded-t-xl border-t px-0 pb-[max(0.5rem,env(safe-area-inset-bottom))] pt-2 md:hidden"
+ >
+ <SheetHeader className="px-4 text-left">
+ <div className="flex items-center justify-between gap-2">
+ <SheetTitle>Choose dataroom</SheetTitle>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ className="shrink-0"
+ onClick={() => setDrPickerOpen(false)}
+ >
+ <XIcon className="h-5 w-5" />
+ </Button>
+ </div>
+ </SheetHeader>
+ <ScrollArea className="mt-2 min-h-0 flex-1 px-2">
+ <div className="space-y-0.5 pb-4">
+ {dataroomsLoading && !dataroomList?.length ? (
+ <p className="px-3 py-6 text-center text-sm text-muted-foreground">
+ Loading…
+ </p>
+ ) : !dataroomList?.length ? (
+ <p className="px-3 py-6 text-center text-sm text-muted-foreground">
+ No datarooms yet.
+ </p>
+ ) : (
+ dataroomList.map((dr) => (
+ <button
+ key={dr.id}
+ type="button"
+ onClick={() => handlePickDataroom(dr.id)}
+ className={cn(
+ "flex w-full items-center gap-3 rounded-lg px-3 py-3 text-left text-sm transition-colors",
+ "hover:bg-muted",
+ )}
+ >
+ <ServerIcon className="h-4 w-4 shrink-0 text-muted-foreground" />
+ <span className="min-w-0 flex-1 truncate font-medium">
+ {dr.internalName || dr.name}
+ </span>
+ </button>
+ ))
+ )}
+ </div>
+ </ScrollArea>
+ </SheetContent>
+ </Sheet>
+
+ {pickedDocumentId ? (
+ <LinkSheet
+ isOpen={docLinkOpen}
+ setIsOpen={setDocLinkOpen}
+ linkType={LinkType.DOCUMENT_LINK}
+ linkTargetId={pickedDocumentId}
+ onLinkCreatedNavigate={afterDocumentLinkCreated}
+ />
+ ) : null}
+
+ {pickedDataroomId ? (
+ <DataroomLinkSheet
+ isOpen={drLinkOpen}
+ setIsOpen={setDrLinkOpen}
+ linkType={LinkType.DATAROOM_LINK}
+ linkTargetId={pickedDataroomId}
+ />
+ ) : null}
+ </>
+ );
+}
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index a9b62c7e..aac4b218 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -149,18 +149,25 @@ export default function LinkSheet({
linkType,
currentLink,
existingLinks,
+ linkTargetId,
+ onLinkCreatedNavigate,
}: {
isOpen: boolean;
setIsOpen: Dispatch<SetStateAction<boolean>>;
linkType: Omit<LinkType, "WORKFLOW_LINK">;
currentLink?: DEFAULT_LINK_TYPE;
existingLinks?: LinkWithViews[];
+ /** When set (e.g. mobile share), used instead of `router.query.id` for API calls */
+ linkTargetId?: string | null;
+ /** Called after a new link is created (not on update) */
+ onLinkCreatedNavigate?: (targetId: string) => void;
}) {
const router = useRouter();
- const { id: targetId, groupId } = router.query as {
- id: string;
+ const { id: routeId, groupId } = router.query as {
+ id?: string;
groupId?: string;
};
+ const targetId = linkTargetId ?? routeId;
const { domains } = useDomains({ enabled: isOpen });
@@ -168,7 +175,12 @@ export default function LinkSheet({
viewerGroups,
loading: isLoadingGroups,
mutate: mutateGroups,
- } = useDataroomGroups();
+ } = useDataroomGroups({
+ dataroomId:
+ linkType === LinkType.DATAROOM_LINK
+ ? (linkTargetId ?? undefined)
+ : undefined,
+ });
const teamInfo = useTeam();
const { isFree, isPro, isBusiness, isDatarooms, isDataroomsPlus, isTrial } =
usePlan();
@@ -297,6 +309,11 @@ export default function LinkSheet({
const handleSubmit = async (event: any, shouldPreview: boolean = false) => {
event.preventDefault();
+ if (!targetId) {
+ toast.error("Missing document or dataroom");
+ return;
+ }
+
setIsSaving(true);
// Upload the image if it's a data URL
@@ -574,6 +591,7 @@ export default function LinkSheet({
});
toast.success("Link created successfully");
+ onLinkCreatedNavigate?.(targetId);
}
setData(DEFAULT_LINK_PROPS(linkType, groupId));
diff --git a/components/sidebar/dataroom-sidebar.tsx b/components/sidebar/dataroom-sidebar.tsx
index 7265a5cb..2b29be54 100644
--- a/components/sidebar/dataroom-sidebar.tsx
+++ b/components/sidebar/dataroom-sidebar.tsx
@@ -19,7 +19,6 @@ import {
LinkIcon,
LogsIcon,
MessageSquareIcon,
- SendIcon,
ShieldCheckIcon,
ShieldIcon,
TableIcon,
@@ -49,13 +48,7 @@ import {
SidebarMenuSub,
SidebarMenuSubButton,
SidebarMenuSubItem,
- useSidebar,
} from "@/components/ui/sidebar";
-import {
- Tooltip,
- TooltipContent,
- TooltipTrigger,
-} from "@/components/ui/tooltip";
function ScrollingText({
children,
@@ -120,7 +113,6 @@ export function DataroomSidebarContent() {
const router = useRouter();
const { dataroom } = useDataroom();
const { limits } = useLimits();
- const { state } = useSidebar();
const dataroomId = dataroom?.id ?? (router.query.id as string);
const [isLinkSheetOpen, setIsLinkSheetOpen] = useState(false);
@@ -255,30 +247,6 @@ export function DataroomSidebarContent() {
</SidebarHeader>
<SidebarContent>
- <SidebarGroup>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- className="w-full group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2"
- size="sm"
- onClick={() => setIsLinkSheetOpen(true)}
- >
- <span className="group-data-[collapsible=icon]:hidden">
- Share dataroom
- </span>
- <SendIcon className="hidden !size-4 shrink-0 group-data-[collapsible=icon]:block" />
- </Button>
- </TooltipTrigger>
- <TooltipContent
- side="right"
- align="center"
- hidden={state !== "collapsed"}
- >
- Share dataroom
- </TooltipContent>
- </Tooltip>
- </SidebarGroup>
-
<SidebarGroup>
<SidebarMenu className="space-y-0.5 text-foreground">
{navItems.map((item) => {
@@ -381,6 +349,16 @@ export function DataroomSidebarContent() {
})}
</SidebarMenu>
</SidebarGroup>
+
+ <SidebarGroup>
+ <Button
+ className="w-full"
+ size="sm"
+ onClick={() => setIsLinkSheetOpen(true)}
+ >
+ Share dataroom
+ </Button>
+ </SidebarGroup>
</SidebarContent>
<DataroomLinkSheet
diff --git a/components/tab-menu.tsx b/components/tab-menu.tsx
index 7e7f87e5..56d8b648 100644
--- a/components/tab-menu.tsx
+++ b/components/tab-menu.tsx
@@ -28,7 +28,7 @@ export const TabMenu: React.FC<React.PropsWithChildren<Props>> = ({
<nav
className={cn("sticky top-0 bg-background dark:bg-gray-950", className)}
>
- <div className="flex w-full items-center overflow-x-auto px-4">
+ <div className="flex w-full items-center overflow-x-auto px-0 md:px-4">
<ul className="flex flex-row gap-4">
{navigation.map(
({ label, href, value, currentValue, count, tag, disabled }) => (
diff --git a/components/ui/multi-select-v2.tsx b/components/ui/multi-select-v2.tsx
index b0d2750e..9ae23c26 100644
--- a/components/ui/multi-select-v2.tsx
+++ b/components/ui/multi-select-v2.tsx
@@ -230,8 +230,13 @@ export const MultiSelect = React.forwardRef<
ref={ref}
{...props}
onClick={handleTogglePopover}
+ variant="outline"
+ size="sm"
className={cn(
- "flex h-auto w-full items-center justify-between rounded-md border border-input bg-inherit px-3 py-1.5 hover:bg-inherit focus:border-muted-foreground focus:outline-none focus:ring-1 focus:ring-inset focus:ring-muted-foreground dark:border-gray-500 dark:bg-gray-800 focus:dark:bg-transparent [&_svg]:pointer-events-auto",
+ "flex w-full items-center justify-between gap-1.5 rounded-md border border-input bg-background px-2 py-0 font-normal shadow-sm hover:bg-background focus:border-muted-foreground focus:outline-none focus:ring-1 focus:ring-inset focus:ring-muted-foreground dark:border-gray-500 dark:bg-gray-800 focus:dark:bg-transparent sm:gap-2 sm:px-3 [&_svg]:pointer-events-auto",
+ value.length === 0
+ ? "h-9 max-h-9 min-h-9 sm:h-10 sm:max-h-10 sm:min-h-10"
+ : "!h-auto min-h-9 py-1 sm:min-h-10 sm:py-1.5",
className,
)}
>
@@ -266,8 +271,8 @@ export const MultiSelect = React.forwardRef<
</div>
</div>
) : (
- <div className="mx-auto flex w-full items-center justify-between">
- <span className="py-[3px] text-sm font-normal text-muted-foreground">
+ <div className="mx-auto flex w-full min-w-0 items-center justify-between">
+ <span className="truncate py-0 text-sm font-normal leading-none text-muted-foreground">
{placeholder}
</span>
</div>
diff --git a/components/visitors/dataroom-visitors-table.tsx b/components/visitors/dataroom-visitors-table.tsx
index 21056683..ef92be68 100644
--- a/components/visitors/dataroom-visitors-table.tsx
+++ b/components/visitors/dataroom-visitors-table.tsx
@@ -90,8 +90,8 @@ export default function DataroomVisitorsTable({
Export visits
</Button>
</div>
- <div className="rounded-md border">
- <Table className="table-fixed">
+ <div className="overflow-x-auto rounded-md border">
+ <Table className="min-w-[600px] table-fixed">
<TableHeader>
<TableRow className="*:whitespace-nowrap *:font-medium hover:bg-transparent">
<TableHead>Name</TableHead>
diff --git a/ee/features/permissions/components/dataroom-link-sheet.tsx b/ee/features/permissions/components/dataroom-link-sheet.tsx
index 19913b27..94a21aaa 100644
--- a/ee/features/permissions/components/dataroom-link-sheet.tsx
+++ b/ee/features/permissions/components/dataroom-link-sheet.tsx
@@ -82,18 +82,22 @@ export function DataroomLinkSheet({
linkType,
currentLink,
existingLinks,
+ linkTargetId,
}: {
isOpen: boolean;
setIsOpen: Dispatch<SetStateAction<boolean>>;
linkType: LinkType;
currentLink?: DEFAULT_LINK_TYPE;
existingLinks?: LinkWithViews[];
+ /** When set (e.g. mobile share from global nav), used instead of `router.query.id` */
+ linkTargetId?: string | null;
}) {
const router = useRouter();
- const { id: targetId, groupId } = router.query as {
- id: string;
+ const { id: routeId, groupId } = router.query as {
+ id?: string;
groupId?: string;
};
+ const targetId = linkTargetId ?? routeId;
const { domains } = useDomains({ enabled: isOpen });
@@ -101,7 +105,7 @@ export function DataroomLinkSheet({
viewerGroups,
loading: isLoadingGroups,
mutate: mutateGroups,
- } = useDataroomGroups();
+ } = useDataroomGroups({ dataroomId: linkTargetId ?? undefined });
const { currentTeamId: teamId } = useTeam();
const { isFree, isPro, isBusiness, isDatarooms, isDataroomsPlus, isTrial } =
usePlan();
@@ -522,6 +526,11 @@ export function DataroomLinkSheet({
shouldPreview: boolean,
permissions: ItemPermission | null,
) => {
+ if (!targetId || !teamId) {
+ setIsSaving(false);
+ return;
+ }
+
const endpointTargetType = `${linkType.replace("_LINK", "").toLowerCase()}s`; // "documents" or "datarooms"
if (isUpdating) {
@@ -770,6 +779,10 @@ export function DataroomLinkSheet({
shouldPreview: boolean = false,
showSuccess: boolean = false,
) => {
+ if (!targetId) {
+ toast.error("Missing dataroom");
+ return;
+ }
// For backward compatibility, extract permissions from linkData
setIsSaving(true);
const permissions = linkData.permissions || null;
@@ -789,6 +802,11 @@ export function DataroomLinkSheet({
) => {
event.preventDefault();
+ if (!targetId) {
+ toast.error("Missing dataroom");
+ return;
+ }
+
if (shouldManagePermissions && linkType === LinkType.DATAROOM_LINK) {
// Store the link data and show permissions sheet
setPendingLinkData(data);
@@ -1150,13 +1168,13 @@ export function DataroomLinkSheet({
<PermissionsSheet
isOpen={showPermissionsSheet}
- setIsOpen={(open) => {
+ setIsOpen={(open: boolean) => {
setShowPermissionsSheet(open);
if (!open) {
setShowSuccessSheet(true);
}
}}
- dataroomId={targetId}
+ dataroomId={targetId!}
linkId={currentLink?.id ?? undefined}
permissionGroupId={currentLink?.permissionGroupId ?? undefined}
onSave={handlePermissionsSave}
diff --git a/lib/swr/use-dataroom-groups.ts b/lib/swr/use-dataroom-groups.ts
index 2fb4c26a..20e5f4c5 100644
--- a/lib/swr/use-dataroom-groups.ts
+++ b/lib/swr/use-dataroom-groups.ts
@@ -15,14 +15,19 @@ import { fetcher } from "@/lib/utils";
import { LinkWithViews } from "../types";
-export default function useDataroomGroups({ documentId }: { documentId?: string } = {}) {
+export default function useDataroomGroups({
+ documentId,
+ dataroomId: dataroomIdOverride,
+}: { documentId?: string; dataroomId?: string } = {}) {
const teamInfo = useTeam();
const router = useRouter();
- const isDataroom = router.pathname.includes("datarooms");
- const { id } = router.query as {
- id: string;
+ const { id: queryDataroomId } = router.query as {
+ id?: string;
};
+ const id = dataroomIdOverride ?? queryDataroomId;
+ const isDataroom =
+ router.pathname.includes("datarooms") || !!dataroomIdOverride;
type ViewerGroupWithCount = ViewerGroup & {
accessControls: ViewerGroupAccessControls[];
@@ -40,8 +45,9 @@ export default function useDataroomGroups({ documentId }: { documentId?: string
teamInfo?.currentTeam?.id &&
id &&
isDataroom &&
- `/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${id}/groups${documentId ? `?documentId=${documentId}` : ""
- }`,
+ `/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${id}/groups${
+ documentId ? `?documentId=${documentId}` : ""
+ }`,
fetcher,
{ dedupingInterval: 30000 },
);
diff --git a/pages/_document.tsx b/pages/_document.tsx
index 03904bfb..9ce2c5c8 100644
--- a/pages/_document.tsx
+++ b/pages/_document.tsx
@@ -3,7 +3,12 @@ import { Head, Html, Main, NextScript } from "next/document";
export default function Document() {
return (
<Html lang="en" className="bg-background" suppressHydrationWarning>
- <Head />
+ <Head>
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1, viewport-fit=cover"
+ />
+ </Head>
<body className="">
<Main />
<NextScript />
diff --git a/pages/datarooms/[id]/analytics/audit-log.tsx b/pages/datarooms/[id]/analytics/audit-log.tsx
index d8737f3d..69e85d0a 100644
--- a/pages/datarooms/[id]/analytics/audit-log.tsx
+++ b/pages/datarooms/[id]/analytics/audit-log.tsx
@@ -3,6 +3,7 @@ import { CircleHelpIcon } from "lucide-react";
import { useDataroom } from "@/lib/swr/use-dataroom";
import AppLayout from "@/components/layouts/app";
+import { TabMenu } from "@/components/tab-menu";
import { BadgeTooltip } from "@/components/ui/tooltip";
import DataroomVisitorsTable from "@/components/visitors/dataroom-visitors-table";
@@ -15,7 +16,7 @@ export default function DataroomAuditLogPage() {
return (
<AppLayout>
- <div className="relative mx-2 mb-10 mt-4 space-y-8 overflow-hidden px-1 sm:mx-3 md:mx-5 md:mt-5 lg:mx-7 lg:mt-8 xl:mx-10">
+ <div className="relative mx-2 mb-10 mt-4 space-y-8 px-1 sm:mx-3 md:mx-5 md:mt-5 lg:mx-7 lg:mt-8 xl:mx-10">
<div className="space-y-1">
<h3 className="text-2xl font-semibold tracking-tight text-foreground">
Audit Log
@@ -33,6 +34,24 @@ export default function DataroomAuditLogPage() {
</p>
</div>
+ <TabMenu
+ navigation={[
+ {
+ label: "Analytics",
+ href: `/datarooms/${dataroom.id}/analytics`,
+ value: "analytics",
+ currentValue: "audit-log",
+ },
+ {
+ label: "Audit Log",
+ href: `/datarooms/${dataroom.id}/analytics/audit-log`,
+ value: "audit-log",
+ currentValue: "audit-log",
+ },
+ ]}
+ className="md:hidden"
+ />
+
<DataroomVisitorsTable dataroomId={dataroom.id} />
</div>
</AppLayout>
diff --git a/pages/datarooms/[id]/analytics/index.tsx b/pages/datarooms/[id]/analytics/index.tsx
index 4bf74789..6127fdcd 100644
--- a/pages/datarooms/[id]/analytics/index.tsx
+++ b/pages/datarooms/[id]/analytics/index.tsx
@@ -11,6 +11,7 @@ import DocumentAnalyticsTree from "@/components/datarooms/analytics/document-ana
import MockAnalyticsTable from "@/components/datarooms/analytics/mock-analytics-table";
import StatsCard from "@/components/datarooms/stats-card";
import AppLayout from "@/components/layouts/app";
+import { TabMenu } from "@/components/tab-menu";
import { FeaturePreview } from "@/components/ui/feature-preview";
import { BadgeTooltip } from "@/components/ui/tooltip";
@@ -49,6 +50,24 @@ export default function DataroomAnalyticsPage() {
</p>
</div>
+ <TabMenu
+ navigation={[
+ {
+ label: "Analytics",
+ href: `/datarooms/${dataroom.id}/analytics`,
+ value: "analytics",
+ currentValue: "analytics",
+ },
+ {
+ label: "Audit Log",
+ href: `/datarooms/${dataroom.id}/analytics/audit-log`,
+ value: "audit-log",
+ currentValue: "analytics",
+ },
+ ]}
+ className="md:hidden"
+ />
+
<StatsCard />
{hasAnalyticsAccess ? (
diff --git a/pages/datarooms/[id]/documents/[...name].tsx b/pages/datarooms/[id]/documents/[...name].tsx
index 3f90df13..726177c2 100644
--- a/pages/datarooms/[id]/documents/[...name].tsx
+++ b/pages/datarooms/[id]/documents/[...name].tsx
@@ -37,74 +37,89 @@ export default function Documents() {
return (
<AppLayout>
<div className="relative mx-2 mb-10 mt-4 space-y-4 overflow-hidden px-1 sm:mx-3 md:mx-5 md:mt-5 lg:mx-7 lg:mt-8 xl:mx-10">
- <div className="flex items-center justify-between gap-x-2">
- <div className="flex items-center gap-x-2">
- <GenerateIndexButton
- teamId={teamInfo?.currentTeam?.id!}
- dataroomId={dataroom?.id!}
- />
- <RebuildIndexButton
- teamId={teamInfo?.currentTeam?.id!}
- dataroomId={dataroom?.id!}
- />
- <DownloadDataroomButton
- teamId={teamInfo?.currentTeam?.id!}
- dataroomId={dataroom?.id!}
- dataroomName={dataroom?.name}
- />
- </div>
- <div className="flex items-center justify-end gap-x-2">
- <AddDocumentModal
- isDataroom={true}
- dataroomId={dataroom?.id}
- key={1}
- >
- <Button
- size="sm"
- className="group flex items-center justify-start gap-x-1 whitespace-nowrap px-2 text-left sm:gap-x-3 sm:px-3"
- title="Add Document"
- >
- <PlusIcon className="h-4 w-4 shrink-0 sm:h-5 sm:w-5" aria-hidden="true" />
- <span className="text-xs sm:text-sm">Add Document</span>
- </Button>
- </AddDocumentModal>
- <AddFolderModal isDataroom={true} dataroomId={dataroom?.id} key={2}>
- <Button
- size="sm"
- variant="outline"
- className="group flex items-center justify-start gap-x-3 px-3 text-left"
- >
- <FolderPlusIcon
- className="h-5 w-5 shrink-0"
- aria-hidden="true"
+ <div className="min-w-0 max-md:-mx-1 max-md:px-1">
+ <div
+ className="max-md:overflow-x-auto max-md:pb-1 max-md:[-webkit-overflow-scrolling:touch] max-md:[scrollbar-width:thin] md:overflow-visible md:pb-0"
+ role="toolbar"
+ aria-label="Data room documents actions"
+ >
+ <div className="flex w-max items-center gap-x-2 md:w-full md:justify-between">
+ <div className="flex shrink-0 items-center gap-x-2">
+ <GenerateIndexButton
+ teamId={teamInfo?.currentTeam?.id!}
+ dataroomId={dataroom?.id!}
+ />
+ <RebuildIndexButton
+ teamId={teamInfo?.currentTeam?.id!}
+ dataroomId={dataroom?.id!}
/>
- <span>Add Folder</span>
- </Button>
- </AddFolderModal>
- <div id="dataroom-reordering-action">
- {!isReordering ? (
- <Button
- size="sm"
- variant="outline"
- className="gap-x-1"
- onClick={() => setIsReordering(!isReordering)}
+ <DownloadDataroomButton
+ teamId={teamInfo?.currentTeam?.id!}
+ dataroomId={dataroom?.id!}
+ dataroomName={dataroom?.name}
+ />
+ </div>
+ <div className="flex shrink-0 items-center gap-x-2">
+ <AddDocumentModal
+ isDataroom={true}
+ dataroomId={dataroom?.id}
+ key={1}
+ >
+ <Button
+ size="sm"
+ className="group flex items-center justify-start gap-x-1 whitespace-nowrap px-2 text-left sm:gap-x-3 sm:px-3"
+ title="Add Document"
+ >
+ <PlusIcon
+ className="h-4 w-4 shrink-0 sm:h-5 sm:w-5"
+ aria-hidden="true"
+ />
+ <span className="text-xs sm:text-sm">Add Document</span>
+ </Button>
+ </AddDocumentModal>
+ <AddFolderModal
+ isDataroom={true}
+ dataroomId={dataroom?.id}
+ key={2}
>
- <ArrowUpDownIcon className="h-4 w-4" />
- Reorder
- </Button>
- ) : null}
+ <Button
+ size="sm"
+ variant="outline"
+ className="group flex shrink-0 items-center justify-start gap-x-3 whitespace-nowrap px-3 text-left"
+ >
+ <FolderPlusIcon
+ className="h-5 w-5 shrink-0"
+ aria-hidden="true"
+ />
+ <span>Add Folder</span>
+ </Button>
+ </AddFolderModal>
+ <div id="dataroom-reordering-action" className="shrink-0">
+ {!isReordering ? (
+ <Button
+ size="sm"
+ variant="outline"
+ className="shrink-0 gap-x-1 whitespace-nowrap"
+ onClick={() => setIsReordering(!isReordering)}
+ >
+ <ArrowUpDownIcon className="h-4 w-4" />
+ Reorder
+ </Button>
+ ) : null}
+ </div>
+ </div>
</div>
</div>
</div>
<div className="grid h-full gap-4 pb-2 md:grid-cols-4">
- <div className="h-full truncate md:col-span-1">
+ <div className="hidden h-full min-h-0 truncate md:col-span-1 md:block">
<ScrollArea showScrollbar>
<SidebarFolderTree dataroomId={dataroom?.id!} />
<ScrollBar orientation="horizontal" />
</ScrollArea>
</div>
- <div className="space-y-4 md:col-span-3">
+ <div className="min-w-0 space-y-4 md:col-span-3">
<section id="documents-header-count" className="min-h-8" />
{isLoading ? <LoadingDocuments count={3} /> : null}
diff --git a/pages/datarooms/[id]/documents/index.tsx b/pages/datarooms/[id]/documents/index.tsx
index 4ef621c9..cbba0f1e 100644
--- a/pages/datarooms/[id]/documents/index.tsx
+++ b/pages/datarooms/[id]/documents/index.tsx
@@ -54,68 +54,83 @@ export default function Documents() {
</p>
</div>
- <div className="flex items-center justify-between gap-x-2">
- <div className="flex items-center gap-x-2">
- <GenerateIndexButton
- teamId={teamInfo?.currentTeam?.id!}
- dataroomId={dataroom?.id!}
- />
- <RebuildIndexButton
- teamId={teamInfo?.currentTeam?.id!}
- dataroomId={dataroom?.id!}
- />
- <DownloadDataroomButton
- teamId={teamInfo?.currentTeam?.id!}
- dataroomId={dataroom?.id!}
- dataroomName={dataroom?.name}
- />
- </div>
- <div className="flex items-center justify-end gap-x-2">
- <AddDocumentModal
- isDataroom={true}
- dataroomId={dataroom?.id}
- key={1}
- >
- <Button
- size="sm"
- className="group flex items-center justify-start gap-x-1 whitespace-nowrap px-2 text-left sm:gap-x-3 sm:px-3"
- title="Add Document"
- >
- <PlusIcon className="h-4 w-4 shrink-0 sm:h-5 sm:w-5" aria-hidden="true" />
- <span className="text-xs sm:text-sm">Add Document</span>
- </Button>
- </AddDocumentModal>
-
- <AddFolderModal isDataroom={true} dataroomId={dataroom?.id} key={2}>
- <ResponsiveButton
- icon={<FolderPlusIcon className="h-5 w-5 shrink-0" />}
- text="Add Folder"
- size="sm"
- variant="outline"
- />
- </AddFolderModal>
- <div id="dataroom-reordering-action">
- {!isReordering ? (
- <ResponsiveButton
- icon={<ArrowUpDownIcon className="h-4 w-4" />}
- text="Reorder"
- size="sm"
- variant="outline"
- onClick={() => setIsReordering(!isReordering)}
+ <div className="min-w-0 max-md:-mx-1 max-md:px-1">
+ <div
+ className="max-md:overflow-x-auto max-md:pb-1 max-md:[-webkit-overflow-scrolling:touch] max-md:[scrollbar-width:thin] md:overflow-visible md:pb-0"
+ role="toolbar"
+ aria-label="Data room documents actions"
+ >
+ <div className="flex w-max items-center gap-x-2 md:w-full md:justify-between">
+ <div className="flex shrink-0 items-center gap-x-2">
+ <GenerateIndexButton
+ teamId={teamInfo?.currentTeam?.id!}
+ dataroomId={dataroom?.id!}
/>
- ) : null}
+ <RebuildIndexButton
+ teamId={teamInfo?.currentTeam?.id!}
+ dataroomId={dataroom?.id!}
+ />
+ <DownloadDataroomButton
+ teamId={teamInfo?.currentTeam?.id!}
+ dataroomId={dataroom?.id!}
+ dataroomName={dataroom?.name}
+ />
+ </div>
+ <div className="flex shrink-0 items-center gap-x-2">
+ <AddDocumentModal
+ isDataroom={true}
+ dataroomId={dataroom?.id}
+ key={1}
+ >
+ <Button
+ size="sm"
+ className="group flex items-center justify-start gap-x-1 whitespace-nowrap px-2 text-left sm:gap-x-3 sm:px-3"
+ title="Add Document"
+ >
+ <PlusIcon
+ className="h-4 w-4 shrink-0 sm:h-5 sm:w-5"
+ aria-hidden="true"
+ />
+ <span className="text-xs sm:text-sm">Add Document</span>
+ </Button>
+ </AddDocumentModal>
+
+ <AddFolderModal
+ isDataroom={true}
+ dataroomId={dataroom?.id}
+ key={2}
+ >
+ <ResponsiveButton
+ icon={<FolderPlusIcon className="h-5 w-5 shrink-0" />}
+ text="Add Folder"
+ size="sm"
+ variant="outline"
+ />
+ </AddFolderModal>
+ <div id="dataroom-reordering-action" className="shrink-0">
+ {!isReordering ? (
+ <ResponsiveButton
+ icon={<ArrowUpDownIcon className="h-4 w-4" />}
+ text="Reorder"
+ size="sm"
+ variant="outline"
+ onClick={() => setIsReordering(!isReordering)}
+ />
+ ) : null}
+ </div>
+ </div>
</div>
</div>
</div>
<div className="grid h-full gap-4 pb-2 md:grid-cols-4">
- <div className="h-full truncate md:col-span-1">
+ <div className="hidden h-full min-h-0 truncate md:col-span-1 md:block">
<ScrollArea showScrollbar>
<SidebarFolderTree dataroomId={dataroom?.id!} />
<ScrollBar orientation="horizontal" />
</ScrollArea>
</div>
- <div className="space-y-4 md:col-span-3">
+ <div className="min-w-0 space-y-4 md:col-span-3">
<section id="documents-header-count" className="min-h-8" />
{isLoading ? <LoadingDocuments count={3} /> : null}
diff --git a/pages/datarooms/[id]/groups/index.tsx b/pages/datarooms/[id]/groups/index.tsx
index 20c08aef..8c12f48b 100644
--- a/pages/datarooms/[id]/groups/index.tsx
+++ b/pages/datarooms/[id]/groups/index.tsx
@@ -10,6 +10,7 @@ import { AddGroupModal } from "@/components/datarooms/groups/add-group-modal";
import GroupCard from "@/components/datarooms/groups/group-card";
import { GroupCardPlaceholder } from "@/components/datarooms/groups/group-card-placeholder";
import AppLayout from "@/components/layouts/app";
+import { TabMenu } from "@/components/tab-menu";
import { Button } from "@/components/ui/button";
import { BadgeTooltip } from "@/components/ui/tooltip";
@@ -66,6 +67,24 @@ export default function DataroomGroupPage() {
<ButtonComponent />
</div>
+ <TabMenu
+ navigation={[
+ {
+ label: "Links",
+ href: `/datarooms/${dataroom.id}/permissions`,
+ value: "links",
+ currentValue: "groups",
+ },
+ {
+ label: "Groups",
+ href: `/datarooms/${dataroom.id}/groups`,
+ value: "groups",
+ currentValue: "groups",
+ },
+ ]}
+ className="md:hidden"
+ />
+
<div className="space-y-4">
<div className="grid gap-5">
<div className="animate-fade-in">
diff --git a/pages/datarooms/[id]/permissions/index.tsx b/pages/datarooms/[id]/permissions/index.tsx
index e46b1abb..9621b92f 100644
--- a/pages/datarooms/[id]/permissions/index.tsx
+++ b/pages/datarooms/[id]/permissions/index.tsx
@@ -1,19 +1,15 @@
-import { useState } from "react";
-
-import { CircleHelpIcon, PlusIcon } from "lucide-react";
+import { CircleHelpIcon } from "lucide-react";
import { useDataroom, useDataroomLinks } from "@/lib/swr/use-dataroom";
import AppLayout from "@/components/layouts/app";
-import { DataroomLinkSheet } from "@/components/links/link-sheet/dataroom-link-sheet";
import LinksTable from "@/components/links/links-table";
-import { Button } from "@/components/ui/button";
+import { TabMenu } from "@/components/tab-menu";
import { BadgeTooltip } from "@/components/ui/tooltip";
export default function DataroomLinksPage() {
const { dataroom } = useDataroom();
const { links } = useDataroomLinks();
- const [isLinkSheetOpen, setIsLinkSheetOpen] = useState(false);
if (!dataroom) {
return <div>Loading...</div>;
@@ -22,42 +18,47 @@ export default function DataroomLinksPage() {
return (
<AppLayout>
<div className="relative mx-2 mb-10 mt-4 space-y-8 px-1 sm:mx-3 md:mx-5 md:mt-5 lg:mx-7 lg:mt-8 xl:mx-10">
- <div className="flex items-start justify-between">
- <div className="space-y-1">
- <h3 className="text-2xl font-semibold tracking-tight text-foreground">
- Links
- </h3>
- <p className="flex flex-row items-center gap-2 text-sm text-muted-foreground">
- Share your data room with access controls.
- <BadgeTooltip
- linkText="Learn more"
- content="Configure access controls for data room links."
- key="links"
- link="https://www.papermark.com/help/category/links"
- >
- <CircleHelpIcon className="h-4 w-4 shrink-0 text-muted-foreground hover:text-foreground" />
- </BadgeTooltip>
- </p>
- </div>
- <Button onClick={() => setIsLinkSheetOpen(true)}>
- <PlusIcon className="h-4 w-4" />
- Create link
- </Button>
+ <div className="space-y-1">
+ <h3 className="text-2xl font-semibold tracking-tight text-foreground">
+ Links
+ </h3>
+ <p className="flex flex-row items-center gap-2 text-sm text-muted-foreground">
+ Share your data room with access controls.
+ <BadgeTooltip
+ linkText="Learn more"
+ content="Configure access controls for data room links."
+ key="links"
+ link="https://www.papermark.com/help/category/links"
+ >
+ <CircleHelpIcon className="h-4 w-4 shrink-0 text-muted-foreground hover:text-foreground" />
+ </BadgeTooltip>
+ </p>
</div>
+ <TabMenu
+ navigation={[
+ {
+ label: "Links",
+ href: `/datarooms/${dataroom.id}/permissions`,
+ value: "links",
+ currentValue: "links",
+ },
+ {
+ label: "Groups",
+ href: `/datarooms/${dataroom.id}/groups`,
+ value: "groups",
+ currentValue: "links",
+ },
+ ]}
+ className="md:hidden"
+ />
+
<LinksTable
links={links}
targetType={"DATAROOM"}
dataroomName={dataroom.name}
/>
</div>
-
- <DataroomLinkSheet
- isOpen={isLinkSheetOpen}
- setIsOpen={setIsLinkSheetOpen}
- linkType="DATAROOM_LINK"
- existingLinks={links}
- />
</AppLayout>
);
}
diff --git a/pages/documents/[id]/index.tsx b/pages/documents/[id]/index.tsx
index 61f00a46..b308c7aa 100644
--- a/pages/documents/[id]/index.tsx
+++ b/pages/documents/[id]/index.tsx
@@ -170,7 +170,7 @@ export default function DocumentPage() {
advancedExcelEnabled={prismaDocument.advancedExcelEnabled}
variant="outline"
size="default"
- showTooltip={false}
+ showTooltip
className="h-8 whitespace-nowrap text-xs lg:h-9 lg:text-sm"
/>,
<AddLinkButton key={"create-link"} />,