Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
tag update
Ashish Viradiya36cf7c2c7d81
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsxindex 49700b3e..d6f00c48 100644--- a/components/links/link-sheet/index.tsx+++ b/components/links/link-sheet/index.tsx@@ -510,7 +510,6 @@ export default function LinkSheet({<div className="space-y-2"><TagSection{...{ data, setData }}- editLink={!!currentLink}teamId={teamInfo?.currentTeam?.id as string}/></div>@@ -523,14 +522,11 @@ export default function LinkSheet({<div className="space-y-2"><div className="flex items-center justify-between"><Label htmlFor="preset">Link Preset</Label>- <Link href="/settings/presets">- <Button- variant="link"- size="sm"- className="text-xs"- >- Manage Presets- </Button>+ <Link+ href="/settings/presets"+ className="text-xs text-muted-foreground hover:text-foreground hover:underline"+ >+ Manage Presets</Link></div><Select onValueChange={applyPreset}>@@ -670,7 +666,6 @@ export default function LinkSheet({<div className="space-y-2"><TagSection{...{ data, setData }}- editLink={!!currentLink}teamId={teamInfo?.currentTeam?.id as string}/></div>@@ -682,17 +677,13 @@ export default function LinkSheet({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")- }+ <Label htmlFor="preset">Link Preset</Label>+ <Link+ href="/settings/presets"+ className="text-xs text-muted-foreground hover:text-foreground hover:underline">Manage Presets- </Button>+ </Link></div><Select onValueChange={applyPreset}><SelectTrigger className="w-full">diff --git a/components/links/link-sheet/tags/tag-section.tsx b/components/links/link-sheet/tags/tag-section.tsxindex f26c7ef1..225614f8 100644--- a/components/links/link-sheet/tags/tag-section.tsx+++ b/components/links/link-sheet/tags/tag-section.tsx@@ -1,15 +1,17 @@-import { useRouter } from "next/navigation";+import Link from "next/link";import { Dispatch, SetStateAction, useMemo, useState } from "react";+import { PlanEnum } from "@/ee/stripe/constants";import { Tag } from "lucide-react";import { toast } from "sonner";import { mutate } from "swr";+import { usePlan } from "@/lib/swr/use-billing";import { useTags } from "@/lib/swr/use-tags";import { TagProps } from "@/lib/types";-import { Button } from "@/components/ui/button";+import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";import { Label } from "@/components/ui/label";import { MultiSelect } from "@/components/ui/multi-select-v2";@@ -32,25 +34,21 @@ function getTagOption(tag: TagProps) {export default function TagSection({data,setData,- editLink,teamId,}: {data: DEFAULT_LINK_TYPE;setData: Dispatch<SetStateAction<DEFAULT_LINK_TYPE>>;- editLink?: boolean;teamId: string;}) {- const router = useRouter();- // TODO- // const [searchQuery, setSearchQuery] = useState<string>("");- // const [currentPage, setCurrentPage] = useState(1);const [isPopoverOpen, setIsPopoverOpen] = useState(false);const [selectedValues, setSelectedValues] = useState<string[]>(data.tags || [],);+ const [showUpgradeModal, setShowUpgradeModal] = useState(false);+ const { isFree } = usePlan();const {- // tagCount,+ tagCount,tags: availableTags,loading: loadingTags,} = useTags({@@ -75,6 +73,12 @@ export default function TagSection({};const createTag = async (tag: string) => {+ if (isFree && tagCount && tagCount >= 5) {+ setShowUpgradeModal(true);+ toast.error("You have reached the maximum number of tags.");+ return false;+ }+const res = await fetch(`/api/teams/${teamId}/tags`, {method: "POST",headers: {@@ -110,12 +114,12 @@ export default function TagSection({<><div className="flex justify-between"><Label htmlFor="link-domain">Tags</Label>- <a+ <Linkhref={`/settings/tags`}- className="text-xs text-muted-foreground hover:text-foreground"+ className="text-xs text-muted-foreground hover:text-foreground hover:underline">- Manage- </a>+ Manage Tags+ </Link></div><div className="flex"><MultiSelect@@ -131,6 +135,14 @@ export default function TagSection({onCreate={(search) => createTag(search)}/></div>+ {showUpgradeModal && (+ <UpgradePlanModal+ clickedPlan={PlanEnum.Pro}+ trigger="create_tag"+ open={showUpgradeModal}+ setOpen={setShowUpgradeModal}+ />+ )}</>);}diff --git a/components/tags/add-tag-modal.tsx b/components/tags/add-tag-modal.tsxindex 5ffd3dee..3f6b672d 100644--- a/components/tags/add-tag-modal.tsx+++ b/components/tags/add-tag-modal.tsx@@ -96,7 +96,7 @@ export function AddTagsModal({<DialogTrigger asChild>{children}</DialogTrigger><DialogContent className="sm:max-w-[425px]"><DialogHeader className="text-start">- <DialogTitle>{tagForm.id ? "Create Tag" : "Edit Tag"}</DialogTitle>+ <DialogTitle>{tagForm.id ? "Edit Tag" : "Create Tag"}</DialogTitle><DialogDescription>Organize your links with tags for easy categorization and search.</DialogDescription>