Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add tags feature

Steven Teycb6303a99b44
diff --git a/app/lib/hooks/use-window-size.ts b/app/lib/hooks/use-window-size.ts
index a285b7838f..2f6e0a0945 100644
--- a/app/lib/hooks/use-window-size.ts
+++ b/app/lib/hooks/use-window-size.ts
@@ -1,16 +1,16 @@
import { useState, useEffect } from "react";
// Define general type for useWindowSize hook, which includes width and height
interface Size {
- width: number | undefined;
- height: number | undefined;
+ width: number;
+ height: number;
}
// Hook
export default function useWindowSize(): Size {
// Initialize state with undefined width/height so server and client renders match
// Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
const [windowSize, setWindowSize] = useState<Size>({
- width: undefined,
- height: undefined,
+ width: 0,
+ height: 0,
});
useEffect(() => {
// Handler to call on window resize
diff --git a/app/ui/modal.tsx b/app/ui/modal.tsx
index ffd48e58c0..3ec197f759 100644
--- a/app/ui/modal.tsx
+++ b/app/ui/modal.tsx
@@ -80,7 +80,15 @@ export default function Modal({
return (
<AnimatePresence>
{(setShowModal ? showModal : true) && (
- <FocusTrap focusTrapOptions={{ initialFocus: false }}>
+ <FocusTrap
+ focusTrapOptions={{
+ initialFocus: false,
+ onActivate: () => {
+ // prevent scroll outside of modal
+ document.body.style.overflow = "hidden";
+ },
+ }}
+ >
<div className="absolute">
<motion.div
ref={mobileModalRef}
diff --git a/app/ui/popover.tsx b/app/ui/popover.tsx
index 76d8ed1f8e..b4fdee25b3 100644
--- a/app/ui/popover.tsx
+++ b/app/ui/popover.tsx
@@ -4,7 +4,7 @@ import { useParams } from "next/navigation";
import { ReactNode, useEffect, useRef } from "react";
import * as PopoverPrimitive from "@radix-ui/react-popover";
import { AnimatePresence, motion, useAnimation } from "framer-motion";
-import useViewportSize from "@/lib/hooks/use-viewport-size";
+import useWindowSize from "#/lib/hooks/use-window-size";
export default function Popover({
children,
@@ -37,7 +37,7 @@ export default function Popover({
controls.start({ y: 0, transition: transitionProps });
}
}
- const { width } = useViewportSize();
+ const { width } = useWindowSize();
// workaround to make popover close when route changes on desktop
useEffect(() => {
diff --git a/app/ui/stats/devices.tsx b/app/ui/stats/devices.tsx
index 8ce9d38e49..8ef96fa9cf 100644
--- a/app/ui/stats/devices.tsx
+++ b/app/ui/stats/devices.tsx
@@ -1,6 +1,6 @@
import { useContext, useState } from "react";
import { motion } from "framer-motion";
-import BadgeSelect from "@/components/shared/badge-select";
+import TabSelect from "@/components/shared/tab-select";
import { LoadingCircle } from "#/ui/icons";
import { DeviceTabs, uaToBot } from "@/lib/stats";
import { nFormatter } from "@/lib/utils";
@@ -29,7 +29,7 @@ export default function Devices() {
<div className="relative z-0 h-[420px] overflow-scroll border border-gray-200 bg-white px-7 py-5 scrollbar-hide sm:rounded-lg sm:border-gray-100 sm:shadow-lg">
<div className="mb-5 flex justify-between">
<h1 className="text-xl font-semibold">Devices</h1>
- <BadgeSelect
+ <TabSelect
options={["device", "browser", "os", "bot"]}
selected={tab}
// @ts-ignore
diff --git a/app/ui/stats/locations.tsx b/app/ui/stats/locations.tsx
index 9d040260c4..a765780b7e 100644
--- a/app/ui/stats/locations.tsx
+++ b/app/ui/stats/locations.tsx
@@ -1,6 +1,6 @@
import { useContext, useState } from "react";
import { motion } from "framer-motion";
-import BadgeSelect from "@/components/shared/badge-select";
+import TabSelect from "@/components/shared/tab-select";
import { COUNTRIES } from "@/lib/constants";
import { LocationTabs } from "@/lib/stats";
import { nFormatter } from "@/lib/utils";
@@ -28,7 +28,7 @@ export default function Locations() {
<div className="relative z-0 h-[420px] overflow-scroll border border-gray-200 bg-white px-7 py-5 scrollbar-hide sm:rounded-lg sm:border-gray-100 sm:shadow-lg">
<div className="mb-5 flex justify-between">
<h1 className="text-xl font-semibold">Locations</h1>
- <BadgeSelect
+ <TabSelect
options={["country", "city"]}
selected={tab}
// @ts-ignore
diff --git a/components/app/links/link-card.tsx b/components/app/links/link-card.tsx
index 4410b73d75..6816125e98 100644
--- a/components/app/links/link-card.tsx
+++ b/components/app/links/link-card.tsx
@@ -1,6 +1,6 @@
import Link from "next/link";
import { useRouter } from "next/router";
-import { useEffect, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import useSWR from "swr";
import { useAddEditLinkModal } from "@/components/app/modals/add-edit-link-modal";
import { useTagLinkModal } from "@/components/app/modals/tag-link-modal";
@@ -27,9 +27,13 @@ import useDomains from "@/lib/swr/use-domains";
import { Archive, CopyPlus, Edit3, Tag } from "lucide-react";
import punycode from "punycode/";
import { GOOGLE_FAVICON_URL } from "@/lib/constants";
+import useTags from "@/lib/swr/use-tags";
+import Badge from "@/components/shared/badge";
export default function LinkCard({ props }: { props: LinkProps }) {
- const { key, domain, url, createdAt, archived, expiresAt } = props;
+ const { key, domain, url, createdAt, archived, tagId } = props;
+ const { tags } = useTags();
+ const tag = useMemo(() => tags?.find((t) => t.id === tagId), [tags, tagId]);
const apexDomain = getApexDomain(url);
@@ -107,8 +111,7 @@ export default function LinkCard({ props }: { props: LinkProps }) {
}
};
- // const shortcuts = slug ? ["e", "d", "t", "a", "x"] : ["e", "d", "a", "x"];
- const shortcuts = ["e", "d", "a", "x"];
+ const shortcuts = slug ? ["e", "d", "t", "a", "x"] : ["e", "d", "a", "x"];
const onKeyDown = (e: any) => {
// only run shortcut logic if:
// - usage is not exceeded
@@ -127,9 +130,9 @@ export default function LinkCard({ props }: { props: LinkProps }) {
case "d":
setShowDuplicateLinkModal(true);
break;
- // case "t":
- // setShowTagLinkModal(true);
- // break;
+ case "t":
+ setShowTagLinkModal(true);
+ break;
case "a":
setShowArchiveLinkModal(true);
break;
@@ -159,7 +162,7 @@ export default function LinkCard({ props }: { props: LinkProps }) {
<LinkQRModal />
<AddEditLinkModal />
<DuplicateLinkModal />
- {/* {slug && <TagLinkModal />} */}
+ {slug && <TagLinkModal />}
<ArchiveLinkModal />
<DeleteLinkModal />
<li className="relative flex items-center justify-between">
@@ -249,6 +252,14 @@ export default function LinkCard({ props }: { props: LinkProps }) {
<span className="ml-1 hidden sm:inline-block">clicks</span>
</p>
</Link>
+ {tag?.color && (
+ <button
+ onClick={() => setShowTagLinkModal(true)}
+ className="transition-all duration-75 hover:scale-105 active:scale-100"
+ >
+ <Badge {...tag} />
+ </button>
+ )}
</div>
<h3 className="max-w-[200px] truncate text-sm font-medium text-gray-700 md:max-w-md xl:max-w-lg">
{url}
@@ -340,7 +351,7 @@ export default function LinkCard({ props }: { props: LinkProps }) {
</kbd>
</button>
)}
- {/* {slug && (
+ {slug && (
<button
onClick={(e) => {
e.preventDefault();
@@ -354,7 +365,7 @@ export default function LinkCard({ props }: { props: LinkProps }) {
T
</kbd>
</button>
- )} */}
+ )}
<button
onClick={(e) => {
e.preventDefault();
diff --git a/components/app/links/link-filters.tsx b/components/app/links/link-filters.tsx
index c8eb488f9f..ba80ee071d 100644
--- a/components/app/links/link-filters.tsx
+++ b/components/app/links/link-filters.tsx
@@ -22,11 +22,15 @@ import Switch from "#/ui/switch";
import { useSession } from "next-auth/react";
import { toast } from "sonner";
import { ModalContext } from "#/ui/modal-provider";
+import useTags from "@/lib/swr/use-tags";
export default function LinkFilters() {
const { primaryDomain } = useDomains();
const { data: domains } = useLinksCount({ groupBy: "domain" });
- // const { data: tags } = useLinksCount({ groupBy: "tagId" });
+
+ const { tags } = useTags();
+ const { data: tagsCount } = useLinksCount({ groupBy: "tagId" });
+
const router = useRouter();
const { slug, search, domain, userId, tagId } = router.query as {
slug: string;
@@ -95,25 +99,27 @@ export default function LinkFilters() {
/>
{slug && (
<>
- {/* <FilterGroup
- displayName="Tags"
- param="tagId"
- options={tags.map(({ tag, tagId, _count }) => ({
- name: tag,
- value: tagId,
- count: _count,
- }))}
- cta={
- <button
- onClick={() => {
- toast.success("add a tag to a project");
- }}
- className="rounded-md border border-gray-300 p-1 text-center text-sm"
- >
- Add a tag
- </button>
- }
- /> */}
+ {tagsCount && (
+ <FilterGroup
+ displayName="Tags"
+ param="tagId"
+ options={tagsCount.map(({ tagId, _count }) => ({
+ name: tags?.find((tag) => tag.id === tagId)?.name || "",
+ value: tagId,
+ count: _count,
+ }))}
+ cta={
+ <button
+ onClick={() => {
+ toast.success("add a tag to a project");
+ }}
+ className="rounded-md border border-gray-300 p-1 text-center text-sm"
+ >
+ Add a tag
+ </button>
+ }
+ />
+ )}
<MyLinksFilter />
</>
)}
diff --git a/components/app/modals/tag-link-modal.tsx b/components/app/modals/tag-link-modal.tsx
index e0329f70b3..167b11f143 100644
--- a/components/app/modals/tag-link-modal.tsx
+++ b/components/app/modals/tag-link-modal.tsx
@@ -2,8 +2,11 @@ import { useRouter } from "next/router";
import {
Dispatch,
SetStateAction,
+ SyntheticEvent,
useCallback,
+ useEffect,
useMemo,
+ useRef,
useState,
} from "react";
import { mutate } from "swr";
@@ -13,7 +16,11 @@ import { LinkProps } from "@/lib/types";
import { getApexDomain, getQueryString, linkConstructor } from "@/lib/utils";
import { GOOGLE_FAVICON_URL } from "@/lib/constants";
import { toast } from "sonner";
+import { ChevronDown, Search, X } from "lucide-react";
+import { Command } from "cmdk";
import Button from "#/ui/button";
+import useTags from "@/lib/swr/use-tags";
+import Badge from "@/components/shared/badge";
function TagLinkModal({
showTagLinkModal,
@@ -31,6 +38,12 @@ function TagLinkModal({
const { key, domain, tagId } = props;
+ const { tags } = useTags();
+ const [selectedTag, setSelectedTag] = useState(
+ tags?.find((t) => t.id === tagId),
+ );
+ const [value, setValue] = useState(selectedTag?.name || "");
+
const shortlink = useMemo(() => {
return linkConstructor({
key,
@@ -39,9 +52,61 @@ function TagLinkModal({
});
}, [key, domain]);
+ const handleSubmit = useCallback(
+ async (e?: SyntheticEvent) => {
+ e?.preventDefault();
+ setTagging(true);
+ console.log(selectedTag, value);
+ fetch(
+ `/api/links/${encodeURIComponent(
+ props.key,
+ )}/tag?slug=${slug}&domain=${domain}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ tagId:
+ selectedTag && value === selectedTag.name ? selectedTag.id : null,
+ }),
+ },
+ ).then(async (res) => {
+ setTagging(false);
+ if (res.status === 200) {
+ mutate(`/api/links${getQueryString(router)}`);
+ mutate(
+ `/api/links/_count${getQueryString(router, {
+ groupBy: "tagId",
+ })}`,
+ );
+ setShowTagLinkModal(false);
+ toast.success(`Successfully tagged shortlink!`);
+ } else {
+ const error = await res.text();
+ toast.error(error);
+ }
+ });
+ },
+ [props, selectedTag, slug, domain, router],
+ );
+
+ const ref = useRef<HTMLDivElement | null>(null);
+ const [open, setOpen] = useState(false);
+
+ useEffect(() => {
+ const handleClickOutside = (e) => {
+ if (ref.current && !ref.current.contains(e.target)) {
+ setOpen(false);
+ }
+ };
+ document.addEventListener("mousedown", handleClickOutside);
+ return () => document.removeEventListener("mousedown", handleClickOutside);
+ }, [ref]);
+
return (
<Modal showModal={showTagLinkModal} setShowModal={setShowTagLinkModal}>
- <div className="inline-block w-full transform overflow-hidden bg-white align-middle shadow-xl transition-all sm:max-w-md sm:rounded-2xl sm:border sm:border-gray-200">
+ <div className="inline-block w-full bg-white align-middle shadow-xl transition-all sm:max-w-md sm:rounded-2xl sm:border sm:border-gray-200">
<div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-4 pt-8 text-center sm:px-16">
<BlurImage
src={`${GOOGLE_FAVICON_URL}${apexDomain}`}
@@ -57,33 +122,89 @@ function TagLinkModal({
</div>
<form
- className="flex flex-col space-y-6 bg-gray-50 px-4 py-8 text-left sm:px-16"
- onSubmit={async (e) => {
- e.preventDefault();
- setTagging(true);
- fetch(
- `/api/links/${encodeURIComponent(
- props.key,
- )}/tag?slug=${slug}&domain=${domain}`,
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- },
- ).then(async (res) => {
- setTagging(false);
- if (res.status === 200) {
- mutate(`/api/links${getQueryString(router)}`);
- setShowTagLinkModal(false);
- } else {
- const error = await res.text();
- toast.error(error);
- }
- });
- }}
+ className="flex flex-col space-y-4 bg-gray-50 px-4 py-8 text-left sm:px-16"
+ onSubmit={handleSubmit}
>
- <Button loading={tagging} text="Confirm tag" />
+ <div>
+ <label
+ htmlFor="Tag Selection"
+ className="block text-sm text-gray-700"
+ >
+ Tag
+ </label>
+ <Command ref={ref} className="relative" loop>
+ <div className="relative mt-3 w-full rounded-md">
+ <Search className="absolute inset-y-0 left-0 my-auto h-7 w-7 pl-3 text-gray-400" />
+ <Command.Input
+ placeholder="Choose tag"
+ onFocus={() => setOpen(true)}
+ value={value}
+ onValueChange={setValue}
+ onKeyDown={(e) => {
+ if (e.key === "Escape") {
+ e.stopPropagation();
+ setOpen(false);
+ } else if (e.key === "Enter") {
+ if (open) {
+ // if dropdown is open, close it
+ setOpen(false);
+ } else {
+ // if dropdown is already closed, submit form
+ handleSubmit();
+ }
+ } else {
+ setOpen(true);
+ }
+ }}
+ className="block w-full rounded-md border-gray-300 px-10 text-sm text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:outline-none focus:ring-gray-500"
+ />
+ {value ? (
+ <button
+ onClick={() => {
+ setValue("");
+ setOpen(true);
+ }}
+ className="absolute inset-y-0 right-0 my-auto"
+ >
+ <X className="h-7 w-7 pr-3 text-gray-400" />
+ </button>
+ ) : (
+ <ChevronDown className="absolute inset-y-0 right-0 my-auto h-7 w-7 pr-3 text-gray-400" />
+ )}
+ </div>
+ {open && (
+ <Command.List className="absolute z-10 mt-2 max-h-[300px] w-full animate-slide-down overflow-auto rounded-md border border-gray-200 bg-white p-2 transition-all">
+ <Command.Empty>
+ <button
+ type="button"
+ className="flex w-full cursor-pointer items-center rounded-md px-4 py-2 text-sm text-gray-900 hover:bg-gray-100 hover:text-gray-900 aria-selected:bg-gray-100 aria-selected:text-gray-900"
+ >
+ Create tag{" "}
+ <span className="ml-1.5 rounded-md bg-red-100 px-2 py-0.5 text-red-600">
+ {value}
+ </span>
+ </button>
+ </Command.Empty>
+ {tags?.map((tag) => (
+ <Command.Item
+ key={tag.id}
+ value={tag.name}
+ onSelect={() => {
+ setValue(tag.name);
+ setSelectedTag(tag);
+ setOpen(false);
+ }}
+ className="flex cursor-pointer items-center rounded-md px-4 py-2 text-sm text-gray-900 hover:bg-gray-100 hover:text-gray-900 active:bg-gray-200 aria-selected:bg-gray-100 aria-selected:text-gray-900"
+ >
+ <Badge {...tag} />
+ </Command.Item>
+ ))}
+ </Command.List>
+ )}
+ </Command>
+ </div>
+
+ <Button loading={tagging} text="Confirm selection" />
</form>
</div>
</Modal>
diff --git a/components/layout/app/project-select.tsx b/components/layout/app/project-select.tsx
index a56b87d84d..2d9b45ff37 100644
--- a/components/layout/app/project-select.tsx
+++ b/components/layout/app/project-select.tsx
@@ -1,7 +1,6 @@
import { useRouter } from "next/router";
import { useContext, useMemo, useState } from "react";
import { useSession } from "next-auth/react";
-import { useAddProjectModal } from "@/components/app/modals/add-project-modal";
import BlurImage from "#/ui/blur-image";
import { ChevronUpDown, PlusCircle, Tick } from "@/components/shared/icons";
import Popover from "@/components/shared/popover";
diff --git a/components/shared/badge.tsx b/components/shared/badge.tsx
new file mode 100644
index 0000000000..2e0dd6b145
--- /dev/null
+++ b/components/shared/badge.tsx
@@ -0,0 +1,40 @@
+import { truncate } from "@/lib/utils";
+import clsx from "clsx";
+
+export default function Badge({
+ name,
+ color,
+}: {
+ name: string;
+ color: string;
+}) {
+ return (
+ <span
+ className={clsx(
+ "whitespace-nowrap rounded-md px-2 py-0.5 text-sm",
+ color === "gray" && "bg-gray-100 text-gray-600",
+ color === "red" && "bg-red-100 text-red-600",
+ color === "yellow" && "bg-yellow-100 text-yellow-600",
+ color === "green" && "bg-green-100 text-green-600",
+ color === "blue" && "bg-blue-100 text-blue-600",
+ color === "purple" && "bg-purple-100 text-purple-600",
+ color === "pink" && "bg-pink-100 text-pink-600",
+ )}
+ >
+ {truncate(name || "", 15)}
+ </span>
+ );
+}
+
+export function randomBadgeColor() {
+ const colors = [
+ "gray",
+ "red",
+ "yellow",
+ "green",
+ "blue",
+ "purple",
+ "pink",
+ ] as const;
+ return colors[Math.floor(Math.random() * colors.length)];
+}
diff --git a/components/shared/modal.tsx b/components/shared/modal.tsx
index 62ff466e04..2f617d3d5b 100644
--- a/components/shared/modal.tsx
+++ b/components/shared/modal.tsx
@@ -77,7 +77,19 @@ export default function Modal({
return (
<AnimatePresence>
{showModal && (
- <FocusTrap focusTrapOptions={{ initialFocus: false }}>
+ <FocusTrap
+ focusTrapOptions={{
+ initialFocus: false,
+ onActivate: () => {
+ // prevent scroll outside of modal when modal is open
+ document.body.style.overflow = "hidden";
+ },
+ onDeactivate: () => {
+ // allow scroll outside of modal when modal is closed
+ document.body.style.overflow = "auto";
+ },
+ }}
+ >
<div className="absolute">
<motion.div
ref={mobileModalRef}
diff --git a/components/shared/popover.tsx b/components/shared/popover.tsx
index 20ec6bd7b5..7af57b3ecf 100644
--- a/components/shared/popover.tsx
+++ b/components/shared/popover.tsx
@@ -1,8 +1,8 @@
import { useRouter } from "next/router";
-import { ReactNode, useEffect, useRef, useState } from "react";
+import { ReactNode, useEffect, useRef } from "react";
import * as PopoverPrimitive from "@radix-ui/react-popover";
import { AnimatePresence, motion, useAnimation } from "framer-motion";
-import useViewportSize from "@/lib/hooks/use-viewport-size";
+import useWindowSize from "#/lib/hooks/use-window-size";
export default function Popover({
children,
@@ -14,8 +14,8 @@ export default function Popover({
children: ReactNode;
content: ReactNode | string;
align?: "center" | "start" | "end";
- openPopover;
- setOpenPopover;
+ openPopover: boolean;
+ setOpenPopover: (open: boolean) => void;
}) {
const router = useRouter();
@@ -35,7 +35,7 @@ export default function Popover({
controls.start({ y: 0, transition: transitionProps });
}
}
- const { width } = useViewportSize();
+ const { width } = useWindowSize();
// workaround to make popover close when route changes on desktop
useEffect(() => {
@@ -89,7 +89,7 @@ export default function Popover({
<PopoverPrimitive.Root
// workaround to make popover work on mobile (without this it'll automatically close on click without changing route)
open={width > 640 && openPopover}
- onOpenChange={width > 640 && setOpenPopover}
+ onOpenChange={width > 640 ? setOpenPopover : undefined}
>
<PopoverPrimitive.Trigger className="hidden md:inline-flex" asChild>
{children}
diff --git a/components/shared/badge-select.tsx b/components/shared/tab-select.tsx
similarity index 94%
rename from components/shared/badge-select.tsx
rename to components/shared/tab-select.tsx
index 408010a185..afa300976b 100644
--- a/components/shared/badge-select.tsx
+++ b/components/shared/tab-select.tsx
@@ -1,4 +1,4 @@
-export default function BadgeSelect({
+export default function TabSelect({
options,
selected,
selectAction,
diff --git a/components/stats/devices.tsx b/components/stats/devices.tsx
index 4df0b52f89..70e7aa0f0f 100644
--- a/components/stats/devices.tsx
+++ b/components/stats/devices.tsx
@@ -1,7 +1,7 @@
import { useContext, useMemo, useState } from "react";
import { useRouter } from "next/router";
import { motion } from "framer-motion";
-import BadgeSelect from "@/components/shared/badge-select";
+import TabSelect from "@/components/shared/tab-select";
import { LoadingCircle } from "#/ui/icons";
import { DeviceTabs, uaToBot } from "@/lib/stats";
import { nFormatter } from "@/lib/utils";
@@ -31,7 +31,7 @@ export default function Devices() {
<div className="relative z-0 h-[420px] overflow-scroll border border-gray-200 bg-white px-7 py-5 scrollbar-hide sm:rounded-lg sm:border-gray-100 sm:shadow-lg">
<div className="mb-5 flex justify-between">
<h1 className="text-xl font-semibold">Devices</h1>
- <BadgeSelect
+ <TabSelect
options={["device", "browser", "os", "bot"]}
selected={tab}
// @ts-ignore
diff --git a/components/stats/locations.tsx b/components/stats/locations.tsx
index fe100ff747..816711e9c1 100644
--- a/components/stats/locations.tsx
+++ b/components/stats/locations.tsx
@@ -1,6 +1,6 @@
import { useContext, useState } from "react";
import { motion } from "framer-motion";
-import BadgeSelect from "@/components/shared/badge-select";
+import TabSelect from "@/components/shared/tab-select";
import { COUNTRIES } from "@/lib/constants";
import { LocationTabs } from "@/lib/stats";
import { nFormatter } from "@/lib/utils";
@@ -30,7 +30,7 @@ export default function Locations() {
<div className="relative z-0 h-[420px] overflow-scroll border border-gray-200 bg-white px-7 py-5 scrollbar-hide sm:rounded-lg sm:border-gray-100 sm:shadow-lg">
<div className="mb-5 flex justify-between">
<h1 className="text-xl font-semibold">Locations</h1>
- <BadgeSelect
+ <TabSelect
options={["country", "city"]}
selected={tab}
// @ts-ignore
diff --git a/lib/api/links.ts b/lib/api/links.ts
index ad8443cd9f..fa038b5516 100644
--- a/lib/api/links.ts
+++ b/lib/api/links.ts
@@ -112,7 +112,7 @@ export async function getLinksCount({
};
if (groupBy) {
- const inputs = await prisma.link.groupBy({
+ return await prisma.link.groupBy({
by: [groupBy],
where: {
projectId,
@@ -122,12 +122,18 @@ export async function getLinksCount({
key: { search },
url: { search },
}),
+ // when filtering by domain, only filter by domain if the filter group is not "Domains"
...(domain &&
groupBy !== "domain" && {
domain,
}),
+ // when filtering by tagId, only filter by tagId if the filter group is not "Tags"
+ ...(tagId &&
+ groupBy !== "tagId" && {
+ tagId,
+ }),
+ // for the "Tags" filter group, only count links that have a tagId
...(groupBy === "tagId" && {
- tagId,
NOT: {
tagId: null,
},
@@ -140,27 +146,6 @@ export async function getLinksCount({
},
},
});
- if (groupBy === "tagId") {
- // for tags, we need to get the tag name
- const tags = await prisma.tag.findMany({
- where: {
- projectId,
- id: {
- // @ts-ignore
- in: inputs.map((input) => input.tagId),
- },
- },
- });
- return inputs.map((input) => {
- const tag = tags.find((tag) => tag.id === input.tagId)!;
- return {
- ...input,
- tag: tag.name,
- };
- });
- } else {
- return inputs;
- }
} else {
return await prisma.link.count({
where: {
diff --git a/lib/auth.ts b/lib/auth.ts
index 990fba9f0c..259b84ea4b 100644
--- a/lib/auth.ts
+++ b/lib/auth.ts
@@ -124,7 +124,7 @@ interface WithUsertNextApiHandler {
res: NextApiResponse,
session: Session,
user?: UserProps,
- ): Promise<void>;
+ ): any;
}
const withUserAuth =
@@ -207,7 +207,7 @@ const withLinksAuth =
} = {},
) =>
async (req: NextApiRequest, res: NextApiResponse) => {
- console.log("Running withLinksAuth helper for endpoint: ", req.url);
+ // console.log("Running withLinksAuth helper for endpoint: ", req.url);
const session = await getSession(req, res);
if (!session?.user.id) {
diff --git a/lib/constants/index.ts b/lib/constants/index.ts
index 4b756bdc5f..6f8132a52d 100644
--- a/lib/constants/index.ts
+++ b/lib/constants/index.ts
@@ -80,6 +80,7 @@ export const DEFAULT_REDIRECTS = {
welcome: "https://app.dub.sh/welcome",
slack: "https://dub.slack.com",
discord: "https://twitter.com/dubdotsh", // placeholder for now
+ tags: "https://dub.sh/changelog/introducing-tags",
};
export const REDIRECT_HEADERS = {
diff --git a/lib/hooks/use-viewport-size.ts b/lib/hooks/use-viewport-size.ts
deleted file mode 100644
index 247e891b2b..0000000000
--- a/lib/hooks/use-viewport-size.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { useEffect, useState } from "react";
-
-interface ViewportSize {
- width: number;
- height: number;
-}
-
-function getViewportSize(): ViewportSize {
- const { innerWidth: width, innerHeight: height } = window;
- return {
- width,
- height,
- };
-}
-
-export default function useViewportSize(): ViewportSize {
- const [viewportSize, setViewportSize] = useState<ViewportSize>({
- width: 0,
- height: 0,
- });
-
- useEffect(() => {
- setViewportSize(getViewportSize());
-
- function handleResize() {
- setViewportSize(getViewportSize());
- }
-
- window.addEventListener("resize", handleResize);
- return () => window.removeEventListener("resize", handleResize);
- }, []);
-
- return viewportSize;
-}
diff --git a/lib/swr/use-links-count.ts b/lib/swr/use-links-count.ts
index e92078b28d..d0a400f30c 100644
--- a/lib/swr/use-links-count.ts
+++ b/lib/swr/use-links-count.ts
@@ -17,7 +17,7 @@ export default function useLinksCount({
)}`,
fetcher,
{
- dedupingInterval: 10000,
+ dedupingInterval: 30000,
keepPreviousData: true,
},
);
diff --git a/lib/swr/use-tags.ts b/lib/swr/use-tags.ts
new file mode 100644
index 0000000000..f40b504fc7
--- /dev/null
+++ b/lib/swr/use-tags.ts
@@ -0,0 +1,23 @@
+import { useRouter } from "next/router";
+import useSWR from "swr";
+import { TagProps } from "@/lib/types";
+import { fetcher } from "@/lib/utils";
+
+export default function useTags() {
+ const router = useRouter();
+ const { slug } = router.query as { slug?: string };
+
+ const { data: tags, isValidating } = useSWR<TagProps[]>(
+ router.isReady && `/api/projects/${slug}/tags`,
+ fetcher,
+ {
+ dedupingInterval: 30000,
+ },
+ );
+
+ return {
+ tags,
+ loading: tags ? false : true,
+ isValidating,
+ };
+}
diff --git a/lib/types.ts b/lib/types.ts
index 3ad93334aa..f564d86fb9 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -29,6 +29,12 @@ export interface LinkProps {
updatedAt?: Date;
}
+export interface TagProps {
+ id: string;
+ name: string;
+ color: string;
+}
+
export type PlanProps = "free" | "pro" | "enterprise";
export interface ProjectProps {
diff --git a/lib/utils.ts b/lib/utils.ts
index 3567c1f5bd..ee2be49255 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -208,6 +208,8 @@ export const validDomainRegex = new RegExp(
/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,
);
+export const validSlugRegex = new RegExp(/^[a-zA-Z0-9\-]+$/);
+
export const getSubdomain = (name: string, apexName: string) => {
if (name === apexName) return null;
return name.slice(0, name.length - apexName.length - 1);
diff --git a/package.json b/package.json
index 1a64125ba0..3dbd4df5eb 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"@visx/tooltip": "^2.16.0",
"cloudinary": "^1.36.4",
"clsx": "^1.2.1",
+ "cmdk": "^0.2.0",
"cobe": "^0.6.3",
"contentlayer": "^0.3.2",
"crisp-sdk-web": "^1.0.18",
@@ -83,7 +84,6 @@
"use-debounce": "^8.0.4"
},
"devDependencies": {
- "@tailwindcss/line-clamp": "^0.4.2",
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/he": "^1.1.2",
"@types/html-escaper": "^3.0.0",
diff --git a/pages/api/links/[key]/tag.ts b/pages/api/links/[key]/tag.ts
index 119e8429bf..51400eb962 100644
--- a/pages/api/links/[key]/tag.ts
+++ b/pages/api/links/[key]/tag.ts
@@ -1,18 +1,43 @@
+import { randomBadgeColor } from "@/components/shared/badge";
import { withLinksAuth } from "@/lib/auth";
+import { DUB_PROJECT_ID } from "@/lib/constants";
+import prisma from "@/lib/prisma";
-export default withLinksAuth(
- async (req, res, _session, _project, domain) => {
- const { key, tagId } = req.query as { key: string; tagId: string };
-
- if (req.method === "POST") {
- const response = key;
- return res.status(200).json(response);
- } else {
- res.setHeader("Allow", ["POST"]);
- return res.status(405).end(`Method ${req.method} Not Allowed`);
- }
- },
- {
- requiredPlan: ["pro", "enterprise"],
- },
-);
+export default withLinksAuth(async (req, res, _session, project, domain) => {
+ const { key } = req.query as { key: string };
+ const { tag } = req.body as { tag: string };
+ if (!key) {
+ return res.status(400).json({ error: "Missing key" });
+ }
+ if (req.method === "POST") {
+ const response = await prisma.link.update({
+ where: {
+ domain_key: {
+ domain: domain || "dub.sh",
+ key,
+ },
+ },
+ data: {
+ tag: {
+ connectOrCreate: {
+ where: {
+ name_projectId: {
+ name: tag,
+ projectId: project?.id || DUB_PROJECT_ID,
+ },
+ },
+ create: {
+ name: tag,
+ color: randomBadgeColor(),
+ projectId: project?.id || DUB_PROJECT_ID,
+ },
+ },
+ },
+ },
+ });
+ return res.status(200).json(response);
+ } else {
+ res.setHeader("Allow", ["POST"]);
+ return res.status(405).end(`Method ${req.method} Not Allowed`);
+ }
+});
diff --git a/pages/api/projects/[slug]/index.ts b/pages/api/projects/[slug]/index.ts
index e6d8678821..c07a810be6 100644
--- a/pages/api/projects/[slug]/index.ts
+++ b/pages/api/projects/[slug]/index.ts
@@ -3,12 +3,6 @@ import { removeDomainFromVercel, deleteDomainLinks } from "@/lib/api/domains";
import prisma from "@/lib/prisma";
export default withProjectAuth(async (req, res, project) => {
- const { slug } = req.query;
- if (!slug || typeof slug !== "string") {
- return res
- .status(400)
- .json({ error: "Missing or misconfigured project slug" });
- }
// GET /api/projects/[slug] – get a specific project
if (req.method === "GET") {
return res.status(200).json(project);
@@ -19,7 +13,7 @@ export default withProjectAuth(async (req, res, project) => {
try {
const response = await prisma.project.update({
where: {
- slug,
+ slug: project.slug,
},
data: {
...(name && { name }),
@@ -48,7 +42,7 @@ export default withProjectAuth(async (req, res, project) => {
const response = await Promise.allSettled([
prisma.project.delete({
where: {
- slug,
+ slug: project.slug,
},
}),
...domains.map((domain) => removeDomainFromVercel(domain)),
diff --git a/pages/api/projects/[slug]/invite/accept.ts b/pages/api/projects/[slug]/invite/accept.ts
index 6330556496..9554312a87 100644
--- a/pages/api/projects/[slug]/invite/accept.ts
+++ b/pages/api/projects/[slug]/invite/accept.ts
@@ -1,52 +1,47 @@
import { Session, withUserAuth } from "@/lib/auth";
import prisma from "@/lib/prisma";
-import { NextApiRequest, NextApiResponse } from "next";
-export default withUserAuth(
- async (req: NextApiRequest, res: NextApiResponse, session: Session) => {
- const { slug } = req.query as { slug: string };
- if (!slug || typeof slug !== "string") {
- return res
- .status(400)
- .json({ error: "Missing or misconfigured project slug" });
- }
- if (req.method === "POST") {
- const invite = await prisma.projectInvite.findFirst({
- where: {
- email: session.user.email,
- project: {
- slug,
- },
- },
- select: {
- expires: true,
- projectId: true,
+export default withUserAuth(async (req, res, session) => {
+ const { slug } = req.query as { slug: string };
+ if (!slug || typeof slug !== "string") {
+ return res.status(400).end("Missing or misconfigured project slug");
+ }
+ if (req.method === "POST") {
+ const invite = await prisma.projectInvite.findFirst({
+ where: {
+ email: session.user.email,
+ project: {
+ slug,
},
- });
- if (!invite) {
- return res.status(404).json({ error: "Invalid invitation" });
- } else if (invite.expires < new Date()) {
- return res.status(410).json({ error: "Invitation expired" });
- } else {
- const response = await Promise.all([
- prisma.projectUsers.create({
- data: {
- userId: session.user.id,
- role: "member",
+ },
+ select: {
+ expires: true,
+ projectId: true,
+ },
+ });
+ if (!invite) {
+ return res.status(404).json({ error: "Invalid invitation" });
+ } else if (invite.expires < new Date()) {
+ return res.status(410).json({ error: "Invitation expired" });
+ } else {
+ const response = await Promise.all([
+ prisma.projectUsers.create({
+ data: {
+ userId: session.user.id,
+ role: "member",
+ projectId: invite.projectId,
+ },
+ }),
+ prisma.projectInvite.delete({
+ where: {
+ email_projectId: {
+ email: session.user.email,
projectId: invite.projectId,
},
- }),
- prisma.projectInvite.delete({
- where: {
- email_projectId: {
- email: session.user.email,
- projectId: invite.projectId,
- },
- },
- }),
- ]);
- return res.status(200).json(response);
- }
+ },
+ }),
+ ]);
+ return res.status(200).json(response);
}
- },
-);
+ }
+});
diff --git a/pages/api/projects/[slug]/invite/index.tsx b/pages/api/projects/[slug]/invite/index.tsx
index ddbfc12a24..8a51c00ab5 100644
--- a/pages/api/projects/[slug]/invite/index.tsx
+++ b/pages/api/projects/[slug]/invite/index.tsx
@@ -11,13 +11,6 @@ const hashToken = (token: string) => {
};
export default withProjectAuth(async (req, res, project) => {
- const { slug } = req.query;
- if (!slug || typeof slug !== "string") {
- return res
- .status(400)
- .json({ error: "Missing or misconfigured project slug" });
- }
-
// GET /api/projects/[slug]/invite - Get all pending invites for a project
if (req.method === "GET") {
const invites = await prisma.projectInvite.findMany({
diff --git a/pages/api/projects/[slug]/tags/index.ts b/pages/api/projects/[slug]/tags/index.ts
new file mode 100644
index 0000000000..f2822c5630
--- /dev/null
+++ b/pages/api/projects/[slug]/tags/index.ts
@@ -0,0 +1,29 @@
+import { withProjectAuth } from "@/lib/auth";
+import { removeDomainFromVercel, deleteDomainLinks } from "@/lib/api/domains";
+import prisma from "@/lib/prisma";
+
+export default withProjectAuth(async (req, res, project) => {
+ // GET /api/projects/[slug]/tags - get all tags for a project
+ if (req.method === "GET") {
+ const tags = await prisma.tag.findMany({
+ where: {
+ projectId: project.id,
+ },
+ select: {
+ id: true,
+ name: true,
+ color: true,
+ },
+ orderBy: {
+ createdAt: "desc",
+ },
+ });
+ return res.status(200).json(tags);
+
+ // PUT /api/projects/[slug]/tags – create a new tag for a project
+ } else if (req.method === "POST") {
+ } else {
+ res.setHeader("Allow", ["GET", "POST"]);
+ return res.status(405).json({ error: `Method ${req.method} Not Allowed` });
+ }
+});
diff --git a/pages/api/projects/[slug]/users.ts b/pages/api/projects/[slug]/users.ts
index 5bcc439b4d..8f72ffe25d 100644
--- a/pages/api/projects/[slug]/users.ts
+++ b/pages/api/projects/[slug]/users.ts
@@ -2,13 +2,6 @@ import { withProjectAuth } from "@/lib/auth";
import prisma from "@/lib/prisma";
export default withProjectAuth(async (req, res, project) => {
- const { slug } = req.query;
- if (!slug || typeof slug !== "string") {
- return res
- .status(400)
- .json({ error: "Missing or misconfigured project slug" });
- }
-
// GET /api/projects/[slug]/users – get users for a specific project
if (req.method === "GET") {
const { id: projectId } = project;
diff --git a/pages/api/projects/index.ts b/pages/api/projects/index.ts
index 8a13b957be..dbd76cb835 100644
--- a/pages/api/projects/index.ts
+++ b/pages/api/projects/index.ts
@@ -7,7 +7,7 @@ import {
validateDomain,
} from "@/lib/api/domains";
import prisma from "@/lib/prisma";
-import { isReservedKey } from "@/lib/utils";
+import { isReservedKey, validSlugRegex } from "@/lib/utils";
export default withUserAuth(
async (req: NextApiRequest, res: NextApiResponse, session: Session) => {
@@ -36,11 +36,16 @@ export default withUserAuth(
.json({ error: "Missing name or slug or domain" });
}
let slugError: string | null = null;
- if (slug.includes(" ") || slug.includes(".")) {
- slugError = "Slug cannot contain spaces or periods";
+
+ // check if slug is valid
+ if (!validSlugRegex.test(slug)) {
+ slugError = "Invalid slug";
+
+ // check if slug is reserved
} else if ((await isReservedKey(slug)) || DEFAULT_REDIRECTS[slug]) {
slugError = "Cannot use reserved slugs";
}
+
const validDomain = await validateDomain(domain);
if (slugError || validDomain !== true) {
return res.status(422).json({
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 01d45639dc..ffca8b9c12 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -214,6 +214,7 @@ model Link {
model Tag {
id String @id @default(cuid())
name String
+ color String @default("gray")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)
diff --git a/tailwind.config.js b/tailwind.config.js
index e227a443aa..445540bb23 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -17,6 +17,8 @@ module.exports = {
default: ["var(--font-inter)", "system-ui", "sans-serif"],
},
animation: {
+ // Input Select
+ "slide-down": "slide-down 0.2s cubic-bezier(0.16, 1, 0.3, 1)",
// Tooltip
"slide-up-fade": "slide-up-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1)",
"slide-right-fade":
@@ -36,6 +38,11 @@ module.exports = {
wiggle: "wiggle 0.75s infinite",
},
keyframes: {
+ // Input Select
+ "slide-down": {
+ "0%": { transform: "translateY(-8px)" },
+ "100%": { transform: "translateY(0)" },
+ },
// Tooltip
"slide-up-fade": {
"0%": { opacity: 0, transform: "translateY(2px)" },
@@ -91,6 +98,20 @@ module.exports = {
"75%": { transform: "translateX(-1px) rotate(-0.8deg)" },
},
},
+ colors: {
+ brown: {
+ 50: "#fdf8f6",
+ 100: "#f2e8e5",
+ 200: "#eaddd7",
+ 300: "#e0cec7",
+ 400: "#d2bab0",
+ 500: "#bfa094",
+ 600: "#a18072",
+ 700: "#977669",
+ 800: "#846358",
+ 900: "#43302b",
+ },
+ },
},
},
plugins: [
diff --git a/yarn.lock b/yarn.lock
index c04b8475b7..64d09fc525 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1366,6 +1366,27 @@
dependencies:
"@babel/runtime" "^7.13.10"
+"@radix-ui/[email protected]":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-dialog/-/react-dialog-1.0.0.tgz#997e97cb183bc90bd888b26b8e23a355ac9fe5f0"
+ integrity sha512-Yn9YU+QlHYLWwV1XfKiqnGVpWYWk6MeBVM6x/bcoyPvxgjQGoeT35482viLPctTMWoMw0PoHgqfSox7Ig+957Q==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/primitive" "1.0.0"
+ "@radix-ui/react-compose-refs" "1.0.0"
+ "@radix-ui/react-context" "1.0.0"
+ "@radix-ui/react-dismissable-layer" "1.0.0"
+ "@radix-ui/react-focus-guards" "1.0.0"
+ "@radix-ui/react-focus-scope" "1.0.0"
+ "@radix-ui/react-id" "1.0.0"
+ "@radix-ui/react-portal" "1.0.0"
+ "@radix-ui/react-presence" "1.0.0"
+ "@radix-ui/react-primitive" "1.0.0"
+ "@radix-ui/react-slot" "1.0.0"
+ "@radix-ui/react-use-controllable-state" "1.0.0"
+ aria-hidden "^1.1.1"
+ react-remove-scroll "2.5.4"
+
"@radix-ui/[email protected]":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@radix-ui/react-direction/-/react-direction-1.0.0.tgz#a2e0b552352459ecf96342c79949dd833c1e6e45"
@@ -1373,6 +1394,18 @@
dependencies:
"@babel/runtime" "^7.13.10"
+"@radix-ui/[email protected]":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.0.tgz#35b7826fa262fd84370faef310e627161dffa76b"
+ integrity sha512-n7kDRfx+LB1zLueRDvZ1Pd0bxdJWDUZNQ/GWoxDn2prnuJKRdxsjulejX/ePkOsLi2tTm6P24mDqlMSgQpsT6g==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/primitive" "1.0.0"
+ "@radix-ui/react-compose-refs" "1.0.0"
+ "@radix-ui/react-primitive" "1.0.0"
+ "@radix-ui/react-use-callback-ref" "1.0.0"
+ "@radix-ui/react-use-escape-keydown" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.2.tgz#f04d1061bddf00b1ca304148516b9ddc62e45fb2"
@@ -1404,6 +1437,16 @@
dependencies:
"@babel/runtime" "^7.13.10"
+"@radix-ui/[email protected]":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.0.tgz#95a0c1188276dc8933b1eac5f1cdb6471e01ade5"
+ integrity sha512-C4SWtsULLGf/2L4oGeIHlvWQx7Rf+7cX/vKOAD2dXW0A1b5QXwi3wWeaEgW+wn+SEVrraMUk05vLU9fZZz5HbQ==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/react-compose-refs" "1.0.0"
+ "@radix-ui/react-primitive" "1.0.0"
+ "@radix-ui/react-use-callback-ref" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.1.tgz#faea8c25f537c5a5c38c50914b63722db0e7f951"
@@ -1481,6 +1524,14 @@
"@radix-ui/react-use-size" "1.0.0"
"@radix-ui/rect" "1.0.0"
+"@radix-ui/[email protected]":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.0.0.tgz#7220b66743394fabb50c55cb32381395cc4a276b"
+ integrity sha512-a8qyFO/Xb99d8wQdu4o7qnigNjTPG123uADNecz0eX4usnQEj7o+cG4ZX4zkqq98NYekT7UoEQIjxBNWIFuqTA==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/react-primitive" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.0.1.tgz#169c5a50719c2bb0079cf4c91a27aa6d37e5dd33"
@@ -1498,6 +1549,14 @@
"@radix-ui/react-compose-refs" "1.0.0"
"@radix-ui/react-use-layout-effect" "1.0.0"
+"@radix-ui/[email protected]":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-primitive/-/react-primitive-1.0.0.tgz#376cd72b0fcd5e0e04d252ed33eb1b1f025af2b0"
+ integrity sha512-EyXe6mnRlHZ8b6f4ilTDrXmkLShICIuOTTj0GX4w1rp+wSxf3+TD05u1UOITC8VsJ2a9nwHvdXtOXEOl0Cw/zQ==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/react-slot" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@radix-ui/react-primitive/-/react-primitive-1.0.1.tgz#c1ebcce283dd2f02e4fbefdaa49d1cb13dbc990a"
@@ -1532,6 +1591,14 @@
"@radix-ui/react-use-previous" "1.0.0"
"@radix-ui/react-use-size" "1.0.0"
+"@radix-ui/[email protected]":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-slot/-/react-slot-1.0.0.tgz#7fa805b99891dea1e862d8f8fbe07f4d6d0fd698"
+ integrity sha512-3mrKauI/tWXo1Ll+gN5dHcxDPdm/Df1ufcDLCecn+pnCIVcdWE7CujXo8QaXOWRJyZyQWWbpB8eFwHzWXlv5mQ==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/react-compose-refs" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@radix-ui/react-slot/-/react-slot-1.0.1.tgz#e7868c669c974d649070e9ecbec0b367ee0b4d81"
@@ -1588,6 +1655,14 @@
"@babel/runtime" "^7.13.10"
"@radix-ui/react-use-callback-ref" "1.0.0"
+"@radix-ui/[email protected]":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.0.0.tgz#aef375db4736b9de38a5a679f6f49b45a060e5d1"
+ integrity sha512-JwfBCUIfhXRxKExgIqGa4CQsiMemo1Xt0W/B4ei3fpzpvPENKpMKQ8mZSB6Acj3ebrAEgi2xiQvcI1PAAodvyg==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/react-use-callback-ref" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.0.2.tgz#09ab6455ab240b4f0a61faf06d4e5132c4d639f6"
@@ -3168,6 +3243,14 @@ cmd-shim@^6.0.0:
resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-6.0.0.tgz#6c4eb6437defacf0ae8e9d281d5b06749730a65b"
integrity sha512-wx+RWLgiSU6SCDzMtxG0Dv1lsuOcEfqq5SbqAViezaJIkR5sbveKzFU31YnWhqrJx3o3Iu3H0Rq8R00OS3oI+Q==
+cmdk@^0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/cmdk/-/cmdk-0.2.0.tgz#53c52d56d8776c8bb8ced1055b5054100c388f7c"
+ integrity sha512-JQpKvEOb86SnvMZbYaFKYhvzFntWBeSZdyii0rZPhKJj9uwJBxu4DaVYDrRN7r3mPop56oPhRw+JYWTKs66TYw==
+ dependencies:
+ "@radix-ui/react-dialog" "1.0.0"
+ command-score "0.1.2"
+
cobe@^0.6.3:
version "0.6.3"
resolved "https://registry.yarnpkg.com/cobe/-/cobe-0.6.3.tgz#9c3d45ae3a328b7bf709eb17b02f9caff41b22f0"
@@ -3240,6 +3323,11 @@ comma-separated-tokens@^2.0.0:
resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee"
integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/command-score/-/command-score-0.1.2.tgz#b986ad7e8c0beba17552a56636c44ae38363d381"
+ integrity sha512-VtDvQpIJBvBatnONUsPzXYFVKQQAhuf3XTNOAsdBxCNO/QCtUUd8LSgjn0GVarBkCad6aJCZfXgrjYbl/KRr7w==
+
commander@2, commander@^2.19.0, commander@^2.20.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
@@ -7722,6 +7810,17 @@ react-remove-scroll-bar@^2.3.3:
react-style-singleton "^2.2.1"
tslib "^2.0.0"
+ version "2.5.4"
+ resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.5.4.tgz#afe6491acabde26f628f844b67647645488d2ea0"
+ integrity sha512-xGVKJJr0SJGQVirVFAUZ2k1QLyO6m+2fy0l8Qawbp5Jgrv3DeLalrfMNBFSlmz5kriGGzsVBtGVnf4pTKIhhWA==
+ dependencies:
+ react-remove-scroll-bar "^2.3.3"
+ react-style-singleton "^2.2.1"
+ tslib "^2.1.0"
+ use-callback-ref "^1.3.0"
+ use-sidecar "^1.1.2"
+
version "2.5.5"
resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz#1e31a1260df08887a8a0e46d09271b52b3a37e77"