mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 10:50:38 +09:00
Use asset-backed company logos
This commit is contained in:
parent
1a5eaba622
commit
e538329b0a
17 changed files with 307 additions and 57 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue