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.

prettier

Steven Tey38fff28473e0
diff --git a/apps/web/app/api/events/export/route.ts b/apps/web/app/api/events/export/route.ts
index 9dd313ddfc..e2dea2c0ef 100644
--- a/apps/web/app/api/events/export/route.ts
+++ b/apps/web/app/api/events/export/route.ts
@@ -30,7 +30,7 @@ const columnAccessors = {
event: (r: LeadEvent | SaleEvent) => r.eventName,
link: (r: Row) => r.domain + (r.key === "_root" ? "" : `/${r.key}`),
country: (r: Row) =>
- r.country ? (COUNTRIES[r.country] ?? r.country) : r.country,
+ r.country ? COUNTRIES[r.country] ?? r.country : r.country,
customer: (r: LeadEvent | SaleEvent) =>
r.customer.name + (r.customer.email ? ` <${r.customer.email}>` : ""),
invoiceId: (r: SaleEvent) => r.sale.invoiceId,
diff --git a/apps/web/ui/analytics/analytics-provider.tsx b/apps/web/ui/analytics/analytics-provider.tsx
index 6139e1d9ad..3252ad8849 100644
--- a/apps/web/ui/analytics/analytics-provider.tsx
+++ b/apps/web/ui/analytics/analytics-provider.tsx
@@ -105,7 +105,7 @@ export default function AnalyticsProvider({
// Only set interval if start and end are not provided
const interval =
- start || end ? undefined : (searchParams?.get("interval") ?? "24h");
+ start || end ? undefined : searchParams?.get("interval") ?? "24h";
const selectedTab: EventType = useMemo(() => {
if (!!adminPage && !!demoPage && !conversionEnabled) return "clicks";
diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsx
index 0320cecaa1..092c5b2de1 100644
--- a/apps/web/ui/analytics/events/events-table.tsx
+++ b/apps/web/ui/analytics/events/events-table.tsx
@@ -520,7 +520,7 @@ export default function EventsTable() {
columns,
pagination,
onPaginationChange: setPagination,
- rowCount: needsHigherPlan ? 0 : (totalEvents?.[tab] ?? 0),
+ rowCount: needsHigherPlan ? 0 : totalEvents?.[tab] ?? 0,
columnVisibility: columnVisibility[tab],
onColumnVisibilityChange: (args) => setColumnVisibility(tab, args),
sortableColumns: ["timestamp"],
diff --git a/apps/web/ui/analytics/events/events-tabs.tsx b/apps/web/ui/analytics/events/events-tabs.tsx
index 510d0c88c4..2d8f24ad8e 100644
--- a/apps/web/ui/analytics/events/events-tabs.tsx
+++ b/apps/web/ui/analytics/events/events-tabs.tsx
@@ -110,7 +110,7 @@ export default function EventsTabs() {
>
{event === "sales"
? (totalEvents?.saleAmount ?? 0) / 100
- : (totalEvents?.[event] ?? 0)}
+ : totalEvents?.[event] ?? 0}
</CountingNumbers>
) : (
<div className="h-8 w-12 animate-pulse rounded-md bg-gray-200" />
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
index 45c29e98f4..d4d1700f19 100644
--- a/apps/web/ui/analytics/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -643,7 +643,7 @@ export default function Toggle({
}
: undefined
}
- presetId={!start || !end ? (interval ?? "24h") : undefined}
+ presetId={!start || !end ? interval ?? "24h" : undefined}
onChange={(range, preset) => {
if (preset) {
queryParams({
diff --git a/apps/web/ui/charts/x-axis.tsx b/apps/web/ui/charts/x-axis.tsx
index de1ee97dd3..71df0e333f 100644
--- a/apps/web/ui/charts/x-axis.tsx
+++ b/apps/web/ui/charts/x-axis.tsx
@@ -34,7 +34,7 @@ export default function XAxis({
const { tooltipData } = useChartTooltipContext();
const tickValues = useMemo(() => {
- const maxTicks = (maxTicksProp ?? width < 450) ? 4 : width < 600 ? 6 : 8;
+ const maxTicks = maxTicksProp ?? width < 450 ? 4 : width < 600 ? 6 : 8;
const tickInterval =
getFactors(data.length).find((f) => (data.length + 1) / f <= maxTicks) ??
diff --git a/apps/web/ui/charts/y-axis.tsx b/apps/web/ui/charts/y-axis.tsx
index dbf2af0200..0a24b3a720 100644
--- a/apps/web/ui/charts/y-axis.tsx
+++ b/apps/web/ui/charts/y-axis.tsx
@@ -58,7 +58,7 @@ export default function YAxis({
const tickValues = useMemo(() => {
if (tickValuesProp) return tickValuesProp;
- const numTicks = (numTicksProp ?? height < 350) ? 3 : 4;
+ const numTicks = numTicksProp ?? height < 350 ? 3 : 4;
return yScale.ticks(numTicks).filter((value) =>
// Both of these reduce the number of ticks farther below numTicks, but this should only affect small ranges
diff --git a/apps/web/ui/domains/domain-configuration.tsx b/apps/web/ui/domains/domain-configuration.tsx
index 3f894f759c..89f507641f 100644
--- a/apps/web/ui/domains/domain-configuration.tsx
+++ b/apps/web/ui/domains/domain-configuration.tsx
@@ -69,7 +69,7 @@ export default function DomainConfiguration({
records={[
{
type: recordType,
- name: recordType === "A" ? "@" : (subdomain ?? "www"),
+ name: recordType === "A" ? "@" : subdomain ?? "www",
value: recordType === "A" ? `76.76.21.21` : `cname.dub.co`,
ttl: "86400",
},
@@ -112,7 +112,7 @@ export default function DomainConfiguration({
records={[
{
type: recordType,
- name: recordType === "A" ? "@" : (subdomain ?? "www"),
+ name: recordType === "A" ? "@" : subdomain ?? "www",
value: recordType === "A" ? `76.76.21.21` : `cname.dub.co`,
ttl: "86400",
},
diff --git a/apps/web/ui/layout/user-survey/survey-form.tsx b/apps/web/ui/layout/user-survey/survey-form.tsx
index cc9c53569b..1e42e4b87b 100644
--- a/apps/web/ui/layout/user-survey/survey-form.tsx
+++ b/apps/web/ui/layout/user-survey/survey-form.tsx
@@ -72,7 +72,7 @@ export default function SurveyForm({
onSubmit={(e) => {
e.preventDefault();
if (source)
- onSubmit(source === "other" ? (otherSource ?? source) : source);
+ onSubmit(source === "other" ? otherSource ?? source : source);
}}
>
<RadioGroup
diff --git a/apps/web/ui/modals/export-links-modal.tsx b/apps/web/ui/modals/export-links-modal.tsx
index 343ee35d42..af90573a3f 100644
--- a/apps/web/ui/modals/export-links-modal.tsx
+++ b/apps/web/ui/modals/export-links-modal.tsx
@@ -163,7 +163,7 @@ function ExportLinksModal({
}
presetId={
!field.value.from || !field.value.to
- ? (field.value.interval ?? "all")
+ ? field.value.interval ?? "all"
: undefined
}
onChange={(dateRange, preset) => {
diff --git a/apps/web/ui/modals/link-builder/draft-controls.tsx b/apps/web/ui/modals/link-builder/draft-controls.tsx
index c91a06f3ac..d5f5f07c36 100644
--- a/apps/web/ui/modals/link-builder/draft-controls.tsx
+++ b/apps/web/ui/modals/link-builder/draft-controls.tsx
@@ -81,21 +81,25 @@ export const DraftControls = forwardRef<
return () => unsubscribe();
}, [watch, isDirty]);
- useImperativeHandle(ref, () => {
- return {
- onSubmitSuccessful() {
- // Remove the current draft when it's submitted
- removeDraft(sessionId);
- },
- onClose() {
- // Save draft instantly when the link builder is closed
- const [url, key] = getValues(["url", "key"]);
- if ((url || key) && isDirty) {
- saveDraft(sessionId, getValues());
- }
- },
- };
- }, [sessionId, isDirty]);
+ useImperativeHandle(
+ ref,
+ () => {
+ return {
+ onSubmitSuccessful() {
+ // Remove the current draft when it's submitted
+ removeDraft(sessionId);
+ },
+ onClose() {
+ // Save draft instantly when the link builder is closed
+ const [url, key] = getValues(["url", "key"]);
+ if ((url || key) && isDirty) {
+ saveDraft(sessionId, getValues());
+ }
+ },
+ };
+ },
+ [sessionId, isDirty],
+ );
return (isDirty && hasSaved) || drafts.length > 0 ? (
<Popover
diff --git a/apps/web/ui/modals/welcome-modal.tsx b/apps/web/ui/modals/welcome-modal.tsx
index a837496deb..42804b7f30 100644
--- a/apps/web/ui/modals/welcome-modal.tsx
+++ b/apps/web/ui/modals/welcome-modal.tsx
@@ -51,9 +51,9 @@ function WelcomeModal({
}, [searchParams, planId]);
const plan = planId
- ? (PLANS.find(
+ ? PLANS.find(
(p) => p.name.toLowerCase() === planId.replace("+", " ").toLowerCase(),
- ) ?? PRO_PLAN)
+ ) ?? PRO_PLAN
: undefined;
return (
diff --git a/packages/ui/src/animated-size-container.tsx b/packages/ui/src/animated-size-container.tsx
index 8a29faffb8..61bfdca1ad 100644
--- a/packages/ui/src/animated-size-container.tsx
+++ b/packages/ui/src/animated-size-container.tsx
@@ -41,10 +41,10 @@ const AnimatedSizeContainer = forwardRef<
className={cn("overflow-hidden", className)}
animate={{
width: width
- ? (resizeObserverEntry?.contentRect?.width ?? "auto")
+ ? resizeObserverEntry?.contentRect?.width ?? "auto"
: "auto",
height: height
- ? (resizeObserverEntry?.contentRect?.height ?? "auto")
+ ? resizeObserverEntry?.contentRect?.height ?? "auto"
: "auto",
}}
transition={transition ?? { type: "spring", duration: 0.3 }}
diff --git a/packages/ui/src/filter/filter-select.tsx b/packages/ui/src/filter/filter-select.tsx
index 65a324743a..30055f6c71 100644
--- a/packages/ui/src/filter/filter-select.tsx
+++ b/packages/ui/src/filter/filter-select.tsx
@@ -203,7 +203,7 @@ export function FilterSelect({
</Fragment>
))
: // Filter options
- (selectedFilter.options?.map((option) => {
+ selectedFilter.options?.map((option) => {
const isSelected = isOptionSelected(option.value);
return (
@@ -231,15 +231,15 @@ export function FilterSelect({
<LoadingSpinner />
</div>
</Command.Loading>
- ))}
+ )}
{/* Only render CommandEmpty if not loading */}
{(!selectedFilter || selectedFilter.options) && (
<CommandEmpty search={search} askAI={askAI}>
{emptyState
? isEmptyStateObject(emptyState)
- ? (emptyState?.[selectedFilterKey ?? "default"] ??
- "No matches")
+ ? emptyState?.[selectedFilterKey ?? "default"] ??
+ "No matches"
: emptyState
: "No matches"}
</CommandEmpty>
@@ -350,14 +350,14 @@ function FilterButton({
const { isMobile } = useMediaQuery();
const Icon = option
- ? (option.icon ??
+ ? option.icon ??
filter.getOptionIcon?.(option.value, { key: filter.key, option }) ??
- filter.icon)
+ filter.icon
: filter.icon;
const label = option
- ? (option.label ??
- filter.getOptionLabel?.(option.value, { key: filter.key, option }))
+ ? option.label ??
+ filter.getOptionLabel?.(option.value, { key: filter.key, option })
: filter.label;
return (
diff --git a/packages/ui/src/status-badge.tsx b/packages/ui/src/status-badge.tsx
index e88ab53ee4..d0027e7dda 100644
--- a/packages/ui/src/status-badge.tsx
+++ b/packages/ui/src/status-badge.tsx
@@ -47,7 +47,7 @@ function StatusBadge({
...props
}: BadgeProps) {
const Icon =
- icon !== null ? (icon ?? defaultIcons[variant ?? "neutral"]) : null;
+ icon !== null ? icon ?? defaultIcons[variant ?? "neutral"] : null;
return (
<span
className={cn(