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.

Merge branch 'main' into events-empty-states

Steven Tey15ae851f3157
diff --cc apps/web/ui/analytics/top-links.tsx
index d3f70ee243,8a07eb2b28..6c4bdcc2b0
--- a/apps/web/ui/analytics/top-links.tsx
+++ b/apps/web/ui/analytics/top-links.tsx
@@@ -35,35 -34,29 +35,32 @@@ export default function TopLinks()
<BarList
tab={showUrls ? "url" : "link"}
data={
- data?.map((d) => ({
- icon: (
- <LinkLogo
- apexDomain={getApexDomain(d.url)}
- className="h-5 w-5 sm:h-5 sm:w-5"
- />
- ),
- title: !showUrls && d["shortLink"] ? d["shortLink"] : d.url,
- href: queryParams({
- set: {
- ...(!showUrls
- ? { domain: d.domain, key: d.key || "_root" }
- : {
- url: d.url,
- }),
- },
- getNewPath: true,
- }) as string,
- value: d.count || 0,
- ...(!showUrls && { linkData: d }),
- })) || []
+ data
+ ?.map((d) => ({
+ icon: (
+ <LinkLogo
+ apexDomain={getApexDomain(d.url)}
- className="h-5 w-5 sm:h-5 sm:w-5"
++ className="size-5 sm:size-5"
+ />
+ ),
- title:
- !showUrls && d["shortLink"]
- ? d["shortLink"].replace(/^https?:\/\//, "")
- : d.url?.replace(/^https?:\/\//, ""),
++ title: !showUrls && d["shortLink"] ? d["shortLink"] : d.url,
+ href: queryParams({
+ set: {
+ ...(!showUrls
+ ? { domain: d.domain, key: d.key || "_root" }
+ : {
+ url: d.url,
+ }),
+ },
+ getNewPath: true,
+ }) as string,
+ value: d[dataKey] || 0,
+ ...(!showUrls && { linkData: d }),
+ }))
+ ?.sort((a, b) => b.value - a.value) || []
}
- maxValue={(data && data[0]?.count) || 0}
+ unit={selectedTab}
+ maxValue={Math.max(...data?.map((d) => d[dataKey] ?? 0)) ?? 0}
barBackground="bg-orange-100"
hoverBackground="hover:bg-gradient-to-r hover:from-orange-50 hover:to-transparent hover:border-orange-500"
setShowModal={setShowModal}