import { useRef, useState } from 'react'; import { Button, TitledGreyBox } from '@/sdk'; import { useDeleteAdminLogo, useUploadAdminLogo } from '@/api/admin/settings/queries'; import type { AdminSettings } from '@/api/admin/settings/queries'; import { imageUploadAccept } from '@/lib/images'; import { useObjectUrl } from '@/plugins/useObjectUrl'; export default function LogoSettingsCard({ settings }: { settings: AdminSettings }) { const readOnly = settings.meta.load_environment_only; const input = useRef(null); const upload = useUploadAdminLogo(); const remove = useDeleteAdminLogo(); const logo = settings.general['app:logo']; const [selected, setSelected] = useState(null); const picked = useObjectUrl(selected); const preview = selected ? picked : logo; const save = () => { if (selected) { upload.mutate({ body: { logo: selected } }, { onSuccess: () => setSelected(null) }); } }; return (
{preview ? ( Panel logo ) : ( Default logo )}

Shown as the favicon, on the login page and in place of the company name in the navigation bar. A theme with a logo of its own shows that instead. PNG, JPEG, SVG, WebP, AVIF, and ICO files are supported.

setSelected(event.target.files?.[0] ?? null)} />
remove.mutate({})} > Remove Logo
); }