Use asset-backed company logos

This commit is contained in:
Dotta
2026-03-16 09:25:39 -05:00
parent 1a5eaba622
commit e538329b0a
17 changed files with 307 additions and 57 deletions

View File

@@ -18,7 +18,6 @@ export const companiesApi = {
name: string;
description?: string | null;
budgetMonthlyCents?: number;
logoUrl?: string | null;
}) =>
api.post<Company>("/companies", data),
update: (
@@ -26,7 +25,7 @@ export const companiesApi = {
data: Partial<
Pick<
Company,
"name" | "description" | "status" | "budgetMonthlyCents" | "requireBoardApprovalForNewAgents" | "brandColor" | "logoUrl"
"name" | "description" | "status" | "budgetMonthlyCents" | "requireBoardApprovalForNewAgents" | "brandColor" | "logoAssetId"
>
>,
) => api.patch<Company>(`/companies/${companyId}`, data),

View File

@@ -28,7 +28,6 @@ interface CompanyContextValue {
name: string;
description?: string | null;
budgetMonthlyCents?: number;
logoUrl?: string | null;
}) => Promise<Company>;
}
@@ -90,7 +89,6 @@ export function CompanyProvider({ children }: { children: ReactNode }) {
name: string;
description?: string | null;
budgetMonthlyCents?: number;
logoUrl?: string | null;
}) =>
companiesApi.create(data),
onSuccess: (company) => {
@@ -104,7 +102,6 @@ export function CompanyProvider({ children }: { children: ReactNode }) {
name: string;
description?: string | null;
budgetMonthlyCents?: number;
logoUrl?: string | null;
}) => {
return createMutation.mutateAsync(data);
},

View File

@@ -141,7 +141,7 @@ export function CompanySettings() {
mutationFn: (file: File) =>
assetsApi
.uploadImage(selectedCompanyId!, file, "companies")
.then((asset) => companiesApi.update(selectedCompanyId!, { logoUrl: asset.contentPath })),
.then((asset) => companiesApi.update(selectedCompanyId!, { logoAssetId: asset.assetId })),
onSuccess: (company) => {
syncLogoState(company.logoUrl);
setLogoUploadError(null);
@@ -149,7 +149,7 @@ export function CompanySettings() {
});
const clearLogoMutation = useMutation({
mutationFn: () => companiesApi.update(selectedCompanyId!, { logoUrl: null }),
mutationFn: () => companiesApi.update(selectedCompanyId!, { logoAssetId: null }),
onSuccess: (company) => {
setLogoUploadError(null);
syncLogoState(company.logoUrl);