From ee53eaf0037ca82da2a32e723ced98df0528d2fe Mon Sep 17 00:00:00 2001 From: Oliver Bryan <04oliverbryan@gmail.com> Date: Wed, 21 Jan 2026 13:45:14 +0000 Subject: [PATCH] frontend implementation of iconURL --- packages/frontend/src/components/account.tsx | 2 +- .../frontend/src/components/organisation-form.tsx | 14 ++++++++++++++ packages/frontend/src/components/organisations.tsx | 3 ++- .../frontend/src/lib/server/organisation/index.ts | 1 + packages/frontend/src/pages/App.tsx | 7 ++++++- packages/shared/src/api-schemas.ts | 1 + 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/components/account.tsx b/packages/frontend/src/components/account.tsx index 5b1775f..f2b688b 100644 --- a/packages/frontend/src/components/account.tsx +++ b/packages/frontend/src/components/account.tsx @@ -3,6 +3,7 @@ import type { ReactNode } from "react"; import { useEffect, useState } from "react"; import { toast } from "sonner"; import { useAuthenticatedSession } from "@/components/session-provider"; +import ThemeToggle from "@/components/theme-toggle"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import { Field } from "@/components/ui/field"; @@ -13,7 +14,6 @@ import { UploadAvatar } from "@/components/upload-avatar"; import { useUpdateUser } from "@/lib/query/hooks"; import { parseError } from "@/lib/server"; import { cn } from "@/lib/utils"; -import ThemeToggle from "./theme-toggle"; function Account({ trigger }: { trigger?: ReactNode }) { const { user: currentUser, setUser } = useAuthenticatedSession(); diff --git a/packages/frontend/src/components/organisation-form.tsx b/packages/frontend/src/components/organisation-form.tsx index 39e5b44..4f2661d 100644 --- a/packages/frontend/src/components/organisation-form.tsx +++ b/packages/frontend/src/components/organisation-form.tsx @@ -18,6 +18,7 @@ import { } from "@/components/ui/dialog"; import { Field } from "@/components/ui/field"; import { Label } from "@/components/ui/label"; +import { UploadOrgIcon } from "@/components/upload-org-icon"; import { useCreateOrganisation, useUpdateOrganisation } from "@/lib/query/hooks"; import { parseError } from "@/lib/server"; import { cn } from "@/lib/utils"; @@ -59,6 +60,7 @@ export function OrganisationForm({ const [name, setName] = useState(""); const [slug, setSlug] = useState(""); const [description, setDescription] = useState(""); + const [iconURL, setIconURL] = useState(null); const [slugManuallyEdited, setSlugManuallyEdited] = useState(false); const [submitAttempted, setSubmitAttempted] = useState(false); const [submitting, setSubmitting] = useState(false); @@ -71,6 +73,7 @@ export function OrganisationForm({ setName(existingOrganisation.name); setSlug(existingOrganisation.slug); setDescription(existingOrganisation.description ?? ""); + setIconURL(existingOrganisation.iconURL ?? null); setSlugManuallyEdited(true); } }, [isEdit, existingOrganisation, open]); @@ -79,6 +82,7 @@ export function OrganisationForm({ setName(""); setSlug(""); setDescription(""); + setIconURL(null); setSlugManuallyEdited(false); setSubmitAttempted(false); setSubmitting(false); @@ -161,6 +165,16 @@ export function OrganisationForm({
+ {isEdit && existingOrganisation && ( + + )} org.Organisation.id === selectedOrganisationId, )?.Organisation.slug || "" } + iconURL={ + organisations.find( + (org) => org.Organisation.id === selectedOrganisationId, + )?.Organisation.iconURL || undefined + } size={7} /> } diff --git a/packages/shared/src/api-schemas.ts b/packages/shared/src/api-schemas.ts index 6c21922..24f63b5 100644 --- a/packages/shared/src/api-schemas.ts +++ b/packages/shared/src/api-schemas.ts @@ -135,6 +135,7 @@ export const OrgUpdateRequestSchema = z.object({ .max(ORG_SLUG_MAX_LENGTH) .regex(/^[a-z0-9-]+$/) .optional(), + iconURL: z.string().url().max(512).nullable().optional(), statuses: z .record(z.string()) .refine((obj) => Object.keys(obj).length > 0, "Statuses must have at least one entry")