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.

Group settings updates

Tim Wilson9db4a4983b8b
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsx
index 7b423eb9a7..d3a33e65cf 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-header.tsx
@@ -73,7 +73,7 @@ export function GroupHeaderTitle() {
</Link>
<ChevronRight className="text-content-muted size-2.5 shrink-0 [&_*]:stroke-2" />
<div className="flex items-center gap-1.5">
- {<GroupColorCircle group={group} />}
+ <GroupColorCircle group={group} />
<span className="text-lg font-semibold leading-7 text-neutral-900">
{group.name}
</span>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsx
index 1a6f13df33..e9bccbe954 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/group-settings.tsx
@@ -4,7 +4,10 @@ import { useApiMutation } from "@/lib/swr/use-api-mutation";
import useGroup from "@/lib/swr/use-group";
import useProgram from "@/lib/swr/use-program";
import { GroupProps } from "@/lib/types";
-import { updateGroupSchema } from "@/lib/zod/schemas/groups";
+import {
+ DEFAULT_PARTNER_GROUP,
+ updateGroupSchema,
+} from "@/lib/zod/schemas/groups";
import { GroupColorPicker } from "@/ui/partners/groups/group-color-picker";
import { Button, LoadingSpinner } from "@dub/ui";
import { cn } from "@dub/utils";
@@ -104,8 +107,8 @@ function GroupSettingsForm({
})}
onChange={(e) => {
const name = e.target.value;
- setValue("name", name);
- setValue("slug", slugify(name));
+ setValue("name", name, { shouldDirty: true });
+ setValue("slug", slugify(name), { shouldDirty: true });
}}
placeholder="Group name"
/>
@@ -129,38 +132,40 @@ function GroupSettingsForm({
</div>
</div>
- <div>
- <label
- htmlFor="slug"
- className="text-sm font-medium text-neutral-800"
- >
- Landing page slug
- </label>
- <div className="mt-2">
- <div className="flex">
- <div className="flex items-center rounded-l-md border-y border-l border-neutral-300 px-3 py-2 text-sm text-neutral-800">
- partners.dub.co/{program?.slug}
+ {group.slug !== DEFAULT_PARTNER_GROUP.slug && (
+ <div>
+ <label
+ htmlFor="slug"
+ className="text-sm font-medium text-neutral-800"
+ >
+ Landing page slug
+ </label>
+ <div className="mt-2">
+ <div className="flex">
+ <div className="flex items-center rounded-l-md border-y border-l border-neutral-300 px-3 py-2 text-sm text-neutral-800">
+ partners.dub.co/{program?.slug}
+ </div>
+ <input
+ type="text"
+ id="slug"
+ className={cn(
+ "block w-full rounded-r-md border border-neutral-300 px-3 py-2 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
+ errors.slug &&
+ "border-red-600 focus:border-red-500 focus:ring-red-600",
+ )}
+ {...register("slug", {
+ required: true,
+ })}
+ placeholder="group-name"
+ />
</div>
- <input
- type="text"
- id="slug"
- className={cn(
- "block w-full rounded-r-md border border-neutral-300 px-3 py-2 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
- errors.slug &&
- "border-red-600 focus:border-red-500 focus:ring-red-600",
- )}
- {...register("slug", {
- required: true,
- })}
- placeholder="group-name"
- />
- </div>
- <p className="mt-2 text-xs text-neutral-500">
- For both internal and external use
- </p>
+ <p className="mt-2 text-xs text-neutral-500">
+ For both internal and external use
+ </p>
+ </div>
</div>
- </div>
+ )}
</div>
</div>