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.

fixed layouts, added suppressHydrationWarning

Steven Tey288e51b7edf8
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
index 8ee84e9dff..f8e08c2c3b 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
@@ -9,19 +9,19 @@ export default function ProjectSettingsLayout({
const tabs = [
{
name: "General",
- segment: "",
+ segment: null,
},
{
name: "Billing",
- segment: "/billing",
+ segment: "billing",
},
{
name: "People",
- segment: "/people",
+ segment: "people",
},
{
name: "Security",
- segment: "/security",
+ segment: "security",
},
];
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/people/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/people/page-client.tsx
index 13f163b8d9..8f9182448a 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/people/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/people/page-client.tsx
@@ -168,7 +168,7 @@ const UserCard = ({
</select>
)
) : (
- <p className="text-xs text-gray-500">
+ <p className="text-xs text-gray-500" suppressHydrationWarning>
Invited {timeAgo(createdAt)}
</p>
)}
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/settings/layout.tsx
index d6de08f9c1..61141d89c0 100644
--- a/apps/web/app/app.dub.co/(dashboard)/settings/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/settings/layout.tsx
@@ -9,11 +9,11 @@ export default function PersonalSettingsLayout({
const tabs = [
{
name: "General",
- segment: "",
+ segment: null,
},
// {
// name: "API Keys",
- // segment: "/tokens",
+ // segment: "tokens",
// },
];
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx
index 6ae24c66ac..e7974779c3 100644
--- a/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx
@@ -109,13 +109,16 @@ const TokenRow = (token: Token) => {
<TokenAvatar id={token.id} />
<div className="flex flex-col space-y-px">
<p className="font-semibold text-gray-700">{token.name}</p>
- <p className="text-sm text-gray-500">
+ <p className="text-sm text-gray-500" suppressHydrationWarning>
Created {timeAgo(token.createdAt, { withAgo: true })}
</p>
</div>
</div>
<div className="font-mono text-sm">{token.partialKey}</div>
- <div className="text-center text-sm text-gray-500">
+ <div
+ className="text-center text-sm text-gray-500"
+ suppressHydrationWarning
+ >
{timeAgo(token.lastUsed)}
</div>
<Popover
diff --git a/apps/web/app/ui/layout/nav-tabs.tsx b/apps/web/app/ui/layout/nav-tabs.tsx
index a4b885093e..3e9ebb8f5a 100644
--- a/apps/web/app/ui/layout/nav-tabs.tsx
+++ b/apps/web/app/ui/layout/nav-tabs.tsx
@@ -41,7 +41,8 @@ export default function NavTabs() {
<div className="rounded-md px-3 py-2 transition-all duration-75 hover:bg-gray-100 active:bg-gray-200">
<p className="text-sm text-gray-600 hover:text-black">{name}</p>
</div>
- {pathname === href && (
+ {(pathname === href ||
+ (href.endsWith("/settings") && pathname?.startsWith(href))) && (
<motion.div
layoutId="indicator"
className="absolute bottom-0 h-0.5 w-full bg-black"
diff --git a/apps/web/app/ui/layout/settings-layout.tsx b/apps/web/app/ui/layout/settings-layout.tsx
index 48d2c199b2..5dedefb27c 100644
--- a/apps/web/app/ui/layout/settings-layout.tsx
+++ b/apps/web/app/ui/layout/settings-layout.tsx
@@ -8,7 +8,7 @@ export default function SettingsLayout({
}: {
tabs: {
name: string;
- segment: string;
+ segment: string | null;
}[];
children: ReactNode;
}) {
diff --git a/apps/web/app/ui/layout/settings-nav-link.tsx b/apps/web/app/ui/layout/settings-nav-link.tsx
index ea41c65d83..6142a64895 100644
--- a/apps/web/app/ui/layout/settings-nav-link.tsx
+++ b/apps/web/app/ui/layout/settings-nav-link.tsx
@@ -2,22 +2,24 @@
import { cn } from "@dub/utils";
import Link from "next/link";
-import { useParams, usePathname } from "next/navigation";
+import { useParams, useSelectedLayoutSegment } from "next/navigation";
import { ReactNode } from "react";
export default function NavLink({
segment,
children,
}: {
- segment: string;
+ segment: string | null;
children: ReactNode;
}) {
- const pathname = usePathname();
+ const selectedLayoutSegment = useSelectedLayoutSegment();
const { slug } = useParams() as {
slug?: string;
};
- const href = `${slug ? `/${slug}` : ""}/settings${segment}`;
+ const href = `${slug ? `/${slug}` : ""}/settings${
+ segment ? `/${segment}` : ""
+ }`;
return (
<Link
@@ -26,7 +28,7 @@ export default function NavLink({
className={cn(
"rounded-md p-2.5 text-sm transition-all duration-75 hover:bg-gray-100 active:bg-gray-200",
{
- "font-semibold text-black": pathname === href,
+ "font-semibold text-black": selectedLayoutSegment === segment,
},
)}
>
diff --git a/apps/web/app/ui/links/link-card.tsx b/apps/web/app/ui/links/link-card.tsx
index 95a17e7284..722a9a3f31 100644
--- a/apps/web/app/ui/links/link-card.tsx
+++ b/apps/web/app/ui/links/link-card.tsx
@@ -347,7 +347,10 @@ export default function LinkCard({
</div>
</Tooltip>
<p>•</p>
- <p className="whitespace-nowrap text-sm text-gray-500">
+ <p
+ className="whitespace-nowrap text-sm text-gray-500"
+ suppressHydrationWarning
+ >
{timeAgo(createdAt)}
</p>
<p className="xs:block hidden">•</p>
diff --git a/apps/web/app/ui/modals/delete-token-modal.tsx b/apps/web/app/ui/modals/delete-token-modal.tsx
index 8498ef8913..3968132acc 100644
--- a/apps/web/app/ui/modals/delete-token-modal.tsx
+++ b/apps/web/app/ui/modals/delete-token-modal.tsx
@@ -46,7 +46,7 @@ function DeleteTokenModal({
<h3 className="line-clamp-1 w-48 font-semibold text-gray-700">
{token.name}
</h3>
- <p className="text-xs text-gray-500">
+ <p className="text-xs text-gray-500" suppressHydrationWarning>
Last used {timeAgo(token.lastUsed, { withAgo: true })}
</p>
</div>
diff --git a/apps/web/emails/links-imported.tsx b/apps/web/emails/links-imported.tsx
index 0e0c912b39..74aa7282a9 100644
--- a/apps/web/emails/links-imported.tsx
+++ b/apps/web/emails/links-imported.tsx
@@ -114,7 +114,11 @@ export default function LinksImported({
<Column align="left" className="text-sm font-medium">
{linkConstructor({ domain, key, pretty: true })}
</Column>
- <Column align="right" className="text-sm text-gray-600">
+ <Column
+ align="right"
+ className="text-sm text-gray-600"
+ suppressHydrationWarning
+ >
{timeAgo(createdAt)}
</Column>
</Row>
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 983873c970..b942d75067 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -15,6 +15,7 @@ module.exports = {
useDeploymentId: true,
serverActions: true,
useDeploymentIdServerActions: true,
+ optimizePackageImports: ["lucide-react"],
},
webpack: (config, { webpack, isServer }) => {
if (isServer) {
diff --git a/packages/ui/src/tooltip.tsx b/packages/ui/src/tooltip.tsx
index 3e654e1851..3441627dc6 100644
--- a/packages/ui/src/tooltip.tsx
+++ b/packages/ui/src/tooltip.tsx
@@ -171,7 +171,7 @@ export function NumberTooltip({
{nFormatter(value || 0, { full: true })} {unit}
</p>
{lastClicked && (
- <p className="mt-1 text-xs text-gray-500">
+ <p className="mt-1 text-xs text-gray-500" suppressHydrationWarning>
Last clicked {timeAgo(lastClicked, { withAgo: true })}
</p>
)}