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.

fix stats to use /[endpoint]

Steven Teye37613f30498
diff --git a/apps/web/app/api/edge/stats/route.ts b/apps/web/app/api/edge/stats/[endpoint]/route.ts
similarity index 88%
rename from apps/web/app/api/edge/stats/route.ts
rename to apps/web/app/api/edge/stats/[endpoint]/route.ts
index 48a60437cc..1130bfeca1 100644
--- a/apps/web/app/api/edge/stats/route.ts
+++ b/apps/web/app/api/edge/stats/[endpoint]/route.ts
@@ -1,4 +1,4 @@
-import { getParams } from "@/lib/auth-app";
+import { getSearchParams } from "@/lib/auth-app";
import { isBlacklistedReferrer } from "@/lib/edge-config";
import { getLinkViaEdge } from "@/lib/planetscale";
import { getStats } from "@/lib/stats";
@@ -10,8 +10,12 @@ import { NextResponse, type NextRequest } from "next/server";
// TODO: switch to 'edge' after https://github.com/vercel/next.js/issues/48295 is fixed
export const runtime = "nodejs";
-export const GET = async (req: NextRequest) => {
- const { domain, key, endpoint, interval } = getParams(req.url);
+export const GET = async (
+ req: NextRequest,
+ { params }: { params: Record<string, string> },
+) => {
+ const { endpoint } = params;
+ const { domain, key, interval } = getSearchParams(req.url);
// demo link (dub.sh/github)
if (domain === "dub.sh" && key === "github") {
diff --git a/apps/web/app/api/stats/[endpoint]/route.ts b/apps/web/app/api/stats/[endpoint]/route.ts
new file mode 100644
index 0000000000..026436b1d2
--- /dev/null
+++ b/apps/web/app/api/stats/[endpoint]/route.ts
@@ -0,0 +1,16 @@
+import { getSearchParams, withAuth } from "@/lib/auth-app";
+import { getStats } from "@/lib/stats";
+import { NextResponse } from "next/server";
+
+export const GET = withAuth(async ({ params, searchParams }) => {
+ const { endpoint } = params;
+ const { domain, key, interval } = searchParams;
+
+ const response = await getStats({
+ domain,
+ key,
+ endpoint,
+ interval,
+ });
+ return NextResponse.json(response);
+});
diff --git a/apps/web/app/api/stats/route.ts b/apps/web/app/api/stats/route.ts
index 3368550186..a30e2d7b4a 100644
--- a/apps/web/app/api/stats/route.ts
+++ b/apps/web/app/api/stats/route.ts
@@ -1,14 +1,36 @@
-import { getParams, withAuth } from "@/lib/auth-app";
-import { getStats } from "@/lib/stats";
+import { withAuth } from "@/lib/auth-app";
+import prisma from "@/lib/prisma";
import { NextResponse } from "next/server";
-export const GET = withAuth(async (req) => {
- const { domain, key, endpoint, interval } = getParams(req.url);
- const response = await getStats({
- domain,
- key,
- endpoint,
- interval,
+export const GET = withAuth(async ({ searchParams }) => {
+ const { domain, key } = searchParams;
+ const response = await prisma.link.findUnique({
+ where: {
+ domain_key: {
+ domain: domain || "dub.sh",
+ key,
+ },
+ },
+ select: {
+ publicStats: true,
+ },
+ });
+ return NextResponse.json(response);
+});
+
+export const PUT = withAuth(async ({ req, searchParams }) => {
+ const { domain, key } = searchParams;
+ const { publicStats } = await req.json();
+ const response = await prisma.link.update({
+ where: {
+ domain_key: {
+ domain: domain || "dub.sh",
+ key,
+ },
+ },
+ data: {
+ publicStats,
+ },
});
return NextResponse.json(response);
});
diff --git a/apps/web/lib/auth-app.ts b/apps/web/lib/auth-app.ts
index 0811bb3a99..8d215a529d 100644
--- a/apps/web/lib/auth-app.ts
+++ b/apps/web/lib/auth-app.ts
@@ -17,7 +17,7 @@ export async function getSession() {
return getServerSession(authOptions) as Promise<Session>;
}
-export function getParams(url: string) {
+export function getSearchParams(url: string) {
// Create a params object
let params = {} as any;
@@ -29,7 +29,19 @@ export function getParams(url: string) {
}
interface WithAuthHandler {
- (req: NextRequest, session: Session, project?: ProjectProps): any;
+ ({
+ req,
+ params,
+ searchParams,
+ session,
+ project,
+ }: {
+ req: Request;
+ params: Record<string, string>;
+ searchParams: Record<string, string>;
+ session: Session;
+ project?: ProjectProps;
+ }): Promise<Response>;
}
const withAuth =
(
@@ -46,13 +58,14 @@ const withAuth =
needNotExceededUsage?: boolean;
} = {},
) =>
- async (req: NextRequest) => {
+ async (req: Request, { params }: { params: Record<string, string> }) => {
const session = await getSession();
if (!session?.user.id) {
return new Response("Unauthorized: Login required.", { status: 401 });
}
- const { slug } = getParams(req.url);
+ const searchParams = getSearchParams(req.url);
+ const { slug } = searchParams;
// it's a project
if (slug) {
@@ -119,7 +132,7 @@ const withAuth =
// if the action doesn't need to be gated for GET requests, return handler now
if (req.method === "GET" && excludeGet) {
- return handler(req, session, project);
+ return handler({ req, params, searchParams, session, project });
}
if (
@@ -149,10 +162,10 @@ const withAuth =
});
}
- return handler(req, session, project);
+ return handler({ req, params, searchParams, session, project });
}
- return handler(req, session);
+ return handler({ req, params, searchParams, session });
};
export { withAuth };
diff --git a/apps/web/pages/api/links/[key]/stats/[endpoint].ts b/apps/web/pages/api/links/[key]/stats/[endpoint].ts
deleted file mode 100644
index 92a4d5ac65..0000000000
--- a/apps/web/pages/api/links/[key]/stats/[endpoint].ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { withLinksAuth } from "@/lib/auth";
-import { getStats, IntervalProps } from "@/lib/stats";
-
-export default withLinksAuth(
- async (req, res, _session, project, domain) => {
- // GET /api/links/[key]/stats/[endpoint] - get link stats from Tinybird
- if (req.method === "GET") {
- const { key, endpoint, interval } = req.query as {
- key: string;
- endpoint: string;
- interval: IntervalProps;
- };
-
- if (
- (interval === "all" || interval === "90d") &&
- (!project || project.plan === "free")
- ) {
- return res.status(403).end("Forbidden: Require higher plan");
- }
-
- const response = await getStats({
- domain: domain || "dub.sh",
- key,
- endpoint,
- interval,
- });
-
- if (!response) {
- return res.status(404).end("Not Found");
- }
-
- return res.status(200).json(response);
- } else {
- res.setHeader("Allow", ["GET"]);
- return res.status(405).end(`Method ${req.method} Not Allowed`);
- }
- },
- {
- needNotExceededUsage: true,
- },
-);
diff --git a/apps/web/pages/api/links/[key]/stats/index.ts b/apps/web/pages/api/links/[key]/stats/index.ts
deleted file mode 100644
index abac4833b3..0000000000
--- a/apps/web/pages/api/links/[key]/stats/index.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { withLinksAuth } from "@/lib/auth";
-import prisma from "@/lib/prisma";
-
-export default withLinksAuth(async (req, res, _session, _project, domain) => {
- const { key } = req.query as {
- key: string;
- };
-
- // GET /api/links/[key]/stats - get a link's stats page privacy
- if (req.method === "GET") {
- const link = await prisma.link.findUnique({
- where: {
- domain_key: {
- domain: domain || "dub.sh",
- key,
- },
- },
- select: {
- publicStats: true,
- },
- });
-
- return res.status(200).json(link);
-
- // PUT /api/links/[key]/stats - edit a link's stats page privacy
- } else if (req.method === "PUT") {
- const { publicStats } = req.body as { publicStats: boolean };
- const response = await prisma.link.update({
- where: {
- domain_key: {
- domain: domain || "dub.sh",
- key,
- },
- },
- data: {
- publicStats,
- },
- });
-
- return res.status(200).json(response);
- } else {
- res.setHeader("Allow", ["PUT"]);
- return res.status(405).end(`Method ${req.method} Not Allowed`);
- }
-});
diff --git a/apps/web/ui/layout/nav-tabs.tsx b/apps/web/ui/layout/nav-tabs.tsx
index a9fcef5592..0363db2b03 100644
--- a/apps/web/ui/layout/nav-tabs.tsx
+++ b/apps/web/ui/layout/nav-tabs.tsx
@@ -63,6 +63,9 @@ export default function NavTabs() {
(href.endsWith("/settings") && pathname?.startsWith(href))) && (
<motion.div
layoutId="indicator"
+ transition={{
+ duration: 0.25,
+ }}
className="absolute bottom-0 h-0.5 w-full bg-black"
/>
)}
diff --git a/apps/web/ui/stats/bar-chart.tsx b/apps/web/ui/stats/bar-chart.tsx
index 6775f1848c..6af973341e 100644
--- a/apps/web/ui/stats/bar-chart.tsx
+++ b/apps/web/ui/stats/bar-chart.tsx
@@ -31,10 +31,10 @@ const rangeFormatter = (maxN: number): number => {
};
export default function BarChart() {
- const { baseApiPath, getQueryString, interval } = useContext(StatsContext);
+ const { baseApiPath, queryString, interval } = useContext(StatsContext);
const { data } = useSWR<{ start: Date; clicks: number }[]>(
- `${baseApiPath}?${getQueryString({ endpoint: "timeseries" })}`,
+ `${baseApiPath}/timeseries?${queryString}`,
fetcher,
);
@@ -224,22 +224,29 @@ export default function BarChart() {
left={tooltipLeft}
className={styles.tooltip}
>
- <div className="text-center">
- <h3 className="my-1 text-black">
- <span className="text-2xl font-semibold">
- {nFormatter(tooltipData.clicks)}
- </span>{" "}
- click{tooltipData.clicks === 1 ? "" : "s"}
- </h3>
- <p className="text-xs text-gray-600">
- {formatTimestamp(tooltipData.start)} -{" "}
- {interval === "24h"
- ? new Date(tooltipData.end).toLocaleTimeString("en-us", {
- hour: "numeric",
- })
- : formatTimestamp(tooltipData.end)}
- </p>
- </div>
+ {
+ (
+ <div className="text-center">
+ <h3 className="my-1 text-black">
+ <span className="text-2xl font-semibold">
+ {nFormatter(tooltipData.clicks)}
+ </span>{" "}
+ click{tooltipData.clicks === 1 ? "" : "s"}
+ </h3>
+ <p className="text-xs text-gray-600">
+ {formatTimestamp(tooltipData.start)} -{" "}
+ {interval === "24h"
+ ? new Date(tooltipData.end).toLocaleTimeString(
+ "en-us",
+ {
+ hour: "numeric",
+ },
+ )
+ : formatTimestamp(tooltipData.end)}
+ </p>
+ </div>
+ ) as any
+ }
</TooltipInPortal>
)}
</>
diff --git a/apps/web/ui/stats/devices.tsx b/apps/web/ui/stats/devices.tsx
index 7878b00de1..3b461c3b7e 100644
--- a/apps/web/ui/stats/devices.tsx
+++ b/apps/web/ui/stats/devices.tsx
@@ -11,18 +11,14 @@ import DeviceIcon from "./device-icon";
export default function Devices() {
const [tab, setTab] = useState<DeviceTabs>("device");
- const { baseApiPath, getQueryString, totalClicks, modal } =
+ const { baseApiPath, queryString, totalClicks, modal } =
useContext(StatsContext);
const { data } = useSWR<
({
[key in DeviceTabs]: string;
} & { clicks: number })[]
- >(
- // `${baseApiPath}?${new URLSearchParams(queryString).set("endpoint", tab)}`,
- `${baseApiPath}?${getQueryString({ endpoint: tab })}`,
- fetcher,
- );
+ >(`${baseApiPath}/${tab}?${queryString}`, fetcher);
const [showModal, setShowModal] = useState(false);
diff --git a/apps/web/ui/stats/index.tsx b/apps/web/ui/stats/index.tsx
index 73c789728c..eae58addf2 100644
--- a/apps/web/ui/stats/index.tsx
+++ b/apps/web/ui/stats/index.tsx
@@ -31,10 +31,7 @@ export const StatsContext = createContext<{
baseApiPath: string;
domain: string;
key: string;
- getQueryString: (
- opts: { endpoint?: string; interval?: string },
- excludeSlug?: boolean,
- ) => string;
+ queryString: string;
interval: string;
totalClicks?: number;
modal?: boolean;
@@ -43,7 +40,7 @@ export const StatsContext = createContext<{
baseApiPath: "",
domain: "",
key: "",
- getQueryString: () => "",
+ queryString: "",
interval: "",
});
@@ -91,24 +88,15 @@ export default function Stats({
};
}, [slug, key, pathname]);
- const getQueryString = (
- opts: { endpoint?: string; interval?: string }, // query params to set
- excludeSlug?: boolean, // whether or not to exclude the slug param
- ) => {
- let params = new URLSearchParams({
- ...(slug && !excludeSlug && { slug }),
- domain: domain!,
- ...(key && { key }),
- ...(interval && { interval }),
- });
- for (const [key, value] of Object.entries(opts)) {
- params.set(key, value);
- }
- return params.toString();
- };
+ const queryString = new URLSearchParams({
+ ...(slug && { slug }),
+ domain: domain!,
+ ...(key && { key }),
+ ...(interval && { interval }),
+ }).toString();
const { data: totalClicks } = useSWR<number>(
- `${baseApiPath}?${getQueryString({ endpoint: "clicks" })}`,
+ `${baseApiPath}/clicks?${queryString}`,
fetcher,
);
@@ -117,7 +105,7 @@ export default function Stats({
value={{
basePath, // basePath for the page (e.g. /stats/[key], /links/[key], /[slug]/[domain]/[key])
baseApiPath, // baseApiPath for the API (e.g. /api/edge/links/[key]/stats)
- getQueryString,
+ queryString,
domain: domain!, // domain for the link (e.g. dub.sh, stey.me, etc.)
key: key ? decodeURIComponent(key) : "", // link key (e.g. github, weathergpt, etc.)
interval, // time interval (e.g. 24h, 7d, 30d, etc.)
diff --git a/apps/web/ui/stats/locations.tsx b/apps/web/ui/stats/locations.tsx
index 5bafb59661..ab0ba68cbb 100644
--- a/apps/web/ui/stats/locations.tsx
+++ b/apps/web/ui/stats/locations.tsx
@@ -10,11 +10,11 @@ import BarList from "./bar-list";
export default function Locations() {
const [tab, setTab] = useState<LocationTabs>("country");
- const { baseApiPath, getQueryString, totalClicks, modal } =
+ const { baseApiPath, queryString, totalClicks, modal } =
useContext(StatsContext);
const { data } = useSWR<{ country: string; city: string; clicks: number }[]>(
- `${baseApiPath}?${getQueryString({ endpoint: tab })}`,
+ `${baseApiPath}/${tab}?${queryString}`,
fetcher,
);
diff --git a/apps/web/ui/stats/referer.tsx b/apps/web/ui/stats/referer.tsx
index df6c7fdbd6..da4c2fbd7a 100644
--- a/apps/web/ui/stats/referer.tsx
+++ b/apps/web/ui/stats/referer.tsx
@@ -8,15 +8,11 @@ import { StatsContext } from ".";
import BarList from "./bar-list";
export default function Referer() {
- const { baseApiPath, getQueryString, totalClicks, modal } =
+ const { baseApiPath, queryString, totalClicks, modal } =
useContext(StatsContext);
const { data } = useSWR<{ referer: string; clicks: number }[]>(
- // `${baseApiPath}?${new URLSearchParams(queryString).set(
- // "endpoint",
- // "referer",
- // )}`,
- `${baseApiPath}?${getQueryString({ endpoint: "referer" })}`,
+ `${baseApiPath}/refererr?${queryString}`,
fetcher,
);
diff --git a/apps/web/ui/stats/toggle.tsx b/apps/web/ui/stats/toggle.tsx
index 1d15ff6335..898eb0d6d4 100644
--- a/apps/web/ui/stats/toggle.tsx
+++ b/apps/web/ui/stats/toggle.tsx
@@ -19,14 +19,15 @@ import punycode from "punycode/";
import { useContext, useMemo, useState } from "react";
import { StatsContext } from ".";
import { ModalContext } from "../modals/provider";
+import useSWR, { mutate } from "swr";
+import { toast } from "sonner";
export default function Toggle() {
const { slug } = useParams() as { slug?: string };
const { setShowUpgradePlanModal, setShowAddProjectModal } =
useContext(ModalContext);
- const { basePath, domain, key, getQueryString, interval, modal } =
- useContext(StatsContext);
+ const { basePath, domain, key, interval, modal } = useContext(StatsContext);
const [openDatePopover, setOpenDatePopover] = useState(false);
@@ -62,9 +63,7 @@ export default function Toggle() {
<ExpandingArrow className="h-5 w-5" />
</a>
<div className="flex items-center">
- {/* {!isPublicStatsPage && key !== "_root" && (
- <SharePopover />
- )} */}
+ {!isPublicStatsPage && key && key !== "_root" && <SharePopover />}
<Popover
content={
<div className="grid w-full p-2 md:w-48">
@@ -109,7 +108,11 @@ export default function Toggle() {
href={`${basePath}?${
isPublicStatsPage
? `interval=${value}`
- : getQueryString({ interval: value }, true)
+ : `${new URLSearchParams({
+ domain: domain!,
+ ...(key && { key }),
+ interval: value,
+ }).toString()}`
}`}
replace
className="flex w-full items-center justify-between space-x-2 rounded-md p-2 hover:bg-gray-100 active:bg-gray-200"
@@ -147,115 +150,115 @@ export default function Toggle() {
);
}
-// const SharePopover = () => {
-// const [openSharePopover, setopenSharePopoverPopover] = useState(false);
+const SharePopover = () => {
+ const [openSharePopover, setopenSharePopoverPopover] = useState(false);
-// const { endpoint, domain, key, queryString } = useContext(StatsContext);
+ const { baseApiPath, queryString, domain, key } = useContext(StatsContext);
-// const { data: { publicStats } = {} } = useSWR<{ publicStats: boolean }>(
-// `${endpoint}${queryString}`,
-// fetcher,
-// );
+ const { data: { publicStats } = {} } = useSWR<{ publicStats: boolean }>(
+ `${baseApiPath}?${queryString}`,
+ fetcher,
+ );
-// const [updating, setUpdating] = useState(false);
+ const [updating, setUpdating] = useState(false);
-// const handleChange = async () => {
-// toast.promise(
-// new Promise<void>(async (resolve) => {
-// setUpdating(true);
-// const res = await fetch(`${endpoint}${queryString}`, {
-// method: "PUT",
-// headers: {
-// "Content-Type": "application/json",
-// },
-// body: JSON.stringify({
-// publicStats: !publicStats,
-// }),
-// });
-// if (res.status === 200) {
-// await mutate(`${endpoint}${queryString}`);
-// !publicStats &&
-// navigator.clipboard.writeText(
-// `https://${domain}/stats/${encodeURIComponent(key)}`,
-// );
-// }
-// setUpdating(false);
-// resolve();
-// }),
-// {
-// loading: "Updating...",
-// success: `Stats page is now ${
-// publicStats ? "private." : "public. Link copied to clipboard."
-// }`,
-// error: "Something went wrong",
-// },
-// );
-// };
-// const [copied, setCopied] = useState(false);
+ const handleChange = async () => {
+ toast.promise(
+ new Promise<void>(async (resolve) => {
+ setUpdating(true);
+ const res = await fetch(`${baseApiPath}?${queryString}`, {
+ method: "PUT",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ publicStats: !publicStats,
+ }),
+ });
+ if (res.status === 200) {
+ await mutate(`${baseApiPath}?${queryString}`);
+ !publicStats &&
+ navigator.clipboard.writeText(
+ `https://${domain}/stats/${encodeURIComponent(key)}`,
+ );
+ }
+ setUpdating(false);
+ resolve();
+ }),
+ {
+ loading: "Updating...",
+ success: `Stats page is now ${
+ publicStats ? "private." : "public. Link copied to clipboard."
+ }`,
+ error: "Something went wrong",
+ },
+ );
+ };
+ const [copied, setCopied] = useState(false);
-// return (
-// <Popover
-// content={
-// <div className="w-full divide-y divide-gray-200 text-sm md:w-60">
-// <div className="p-4">
-// <p className="text-gray-500">Share stats for</p>
-// <p className="truncate font-semibold text-gray-800">
-// {linkConstructor({ key, domain, pretty: true })}
-// </p>
-// </div>
-// <div className="p-4">
-// <div className="mb-2 flex items-center justify-between">
-// <p className="font-semibold text-gray-800">Public Stats Page</p>
-// <Switch
-// checked={publicStats}
-// fn={handleChange}
-// disabled={updating}
-// />
-// </div>
-// <p className="text-gray-500">
-// Making stats public will allow anyone with the link to see the
-// stats for this short link.
-// </p>
-// </div>
-// <div className="p-4">
-// <p className="font-semibold text-gray-800">Share Link</p>
-// <div className="divide-x-200 mt-2 flex items-center justify-between divide-x overflow-hidden rounded-md border border-gray-200 bg-gray-100">
-// <div className="scrollbar-hide overflow-scroll pl-2">
-// <p className="whitespace-nowrap text-gray-600">
-// https://{domain}/stats/{encodeURIComponent(key)}
-// </p>
-// </div>
-// <button
-// className="h-8 flex-none border-l bg-white px-2 hover:bg-gray-50 active:bg-gray-100"
-// onClick={() => {
-// navigator.clipboard.writeText(
-// `https://${domain}/stats/${encodeURIComponent(key)}`,
-// );
-// setCopied(true);
-// toast.success("Copied to clipboard");
-// setTimeout(() => setCopied(false), 3000);
-// }}
-// >
-// {copied ? (
-// <Tick className="h-4 w-4 text-gray-500" />
-// ) : (
-// <Copy className="h-4 w-4 text-gray-500" />
-// )}
-// </button>
-// </div>
-// </div>
-// </div>
-// }
-// align="end"
-// openPopover={openSharePopover}
-// setOpenPopover={setopenSharePopoverPopover}
-// >
-// <button
-// onClick={() => setopenSharePopoverPopover(!openSharePopover)}
-// className="mr-2 flex w-24 items-center justify-center space-x-2 rounded-md bg-white px-3 py-2.5 shadow transition-all duration-75 hover:shadow-md active:scale-95"
-// >
-// <IconMenu text="Share" icon={<Share2 className="h-4 w-4" />} />
-// </button>
-// </Popover>
-// );
-// };
+ return (
+ <Popover
+ content={
+ <div className="w-full divide-y divide-gray-200 text-sm md:w-60">
+ <div className="p-4">
+ <p className="text-gray-500">Share stats for</p>
+ <p className="truncate font-semibold text-gray-800">
+ {linkConstructor({ key, domain, pretty: true })}
+ </p>
+ </div>
+ <div className="p-4">
+ <div className="mb-2 flex items-center justify-between">
+ <p className="font-semibold text-gray-800">Public Stats Page</p>
+ <Switch
+ checked={publicStats}
+ fn={handleChange}
+ disabled={updating}
+ />
+ </div>
+ <p className="text-gray-500">
+ Making stats public will allow anyone with the link to see the
+ stats for this short link.
+ </p>
+ </div>
+ <div className="p-4">
+ <p className="font-semibold text-gray-800">Share Link</p>
+ <div className="divide-x-200 mt-2 flex items-center justify-between divide-x overflow-hidden rounded-md border border-gray-200 bg-gray-100">
+ <div className="scrollbar-hide overflow-scroll pl-2">
+ <p className="whitespace-nowrap text-gray-600">
+ https://{domain}/stats/{encodeURIComponent(key)}
+ </p>
+ </div>
+ <button
+ className="h-8 flex-none border-l bg-white px-2 hover:bg-gray-50 active:bg-gray-100"
+ onClick={() => {
+ navigator.clipboard.writeText(
+ `https://${domain}/stats/${encodeURIComponent(key)}`,
+ );
+ setCopied(true);
+ toast.success("Copied to clipboard");
+ setTimeout(() => setCopied(false), 3000);
+ }}
+ >
+ {copied ? (
+ <Tick className="h-4 w-4 text-gray-500" />
+ ) : (
+ <Copy className="h-4 w-4 text-gray-500" />
+ )}
+ </button>
+ </div>
+ </div>
+ </div>
+ }
+ align="end"
+ openPopover={openSharePopover}
+ setOpenPopover={setopenSharePopoverPopover}
+ >
+ <button
+ onClick={() => setopenSharePopoverPopover(!openSharePopover)}
+ className="mr-2 flex w-24 items-center justify-center space-x-2 rounded-md bg-white px-3 py-2.5 shadow transition-all duration-75 hover:shadow-md active:scale-95"
+ >
+ <IconMenu text="Share" icon={<Share2 className="h-4 w-4" />} />
+ </button>
+ </Popover>
+ );
+};