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.

chore: quality-of-life changes

flooorianflo8da702517835
diff --git a/apps/web/ui/analytics/export-button.tsx b/apps/web/ui/analytics/export-button.tsx
index 8e921bdb55..5b8003fbe8 100644
--- a/apps/web/ui/analytics/export-button.tsx
+++ b/apps/web/ui/analytics/export-button.tsx
@@ -1,4 +1,4 @@
-import { IconMenu, LoadingSpinner, Tooltip, TooltipContent } from "@dub/ui";
+import { LoadingSpinner, Tooltip, TooltipContent } from "@dub/ui";
import zip from "jszip";
import { Download } from "lucide-react";
import { useContext, useState } from "react";
@@ -65,21 +65,21 @@ export default function ExportButton() {
return totalClicks === 0 || !totalClicks ? (
<Tooltip content={<TooltipContent title="No data available" />}>
<button
- disabled={loading || totalClicks === 0 || !totalClicks}
- className="flex w-full items-center justify-between space-x-2 rounded-md p-2 hover:bg-gray-100 active:bg-gray-200 disabled:cursor-not-allowed disabled:text-gray-400 disabled:hover:bg-white disabled:active:bg-white"
+ disabled={true}
+ className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-md bg-white shadow transition-all hover:shadow-md disabled:cursor-not-allowed disabled:text-gray-400 disabled:hover:bg-white disabled:active:bg-white"
onClick={async () => {
setLoading(true);
await exportData();
setLoading(false);
}}
>
- <IconMenu text="Export" icon={<Download className="h-4 w-4" />} />
+ <Download className="h-4 w-4" />
</button>
</Tooltip>
) : (
<button
disabled={loading}
- className="flex w-full items-center justify-between space-x-2 rounded-md p-2 hover:bg-gray-100 active:bg-gray-200 disabled:cursor-progress disabled:text-gray-400 disabled:hover:bg-white disabled:active:bg-white"
+ className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-md bg-white shadow transition-all hover:shadow-md disabled:cursor-progress disabled:text-gray-400 disabled:hover:bg-white disabled:active:bg-white"
onClick={async () => {
setLoading(true);
await exportData();
@@ -87,9 +87,9 @@ export default function ExportButton() {
}}
>
{loading ? (
- <IconMenu text="Export" icon={<LoadingSpinner className="h-4 w-4" />} />
+ <LoadingSpinner className="h-4 w-4" />
) : (
- <IconMenu text="Export" icon={<Download className="h-4 w-4" />} />
+ <Download className="h-4 w-4" />
)}
</button>
);
diff --git a/apps/web/ui/analytics/tag-selector.tsx b/apps/web/ui/analytics/tag-selector.tsx
index 3cd5a2c6ef..7dc0d843cb 100644
--- a/apps/web/ui/analytics/tag-selector.tsx
+++ b/apps/web/ui/analytics/tag-selector.tsx
@@ -20,9 +20,9 @@ export default function TagSelector() {
return tags && tags.length > 0 ? (
<Popover
content={
- <Command>
+ <Command className="w-full md:w-48">
<div className="grid w-full p-2 md:w-48">
- {tags.length > 10 && (
+ {tags.length > 4 && (
<div className="relative mb-2">
<div className="pointer-events-none absolute inset-y-0 left-3 flex items-center">
<Search className="h-4 w-4 text-gray-400" />
@@ -82,7 +82,7 @@ export default function TagSelector() {
>
<button
onClick={(o) => setOpenPopover(!o)}
- className="flex w-full items-center justify-between space-x-2 rounded-md bg-white px-3 py-2.5 shadow transition-all hover:shadow-md md:w-48"
+ className="flex w-full items-center justify-between space-x-2 truncate rounded-md bg-white px-3 py-2.5 shadow transition-all hover:shadow-md md:w-48"
>
<IconMenu
text={tags.find(({ id }) => id === selectedTagId)?.name || "All tags"}
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
index b948f2777f..0b5a3ae07c 100644
--- a/apps/web/ui/analytics/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -39,7 +39,6 @@ export default function Toggle() {
const { basePath, domain, key, url, interval } = useContext(AnalyticsContext);
const [openDatePopover, setOpenDatePopover] = useState(false);
- const [openMorePopover, setOpenMorePopover] = useState(false);
const selectedInterval = useMemo(() => {
return INTERVALS.find((s) => s.value === interval) || INTERVALS[1];
@@ -167,11 +166,11 @@ export default function Toggle() {
>
<button
onClick={() => setOpenDatePopover(!openDatePopover)}
- className="flex w-full items-center justify-between space-x-2 rounded-md bg-white px-3 py-2.5 shadow transition-all hover:shadow-md md:w-48"
+ className="flex w-full items-center justify-between space-x-2 truncate rounded-md bg-white px-3 py-2.5 shadow transition-all hover:shadow-md md:w-48"
>
<IconMenu
text={selectedInterval.display}
- icon={<Calendar className="h-4 w-4" />}
+ icon={<Calendar className="h-4 w-4 flex-shrink-0" />}
/>
<ChevronDown
className={`h-5 w-5 text-gray-400 ${
@@ -181,25 +180,7 @@ export default function Toggle() {
</button>
</Popover>
- {!isPublicStatsPage && (
- <Popover
- align="end"
- content={
- <div className="grid w-full p-2 md:w-48">
- <ExportButton />
- </div>
- }
- openPopover={openMorePopover}
- setOpenPopover={setOpenMorePopover}
- >
- <button
- onClick={() => setOpenMorePopover(!openMorePopover)}
- className="flex h-10 w-10 items-center justify-center rounded-md bg-white shadow transition-all hover:shadow-md"
- >
- ...
- </button>
- </Popover>
- )}
+ {!isPublicStatsPage && <ExportButton />}
</div>
</div>
</div>