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.

revert combobox changes

Steven Tey2707edb39c14
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/add-hostname-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/add-hostname-modal.tsx
index 9aea03af44..3b57b27ffc 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/add-hostname-modal.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/add-hostname-modal.tsx
@@ -3,7 +3,7 @@
import { clientAccessCheck } from "@/lib/api/tokens/permissions";
import useWorkspace from "@/lib/swr/use-workspace";
import { X } from "@/ui/shared/icons";
-import { Button, LoadingDots, Modal } from "@dub/ui";
+import { Button, LoadingDots, Modal, useMediaQuery } from "@dub/ui";
import { cn, validDomainRegex } from "@dub/utils";
import { useCallback, useMemo, useState } from "react";
import { toast } from "sonner";
@@ -69,6 +69,8 @@ const AddHostnameForm = ({
setHostname("");
};
+ const { isMobile } = useMediaQuery();
+
return (
<form
className="bg-neutral-50"
@@ -84,6 +86,7 @@ const AddHostnameForm = ({
value={hostname}
onChange={(e) => setHostname(e.target.value)}
autoComplete="off"
+ autoFocus={!isMobile}
placeholder="example.com or *.example.com"
className={cn(
"block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/hostname-section.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/hostname-section.tsx
index 7eee7a5c81..b81ff323cb 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/hostname-section.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/analytics/hostname-section.tsx
@@ -107,7 +107,7 @@ const HostnameCard = ({ hostname }: { hostname: string }) => {
<CardList.Card
key={hostname}
innerClassName={cn(
- "flex items-center justify-between gap-5 sm:gap-8 md:gap-12 text-sm transition-opacity shadow-xs",
+ "flex items-center justify-between gap-5 sm:gap-8 md:gap-12 text-sm transition-opacity",
processing && "opacity-50",
)}
hoverStateEnabled={false}
diff --git a/apps/web/ui/guides/guide-selector.tsx b/apps/web/ui/guides/guide-selector.tsx
index c38a56bcad..318c00ef7a 100644
--- a/apps/web/ui/guides/guide-selector.tsx
+++ b/apps/web/ui/guides/guide-selector.tsx
@@ -1,6 +1,8 @@
-import { Combobox, ComboboxOption } from "@dub/ui";
+import { Popover } from "@dub/ui";
+import { Check2 } from "@dub/ui/icons";
import { cn } from "@dub/utils";
-import { useMemo, useState } from "react";
+import { ChevronDown } from "lucide-react";
+import { useState } from "react";
import { IntegrationGuide } from "./integrations";
interface GuideSelectorProps {
@@ -14,14 +16,12 @@ interface GuideSelectorProps {
const GuideSelectorIcon = ({
icon: Icon,
fullSize,
- className,
-}: { icon: any; className?: string } & IntegrationGuide["iconProps"]) => {
+}: { icon: any } & IntegrationGuide["iconProps"]) => {
const containerClassName =
"size-8 shrink-0 overflow-hidden rounded-lg bg-white";
+
if (fullSize) {
- return (
- <Icon className={cn(containerClassName)} width="auto" height="100%" />
- );
+ return <Icon className={containerClassName} width="auto" height="100%" />;
}
return (
@@ -34,18 +34,6 @@ const GuideSelectorIcon = ({
<Icon className="size-5" />
</div>
);
- // return (
- // <div
- // className={cn(
- // "flex aspect-square grow items-center justify-center self-stretch ",
- // className,
- // )}
- // >
- // <Icon
- // className={cn("h-full w-full object-contain", fullSize ? "" : "p-1")}
- // />
- // </div>
- // );
};
export function GuideSelector({
@@ -57,67 +45,111 @@ export function GuideSelector({
}: GuideSelectorProps) {
const [openPopover, setOpenPopover] = useState(false);
- const guideOptions: ComboboxOption<IntegrationGuide>[] = useMemo(() => {
- return guides?.map((guide) => ({
- value: guide.key,
- label: guide.title,
- icon: (
- <GuideSelectorIcon icon={guide.icon} {...(guide.iconProps || {})} />
- ),
- badge: guide.recommended ? "Recommended" : undefined,
- description: guide.subtitle,
- }));
- }, [guides]);
-
- const selectedOption = useMemo(() => {
- if (!value) return null;
-
- return guideOptions.find((g) => g.value === value.key) || null;
- }, [value, guideOptions]);
-
return (
- <Combobox
- options={guideOptions}
- setSelected={(option) => {
- if (option && option.value) {
- const guide = guides.find((guide) => guide.key === option.value);
-
- if (guide) {
- onChange(guide);
- }
- }
- }}
- selected={selectedOption}
- icon={selectedOption?.icon}
- caret={true}
- placeholder={"Select guide"}
- // searchPlaceholder="Search guides..."
- // onSearchChange={setSearch}
- // shouldFilter={}
- matchTriggerWidth
- open={openPopover}
- onOpenChange={setOpenPopover}
- popoverProps={{
- contentClassName: "min-w-[280px]",
- }}
- labelProps={{
- className: "text-sm font-semibold text-neutral-900",
- }}
- iconProps={
- {
- // className: "h-full",
- }
+ <Popover
+ content={
+ <GuideList
+ selected={value}
+ guides={guides}
+ onChange={onChange}
+ setOpenPopover={setOpenPopover}
+ />
}
- buttonProps={{
- disabled,
- className: cn(
- "w-fit p-1 transition-none rounded-lg bg-transparent hover:bg-neutral-200 border-none h-auto",
- className,
- ),
- }}
- hideSearch
+ side="bottom"
+ align="start"
+ openPopover={openPopover}
+ setOpenPopover={setOpenPopover}
+ popoverContentClassName="min-w-[280px]"
>
- {selectedOption?.label || "Select a guide"}
- </Combobox>
+ <button
+ onClick={() => setOpenPopover(!openPopover)}
+ disabled={disabled}
+ className={cn(
+ "flex items-center gap-x-2 rounded-lg px-2 py-1 text-left text-sm transition-all duration-75",
+ "hover:bg-neutral-200/50 active:bg-neutral-200/80 data-[state=open]:bg-neutral-200/50",
+ "outline-none focus-visible:ring-2 focus-visible:ring-black/50",
+ disabled && "cursor-not-allowed opacity-50",
+ className,
+ )}
+ >
+ {value ? (
+ <>
+ <GuideSelectorIcon icon={value.icon} {...(value.iconProps || {})} />
+ <div className="min-w-0 flex-1">
+ <div className="truncate text-sm font-semibold text-neutral-900">
+ {value.title}
+ </div>
+ {value.subtitle && (
+ <div className="truncate text-xs text-neutral-500">
+ {value.subtitle}
+ </div>
+ )}
+ </div>
+ </>
+ ) : (
+ <div className="text-neutral-500">Select a guide</div>
+ )}
+ <ChevronDown className="size-4 shrink-0 text-neutral-400" />
+ </button>
+ </Popover>
+ );
+}
+
+function GuideList({
+ selected,
+ guides,
+ onChange,
+ setOpenPopover,
+}: {
+ selected: IntegrationGuide | null;
+ guides: IntegrationGuide[];
+ onChange: (guide: IntegrationGuide) => void;
+ setOpenPopover: (open: boolean) => void;
+}) {
+ return (
+ <div className="flex flex-col gap-0.5 p-2">
+ {guides.map((guide) => {
+ const isActive = selected?.key === guide.key;
+ return (
+ <button
+ key={guide.key}
+ className={cn(
+ "relative flex w-full items-center gap-x-2 rounded-md px-2 py-1 text-left transition-all duration-75",
+ "hover:bg-neutral-200/50 active:bg-neutral-200/80",
+ "outline-none focus-visible:ring-2 focus-visible:ring-black/50",
+ isActive && "bg-neutral-200/50",
+ )}
+ onClick={() => {
+ onChange(guide);
+ setOpenPopover(false);
+ }}
+ >
+ <GuideSelectorIcon icon={guide.icon} {...(guide.iconProps || {})} />
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center gap-x-2">
+ <span className="block truncate text-sm font-medium leading-5 text-neutral-900">
+ {guide.title}
+ </span>
+ {guide.recommended && (
+ <span className="inline-flex items-center rounded-full bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700">
+ Recommended
+ </span>
+ )}
+ </div>
+ {guide.subtitle && (
+ <div className="mt-0.5 truncate text-xs text-neutral-500">
+ {guide.subtitle}
+ </div>
+ )}
+ </div>
+ {isActive && (
+ <span className="absolute inset-y-0 right-0 flex items-center pr-3 text-black">
+ <Check2 className="size-4" aria-hidden="true" />
+ </span>
+ )}
+ </button>
+ );
+ })}
+ </div>
);
}
diff --git a/packages/prisma/schema/group.prisma b/packages/prisma/schema/group.prisma
index eb4e4a7793..207c29ec79 100644
--- a/packages/prisma/schema/group.prisma
+++ b/packages/prisma/schema/group.prisma
@@ -16,11 +16,11 @@ model PartnerGroup {
discountId String? @unique
linkStructure PartnerLinkStructure @default(short)
additionalLinks Json? @db.Json
+ maxPartnerLinks Int @default(0)
applicationFormData Json? @db.Json
applicationFormPublishedAt DateTime?
landerData Json? @db.Json
landerPublishedAt DateTime?
- maxPartnerLinks Int @default(0)
utmTemplateId String? @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
diff --git a/packages/tailwind-config/tailwind.config.ts b/packages/tailwind-config/tailwind.config.ts
index c84b6f3fef..c81a9b5a73 100644
--- a/packages/tailwind-config/tailwind.config.ts
+++ b/packages/tailwind-config/tailwind.config.ts
@@ -247,9 +247,6 @@ const config: Config = {
dropShadow: {
"card-hover": ["0 8px 12px #222A350d", "0 32px 80px #2f30370f"],
},
- boxShadow: {
- xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
- },
},
},
plugins: [
diff --git a/packages/ui/src/combobox/index.tsx b/packages/ui/src/combobox/index.tsx
index 54bbd915fb..9510f32ea2 100644
--- a/packages/ui/src/combobox/index.tsx
+++ b/packages/ui/src/combobox/index.tsx
@@ -28,8 +28,6 @@ import { Tooltip } from "../tooltip";
export type ComboboxOption<TMeta = any> = {
label: string | ReactNode;
- description?: string;
- badge?: string;
value: string;
icon?: Icon | ReactNode;
disabledTooltip?: ReactNode;
@@ -333,22 +331,15 @@ export function Combobox({
)}
text={
<>
- <div>
- <div
- className={cn(
- "min-w-0 grow truncate text-left",
- labelProps?.className,
- )}
- >
- {children ||
- selected.map((option) => option.label).join(", ") ||
- placeholder}
- </div>
- {selected.length === 1 && selected[0].description && (
- <div className="text-content-subtle text-xs font-medium">
- {selected[0].description}
- </div>
+ <div
+ className={cn(
+ "min-w-0 grow truncate text-left",
+ labelProps?.className,
)}
+ >
+ {children ||
+ selected.map((option) => option.label).join(", ") ||
+ placeholder}
</div>
{caret &&
(caret === true ? (
@@ -423,22 +414,7 @@ function Option({
)}
</span>
)}
- <div>
- <div className="flex items-center gap-1.5">
- <span className="grow truncate">{option.label}</span>
-
- {option.badge && (
- <span className="min-h-4 rounded-md bg-violet-100 px-1 text-xs font-semibold text-violet-600">
- {option.badge}
- </span>
- )}
- </div>
- {option.description && (
- <div className="text-content-subtle text-xs font-medium">
- {option.description}
- </div>
- )}
- </div>
+ <span className="grow truncate">{option.label}</span>
</div>
{right}
{!multiple && selected && (