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.

small fixes

Steven Tey3b5c438b78a6
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx
index 1841d8aa5f..ae016bab84 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/client.tsx
@@ -13,7 +13,7 @@ export default function AnalyticsClient({ children }: { children: ReactNode }) {
if (exceededClicks) {
return <ProjectExceededClicks />;
}
- const { allActiveDomains, loading: loadingDomains } = useDomains();
+ const { allDomains, loading: loadingDomains } = useDomains();
const searchParams = useSearchParams();
const domain = searchParams?.get("domain");
@@ -21,8 +21,8 @@ export default function AnalyticsClient({ children }: { children: ReactNode }) {
return <LayoutLoader />;
}
if (
- allActiveDomains?.length === 0 ||
- (domain && !allActiveDomains?.find((d) => d.slug === domain))
+ allDomains?.length === 0 ||
+ (domain && !allDomains?.find((d) => d.slug === domain))
) {
return <LinkNotFound />;
}
diff --git a/apps/web/lib/swr/use-domains.ts b/apps/web/lib/swr/use-domains.ts
index 658c3f92ef..3abedd6ea3 100644
--- a/apps/web/lib/swr/use-domains.ts
+++ b/apps/web/lib/swr/use-domains.ts
@@ -27,7 +27,14 @@ export default function useDomains({ domain }: { domain?: string } = {}) {
DUB_DOMAINS.filter((d) => projectDefaultDomains?.includes(d.slug))) ||
DUB_DOMAINS;
- const allActiveDomains = [...(projectDomains || []), ...defaultDomains];
+ const allDomains = [
+ ...(data || []),
+ ...(slug !== "dub" ? defaultDomains : []),
+ ];
+ const allActiveDomains = [
+ ...(projectDomains || []),
+ ...(slug !== "dub" ? defaultDomains : []),
+ ];
const primaryDomain =
projectDomains?.find((domain) => domain.primary)?.slug ||
@@ -46,6 +53,7 @@ export default function useDomains({ domain }: { domain?: string } = {}) {
projectDomains,
archivedProjectDomains,
defaultDomains,
+ allDomains,
allActiveDomains,
primaryDomain,
verified,
diff --git a/apps/web/ui/layout/nav-tabs.tsx b/apps/web/ui/layout/nav-tabs.tsx
index 8cdd15c29c..678dbab106 100644
--- a/apps/web/ui/layout/nav-tabs.tsx
+++ b/apps/web/ui/layout/nav-tabs.tsx
@@ -8,12 +8,13 @@ import { ModalContext } from "@/ui/modals/provider";
import { Badge } from "@dub/ui";
import { motion } from "framer-motion";
import Link from "next/link";
-import { useParams, usePathname } from "next/navigation";
+import { useParams, usePathname, useSearchParams } from "next/navigation";
import { useContext, useMemo } from "react";
export default function NavTabs() {
const pathname = usePathname();
const { slug } = useParams() as { slug?: string };
+ const domain = useSearchParams()?.get("domain");
const { loading, error } = useProject();
const tabs = [
@@ -53,6 +54,7 @@ export default function NavTabs() {
!loading &&
!error &&
!loadingDomains &&
+ !domain &&
(!verified || count === 0) && <OnboardingChecklist />}
</div>
);
diff --git a/apps/web/ui/stats/toggle.tsx b/apps/web/ui/stats/toggle.tsx
index 2bdedd57cc..1f75a5c154 100644
--- a/apps/web/ui/stats/toggle.tsx
+++ b/apps/web/ui/stats/toggle.tsx
@@ -16,10 +16,12 @@ import {
APP_DOMAIN,
DUB_LOGO,
GOOGLE_FAVICON_URL,
+ SHORT_DOMAIN,
cn,
fetcher,
getApexDomain,
linkConstructor,
+ truncate,
} from "@dub/utils";
import { Calendar, ChevronDown, Globe, Lock, Share2, X } from "lucide-react";
import Link from "next/link";
@@ -46,7 +48,7 @@ export default function Toggle() {
const scrolled = useScroll(80);
const { name, plan, logo } = useProject();
- const { allActiveDomains, primaryDomain } = useDomains();
+ const { allDomains, primaryDomain } = useDomains();
const isPublicStatsPage = basePath.startsWith("/stats");
@@ -70,13 +72,13 @@ export default function Toggle() {
<h2 className="text-lg font-semibold text-gray-800">
{primaryDomain}
</h2>
- {allActiveDomains && allActiveDomains.length > 1 && (
+ {allDomains && allDomains.length > 1 && (
<Tooltip
- content={<DomainsFilterTooltip domains={allActiveDomains} />}
+ content={<DomainsFilterTooltip domains={allDomains} />}
side="bottom"
>
<div className="cursor-pointer">
- <Badge variant="gray">+{allActiveDomains.length - 1}</Badge>
+ <Badge variant="gray">+{allDomains.length - 1}</Badge>
</div>
</Tooltip>
)}
@@ -189,21 +191,21 @@ const DomainsFilterTooltip = ({ domains }: { domains: DomainProps[] }) => {
del: "key",
});
}}
- className="group flex items-center justify-between rounded-md p-2 text-gray-500 transition-all hover:bg-gray-100 active:bg-gray-200"
+ className="group flex items-center justify-between space-x-2 rounded-md p-2 text-gray-500 transition-all hover:bg-gray-100 active:bg-gray-200"
>
<div className="flex items-center space-x-2">
- {target ? (
- <BlurImage
- src={`${GOOGLE_FAVICON_URL}${getApexDomain(target)}`}
- alt={slug}
- className="h-5 w-5 rounded-full"
- width={20}
- height={20}
- />
- ) : (
- <Globe className="h-5 w-5" />
- )}
- <p className="text-sm font-semibold text-gray-500">{slug}</p>
+ <BlurImage
+ src={`${GOOGLE_FAVICON_URL}${
+ target ? getApexDomain(target) : SHORT_DOMAIN
+ }`}
+ alt={slug}
+ className="h-5 w-5 rounded-full"
+ width={20}
+ height={20}
+ />
+ <p className="w-32 truncate text-left text-sm font-semibold text-gray-500">
+ {slug}
+ </p>
</div>
{domain === slug && !key && <Tick className="h-4 w-4" />}
</button>