Skip to content

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

chore: cleanup presets type

Marc Seitze33c25a8e2f9
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index e480e9bd..a03caa5c 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -1,7 +1,7 @@
import Link from "next/link";
import { useRouter } from "next/router";
-import { Dispatch, SetStateAction, use, useEffect, useState } from "react";
+import { Dispatch, SetStateAction, useEffect, useState } from "react";
import { useTeam } from "@/context/team-context";
import { PlanEnum } from "@/ee/stripe/constants";
@@ -653,38 +653,6 @@ export default function LinkSheet({
/>
</div>
- {/* Preset Selector for Group links - only show when creating a new link */}
- {!currentLink && presets && presets.length > 0 && (
- <div className="space-y-2">
- <div className="flex items-center justify-between">
- <Label htmlFor="preset">Link Preset</Label>
- <Button
- variant="link"
- size="sm"
- className="text-xs"
- onClick={() => router.push("/settings/presets")}
- >
- Manage Presets
- </Button>
- </div>
- <Select onValueChange={applyPreset}>
- <SelectTrigger className="w-full">
- <SelectValue placeholder="Select a preset" />
- </SelectTrigger>
- <SelectContent>
- {presets.map((preset) => (
- <SelectItem key={preset.id} value={preset.id}>
- {preset.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <p className="text-xs text-muted-foreground">
- Apply a preset to quickly configure link settings
- </p>
- </div>
- )}
-
<div className="space-y-2">
<DomainSection
{...{ data, setData, domains }}
@@ -693,6 +661,47 @@ export default function LinkSheet({
/>
</div>
+ {/* Preset Selector for Group links - only show when creating a new link */}
+ {!currentLink &&
+ isPresetsAllowed &&
+ presets &&
+ presets.length > 0 && (
+ <div className="space-y-2">
+ <div className="flex items-center justify-between">
+ <Label htmlFor="preset">Link Preset</Label>
+ <Button
+ variant="link"
+ size="sm"
+ className="text-xs"
+ onClick={() =>
+ router.push("/settings/presets")
+ }
+ >
+ Manage Presets
+ </Button>
+ </div>
+ <Select onValueChange={applyPreset}>
+ <SelectTrigger className="w-full">
+ <SelectValue placeholder="Select a preset" />
+ </SelectTrigger>
+ <SelectContent>
+ {presets.map((preset) => (
+ <SelectItem
+ key={preset.id}
+ value={preset.id}
+ >
+ {preset.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <p className="text-xs text-muted-foreground">
+ Apply a preset to quickly configure link
+ settings
+ </p>
+ </div>
+ )}
+
<div className="relative flex items-center">
<Separator className="absolute bg-muted-foreground" />
<div className="relative mx-auto">
@@ -708,6 +717,7 @@ export default function LinkSheet({
targetId={targetId}
linkType={linkType}
editLink={!!currentLink}
+ currentPreset={currentPreset}
/>
</div>
</TabsContent>
diff --git a/components/links/link-sheet/link-options.tsx b/components/links/link-sheet/link-options.tsx
index 1222db56..06ff86b3 100644
--- a/components/links/link-sheet/link-options.tsx
+++ b/components/links/link-sheet/link-options.tsx
@@ -41,14 +41,14 @@ export const LinkOptions = ({
targetId,
linkType,
editLink,
- currentPreset,
+ currentPreset = null,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
targetId?: string;
linkType: LinkType;
editLink?: boolean;
- currentPreset: LinkPreset | null;
+ currentPreset?: LinkPreset | null;
}) => {
const {
isStarter,