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.

fix inert

Steven Teyeed4a8b7b5f5
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsx
index 2d316e606c..2a60219581 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discounts/group-discounts.tsx
@@ -147,7 +147,7 @@ const Banner = () => {
}
initial={false}
className="overflow-hidden"
- {...(dismissedBanner && { inert: true })}
+ inert={dismissedBanner}
>
<div className="pb-6">
<div className="relative isolate overflow-hidden rounded-xl bg-neutral-100">
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx
index 531238d9ac..cc815015f5 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx
@@ -266,7 +266,7 @@ const Banner = () => {
}
initial={false}
className="overflow-hidden"
- {...(dismissedBanner && { inert: true })}
+ inert={dismissedBanner}
>
<div className="pb-6">
<div className="relative isolate overflow-hidden rounded-xl bg-neutral-100">
diff --git a/apps/web/ui/domains/add-edit-domain-form.tsx b/apps/web/ui/domains/add-edit-domain-form.tsx
index aee31e9aec..53b0ed7bd9 100644
--- a/apps/web/ui/domains/add-edit-domain-form.tsx
+++ b/apps/web/ui/domains/add-edit-domain-form.tsx
@@ -429,7 +429,7 @@ export function AddEditDomainForm({
transition={{ duration: 0.1 }}
initial={false}
className="-m-1 overflow-hidden p-1"
- {...{ inert: showOption ? undefined : true }}
+ inert={!showOption}
>
<div className="relative mt-2 rounded-md shadow-sm">
{id === "logo" ? (
diff --git a/apps/web/ui/layout/sidebar/sidebar-nav.tsx b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
index 61e2d2c8b2..7dbd0aaa54 100644
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@ -475,7 +475,7 @@ export function Area({
),
)}
aria-hidden={!visible ? "true" : undefined}
- {...{ inert: !visible ? true : undefined }}
+ inert={!visible}
>
{children}
</div>
diff --git a/apps/web/ui/partners/add-edit-discount-sheet.tsx b/apps/web/ui/partners/add-edit-discount-sheet.tsx
index 4b0e98e01d..c4cbd336ea 100644
--- a/apps/web/ui/partners/add-edit-discount-sheet.tsx
+++ b/apps/web/ui/partners/add-edit-discount-sheet.tsx
@@ -218,97 +218,84 @@ function DiscountSheetContent({
height
transition={{ ease: "easeInOut", duration: 0.2 }}
>
- <div className="p-1">
- <div
- className={cn(
- "space-y-4 transition-opacity duration-200",
- )}
- aria-hidden={!isRecurring}
- {...{
- inert: !isRecurring,
- }}
- >
- <div className="grid grid-cols-1 gap-3 lg:grid-cols-2">
- {discountTypes.map(
- ({ label, description, recurring }) => {
- const isSelected = isRecurring === recurring;
-
- return (
- <label
- key={label}
- className={cn(
- "relative flex w-full cursor-pointer items-start gap-0.5 rounded-md border border-neutral-200 bg-white p-3 text-neutral-600 hover:bg-neutral-50",
- "transition-all duration-150",
- isSelected &&
- "border-black bg-neutral-50 text-neutral-900 ring-1 ring-black",
- )}
- >
- <input
- type="radio"
- value={label}
- className="hidden"
- checked={isSelected}
- onChange={(e) => {
- if (e.target.checked) {
- setIsRecurring(recurring);
- setValue(
- "maxDuration",
- recurring
- ? discount?.maxDuration ||
- Infinity
- : 0,
- );
- }
- }}
- />
- <div className="flex grow flex-col text-sm">
- <span className="font-medium">
- {label}
- </span>
- <span>{description}</span>
- </div>
- <CircleCheckFill
- className={cn(
- "-mr-px -mt-px flex size-4 scale-75 items-center justify-center rounded-full opacity-0 transition-[transform,opacity] duration-150",
- isSelected && "scale-100 opacity-100",
- )}
- />
- </label>
- );
- },
- )}
- </div>
+ <div className="space-y-4 p-1 transition-opacity duration-200">
+ <div className="grid grid-cols-1 gap-3 lg:grid-cols-2">
+ {discountTypes.map(
+ ({ label, description, recurring }) => {
+ const isSelected = isRecurring === recurring;
- {isRecurring && (
- <div className="space-y-4">
- <div>
+ return (
<label
- htmlFor="duration"
- className="text-sm font-medium text-neutral-800"
+ key={label}
+ className={cn(
+ "relative flex w-full cursor-pointer items-start gap-0.5 rounded-md border border-neutral-200 bg-white p-3 text-neutral-600 hover:bg-neutral-50",
+ "transition-all duration-150",
+ isSelected &&
+ "border-black bg-neutral-50 text-neutral-900 ring-1 ring-black",
+ )}
>
- Duration
+ <input
+ type="radio"
+ value={label}
+ className="hidden"
+ checked={isSelected}
+ onChange={(e) => {
+ if (e.target.checked) {
+ setIsRecurring(recurring);
+ setValue(
+ "maxDuration",
+ recurring
+ ? discount?.maxDuration || Infinity
+ : 0,
+ );
+ }
+ }}
+ />
+ <div className="flex grow flex-col text-sm">
+ <span className="font-medium">{label}</span>
+ <span>{description}</span>
+ </div>
+ <CircleCheckFill
+ className={cn(
+ "-mr-px -mt-px flex size-4 scale-75 items-center justify-center rounded-full opacity-0 transition-[transform,opacity] duration-150",
+ isSelected && "scale-100 opacity-100",
+ )}
+ />
</label>
- <div className="relative mt-2 rounded-md shadow-sm">
- <select
- className="block w-full rounded-md border-neutral-300 text-neutral-900 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
- {...register("maxDuration", {
- valueAsNumber: true,
- })}
- >
- {RECURRING_MAX_DURATIONS.filter(
- (v) => v !== 0, // filter out one-time discounts (already covered by the one-time discount type)
- ).map((v) => (
- <option value={v} key={v}>
- {v} {pluralize("month", Number(v))}
- </option>
- ))}
- <option value={Infinity}>Lifetime</option>
- </select>
- </div>
- </div>
- </div>
+ );
+ },
)}
</div>
+
+ {isRecurring && (
+ <div className="space-y-4">
+ <div>
+ <label
+ htmlFor="duration"
+ className="text-sm font-medium text-neutral-800"
+ >
+ Duration
+ </label>
+ <div className="relative mt-2 rounded-md shadow-sm">
+ <select
+ className="block w-full rounded-md border-neutral-300 text-neutral-900 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
+ {...register("maxDuration", {
+ valueAsNumber: true,
+ })}
+ >
+ {RECURRING_MAX_DURATIONS.filter(
+ (v) => v !== 0, // filter out one-time discounts (already covered by the one-time discount type)
+ ).map((v) => (
+ <option value={v} key={v}>
+ {v} {pluralize("month", Number(v))}
+ </option>
+ ))}
+ <option value={Infinity}>Lifetime</option>
+ </select>
+ </div>
+ </div>
+ </div>
+ )}
</div>
</AnimatedSizeContainer>
</div>
diff --git a/apps/web/ui/partners/design/lander-preview-controls.tsx b/apps/web/ui/partners/design/lander-preview-controls.tsx
index 4fab17c562..5325ac95ee 100644
--- a/apps/web/ui/partners/design/lander-preview-controls.tsx
+++ b/apps/web/ui/partners/design/lander-preview-controls.tsx
@@ -47,7 +47,7 @@ export function LanderPreviewControls() {
showGenerateButton &&
"pointer-events-auto w-auto translate-y-0 opacity-100",
)}
- {...{ inert: showGenerateButton ? undefined : true }}
+ inert={!showGenerateButton}
>
<Button
type="button"
diff --git a/apps/web/ui/partners/design/previews/lander-preview.tsx b/apps/web/ui/partners/design/previews/lander-preview.tsx
index f4ac691392..609b0d9a7f 100644
--- a/apps/web/ui/partners/design/previews/lander-preview.tsx
+++ b/apps/web/ui/partners/design/previews/lander-preview.tsx
@@ -137,7 +137,7 @@ export function LanderPreview({
isGeneratingLander &&
"pointer-events-auto opacity-100 backdrop-blur-md",
)}
- {...{ inert: isGeneratingLander ? undefined : true }}
+ inert={!isGeneratingLander}
>
<div
className={cn(
diff --git a/apps/web/ui/partners/program-application-sheet.tsx b/apps/web/ui/partners/program-application-sheet.tsx
index f280d02ca9..cd9d0cc971 100644
--- a/apps/web/ui/partners/program-application-sheet.tsx
+++ b/apps/web/ui/partners/program-application-sheet.tsx
@@ -90,9 +90,7 @@ function ProgramApplicationSheetContent({
"flex h-full flex-col transition-opacity duration-200",
isSubmitSuccessful && "pointer-events-none opacity-0",
)}
- {...{
- inert: isSubmitSuccessful,
- }}
+ inert={isSubmitSuccessful}
>
<div className="flex items-start justify-between bg-neutral-50 p-6">
<Sheet.Title asChild className="min-w-0">
@@ -211,9 +209,7 @@ function ProgramApplicationSheetContent({
? "translate-y-0 opacity-100"
: "pointer-events-none translate-y-4 opacity-0",
)}
- {...{
- inert: !isSubmitSuccessful,
- }}
+ inert={!isSubmitSuccessful}
>
<Grid
cellSize={60}
diff --git a/packages/ui/src/table/selection-toolbar.tsx b/packages/ui/src/table/selection-toolbar.tsx
index cc4d9e8c70..901d1f669a 100644
--- a/packages/ui/src/table/selection-toolbar.tsx
+++ b/packages/ui/src/table/selection-toolbar.tsx
@@ -36,7 +36,7 @@ export function SelectionToolbar<T>({
: "pointer-events-none opacity-0",
className,
)}
- {...{ inert: selectedCount > 0 ? undefined : true }}
+ inert={selectedCount === 0}
>
<div className="flex h-11 items-center gap-2.5 px-2 py-2.5">
<div className="flex w-6 items-center justify-center">