The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update toggle.tsx
Steven Teya8f6dc8bbb66
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsxindex 02ff7aff3c..f6e6938f5a 100644--- a/apps/web/ui/analytics/toggle.tsx+++ b/apps/web/ui/analytics/toggle.tsx@@ -111,63 +111,73 @@ export default function Toggle() {const filters = useMemo(() => [- {- key: "domain",- icon: Globe,- label: "Domain",- options: domains.map((domain) => ({- value: domain.slug,- label: domain.slug,- icon: (- <BlurImage- src={`${GOOGLE_FAVICON_URL}${domain.slug}`}- alt={domain.slug}- className="h-4 w-4 rounded-full"- width={16}- height={16}- />- ),- })),- },- {- key: "link",- icon: Hyperlink,- label: "Link",- options:- links?.map(- ({ domain, key, url, count }: LinkProps & { count?: number }) => ({- value: linkConstructor({ domain, key }),- label: linkConstructor({ domain, key, pretty: true }),- icon: (- <LinkLogo- apexDomain={getApexDomain(url)}- className="h-4 w-4 sm:h-4 sm:w-4"- />- ),- right: nFormatter(count, { full: true }),- }),- ) ?? null,- },- {- key: "tagId",- icon: Tag,- label: "Tag",- options:- tags?.map((tag) => ({- value: tag.id,- icon: (- <div- className={cn(- "rounded-md p-1.5",- COLORS_LIST.find(({ color }) => color === tag.color)?.css,- )}- >- <Tag className="h-2.5 w-2.5" />- </div>- ),- label: tag.name,- })) ?? null,- },+ ...(isPublicStatsPage+ ? []+ : [+ {+ key: "domain",+ icon: Globe,+ label: "Domain",+ options: domains.map((domain) => ({+ value: domain.slug,+ label: domain.slug,+ icon: (+ <BlurImage+ src={`${GOOGLE_FAVICON_URL}${domain.slug}`}+ alt={domain.slug}+ className="h-4 w-4 rounded-full"+ width={16}+ height={16}+ />+ ),+ })),+ },+ {+ key: "link",+ icon: Hyperlink,+ label: "Link",+ options:+ links?.map(+ ({+ domain,+ key,+ url,+ count,+ }: LinkProps & { count?: number }) => ({+ value: linkConstructor({ domain, key }),+ label: linkConstructor({ domain, key, pretty: true }),+ icon: (+ <LinkLogo+ apexDomain={getApexDomain(url)}+ className="h-4 w-4 sm:h-4 sm:w-4"+ />+ ),+ right: nFormatter(count, { full: true }),+ }),+ ) ?? null,+ },+ {+ key: "tagId",+ icon: Tag,+ label: "Tag",+ options:+ tags?.map((tag) => ({+ value: tag.id,+ icon: (+ <div+ className={cn(+ "rounded-md p-1.5",+ COLORS_LIST.find(({ color }) => color === tag.color)+ ?.css,+ )}+ >+ <Tag className="h-2.5 w-2.5" />+ </div>+ ),+ label: tag.name,+ })) ?? null,+ },+ ]),{key: "qr",icon: CursorRays,@@ -338,36 +348,34 @@ export default function Toggle() {})}>{!isPublicStatsPage && key && <SharePopover />}- {!isPublicStatsPage && (- <Filter.Select- className="w-full"- filters={filters}- activeFilters={activeFilters}- onSelect={(key, value) =>- queryParams({- set:- key === "link"- ? {- domain: new URL(value).hostname,- key: new URL(value).pathname.slice(1) || "_root",- }- : {- [key]: value,- },- })- }- onRemove={(key) =>- queryParams({- del: key === "link" ? ["domain", "key"] : key,- })- }- onOpenFilter={(key) =>- setRequestedFilters((rf) =>- rf.includes(key) ? rf : [...rf, key],- )- }- />- )}+ <Filter.Select+ className="w-full"+ filters={filters}+ activeFilters={activeFilters}+ onSelect={(key, value) =>+ queryParams({+ set:+ key === "link"+ ? {+ domain: new URL(value).hostname,+ key: new URL(value).pathname.slice(1) || "_root",+ }+ : {+ [key]: value,+ },+ })+ }+ onRemove={(key) =>+ queryParams({+ del: key === "link" ? ["domain", "key"] : key,+ })+ }+ onOpenFilter={(key) =>+ setRequestedFilters((rf) =>+ rf.includes(key) ? rf : [...rf, key],+ )+ }+ /><divclassName={cn("flex w-full items-center gap-2", {"min-[550px]:w-auto": !key,