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.

hideMultipleIcons

Steven Tey37cf3650546a
diff --git a/apps/web/ui/analytics/location-section.tsx b/apps/web/ui/analytics/location-section.tsx
index a12319c7da..8601fe7a13 100644
--- a/apps/web/ui/analytics/location-section.tsx
+++ b/apps/web/ui/analytics/location-section.tsx
@@ -53,7 +53,7 @@ export function LocationSection() {
tab === "continents" ? (
<ContinentIcon
display={d.continent}
- className="size-3"
+ className="size-4 rounded-full border border-cyan-500"
/>
) : (
<img
diff --git a/apps/web/ui/analytics/use-analytics-filters.tsx b/apps/web/ui/analytics/use-analytics-filters.tsx
index cf395ce590..c27358c6ae 100644
--- a/apps/web/ui/analytics/use-analytics-filters.tsx
+++ b/apps/web/ui/analytics/use-analytics-filters.tsx
@@ -358,7 +358,6 @@ export function useAnalyticsFilters({
key: "linkId",
icon: Hyperlink,
label: "Link",
- multiple: true,
getOptionIcon: (_value, props) => {
const data = props.option?.data;
const url = data?.url;
@@ -521,7 +520,6 @@ export function useAnalyticsFilters({
key: "tagIds",
icon: Tag,
label: "Tag",
- multiple: true,
getOptionIcon: (_value, props) => {
const tagColor = props.option?.data?.color;
return tagColor ? (
@@ -624,7 +622,12 @@ export function useAnalyticsFilters({
label: "Continent",
getOptionIcon: (value) => {
if (typeof value !== "string") return null;
- return <ContinentIcon display={value} className="size-2.5" />;
+ return (
+ <ContinentIcon
+ display={value}
+ className="size-4 rounded-full border border-cyan-500"
+ />
+ );
},
getOptionLabel: (value) => {
if (typeof value !== "string") return String(value);
@@ -641,6 +644,7 @@ export function useAnalyticsFilters({
key: "device",
icon: MobilePhone,
label: "Device",
+ hideMultipleIcons: true,
getOptionIcon: (value) => {
if (typeof value !== "string") return null;
return (
@@ -679,6 +683,7 @@ export function useAnalyticsFilters({
key: "os",
icon: Cube,
label: "OS",
+ hideMultipleIcons: true,
getOptionIcon: (value) => {
if (typeof value !== "string") return null;
return <DeviceIcon display={value} tab="os" className="h-4 w-4" />;
@@ -697,6 +702,7 @@ export function useAnalyticsFilters({
key: "trigger",
icon: CursorRays,
label: "Trigger",
+ hideMultipleIcons: true,
options:
triggers?.map(({ trigger, ...rest }) => {
const { title, icon } = TRIGGER_DISPLAY[trigger];
diff --git a/packages/ui/src/filter/filter-list.tsx b/packages/ui/src/filter/filter-list.tsx
index 5b6cc333ec..2ac66cb778 100644
--- a/packages/ui/src/filter/filter-list.tsx
+++ b/packages/ui/src/filter/filter-list.tsx
@@ -142,8 +142,6 @@ export function FilterList({
})()
: `${values.length} ${pluralize(filter.label, values.length)}`;
- const showMultipleIcons = ["country", "city"].includes(key);
-
const OptionDisplay = ({ className }: { className?: string }) => {
let iconDisplay;
@@ -172,7 +170,7 @@ export function FilterList({
)}
</span>
);
- } else if (showMultipleIcons) {
+ } else if (!filter.hideMultipleIcons) {
iconDisplay = (
<div className="flex shrink-0 -space-x-1">
{displayValues.map((value, idx) => {
@@ -226,7 +224,7 @@ export function FilterList({
className,
)}
>
- {values.length > 3 && showMultipleIcons ? (
+ {values.length > 3 && !filter.hideMultipleIcons ? (
<Tooltip content={`Max of 3 icons shown`}>
{iconDisplay}
</Tooltip>
@@ -245,8 +243,6 @@ export function FilterList({
filter={filter}
values={values}
operator={operator}
- displayLabel={displayLabel}
- displayValues={displayValues}
OptionDisplay={OptionDisplay}
onRemove={onRemove}
onRemoveFilter={onRemoveFilter}
@@ -376,8 +372,6 @@ function OperatorFilterPill({
filter,
values,
operator,
- displayLabel,
- displayValues,
OptionDisplay,
onRemove,
onRemoveFilter,
@@ -389,8 +383,6 @@ function OperatorFilterPill({
filter: Filter;
values: FilterOption["value"][];
operator: FilterOperator;
- displayLabel: string;
- displayValues: FilterOption["value"][];
OptionDisplay: ({ className }: { className?: string }) => ReactNode;
onRemove: (key: string, value: FilterOption["value"]) => void;
onRemoveFilter?: (key: string) => void;
diff --git a/packages/ui/src/filter/types.ts b/packages/ui/src/filter/types.ts
index 70b3954bb4..a29a059fd3 100644
--- a/packages/ui/src/filter/types.ts
+++ b/packages/ui/src/filter/types.ts
@@ -17,7 +17,8 @@ export type Filter = {
hideInFilterDropdown?: boolean;
shouldFilter?: boolean;
separatorAfter?: boolean;
- multiple?: boolean;
+ multiple?: boolean; // Allow multiple selection of values
+ hideMultipleIcons?: boolean; // Hide multiple "stacked icons" view for the filter (fallback to icon display)
singleSelect?: boolean; // Force single-select behavior even if multiSelect is enabled globally
hideOperator?: boolean; // Hide the operator dropdown (is/is not) even when multiple is enabled
getOptionIcon?: (