From c8ef69a45329b9ca9468442e69824899f3f385d2 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Thu, 16 Jul 2026 13:33:29 +0330 Subject: [PATCH] logo set --- src/api/businesses.ts | 20 +++++ src/api/platform-settings.ts | 64 ++++++++++----- src/api/types.ts | 2 + src/components/brand/AppLogo.vue | 24 +++--- src/components/brand/useAppLogo.ts | 32 ++++++++ src/components/shared/LogoUploadField.vue | 62 +++++++++++++++ src/components/shared/LogoUploadPair.vue | 68 ++++++++++++++++ src/stores/platform-settings.ts | 53 +++++++++++++ src/utils/media.ts | 29 +++++++ src/views/BusinessesView.vue | 85 ++++++++++++++++++++ src/views/PlatformSettingsView.vue | 97 ++++++++++++++++++++++- 11 files changed, 505 insertions(+), 31 deletions(-) create mode 100644 src/components/brand/useAppLogo.ts create mode 100644 src/components/shared/LogoUploadField.vue create mode 100644 src/components/shared/LogoUploadPair.vue create mode 100644 src/stores/platform-settings.ts diff --git a/src/api/businesses.ts b/src/api/businesses.ts index 7b434b7..7824fd8 100644 --- a/src/api/businesses.ts +++ b/src/api/businesses.ts @@ -61,3 +61,23 @@ export function deleteBusinessImage(businessId: string, imageId: string) { method: 'DELETE', }); } + +export function uploadBusinessLogoLight(businessId: string, file: File) { + const form = new FormData(); + form.append('file', file); + return apiFormData(`/businesses/${businessId}/logo-light`, form); +} + +export function uploadBusinessLogoDark(businessId: string, file: File) { + const form = new FormData(); + form.append('file', file); + return apiFormData(`/businesses/${businessId}/logo-dark`, form); +} + +export function removeBusinessLogoLight(businessId: string) { + return api(`/businesses/${businessId}/logo-light`, { method: 'DELETE' }); +} + +export function removeBusinessLogoDark(businessId: string) { + return api(`/businesses/${businessId}/logo-dark`, { method: 'DELETE' }); +} diff --git a/src/api/platform-settings.ts b/src/api/platform-settings.ts index 3b6c905..c57bdb1 100644 --- a/src/api/platform-settings.ts +++ b/src/api/platform-settings.ts @@ -1,21 +1,43 @@ -import { api, apiFormData } from './client'; - -export type PlatformSettings = { - loginHeroImageUrl: string | null; -}; - -export function fetchPlatformSettings() { - return api('/platform-settings'); -} - -export function uploadLoginHeroImage(file: File) { - const form = new FormData(); - form.append('file', file); - return apiFormData('/platform-settings/login-hero-image', form); -} - -export function removeLoginHeroImage() { - return api('/platform-settings/login-hero-image', { - method: 'DELETE', - }); -} +import { api, apiFormData } from './client'; + +export type PlatformSettings = { + loginHeroImageUrl: string | null; + logoLightUrl: string | null; + logoDarkUrl: string | null; +}; + +export function fetchPlatformSettings() { + return api('/platform-settings'); +} + +export function uploadLoginHeroImage(file: File) { + const form = new FormData(); + form.append('file', file); + return apiFormData('/platform-settings/login-hero-image', form); +} + +export function removeLoginHeroImage() { + return api('/platform-settings/login-hero-image', { + method: 'DELETE', + }); +} + +export function uploadPlatformLogoLight(file: File) { + const form = new FormData(); + form.append('file', file); + return apiFormData('/platform-settings/logo-light', form); +} + +export function uploadPlatformLogoDark(file: File) { + const form = new FormData(); + form.append('file', file); + return apiFormData('/platform-settings/logo-dark', form); +} + +export function removePlatformLogoLight() { + return api('/platform-settings/logo-light', { method: 'DELETE' }); +} + +export function removePlatformLogoDark() { + return api('/platform-settings/logo-dark', { method: 'DELETE' }); +} diff --git a/src/api/types.ts b/src/api/types.ts index 01ed1ea..88d84b0 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -73,6 +73,8 @@ export type Business = { ownerId?: string | null; category?: BusinessCategory; images?: BusinessImage[]; + logoLightUrl?: string | null; + logoDarkUrl?: string | null; concurrentCapacity?: number; slotStepMinutes?: number; serviceClassesEnabled?: boolean; diff --git a/src/components/brand/AppLogo.vue b/src/components/brand/AppLogo.vue index e577274..e0005d0 100644 --- a/src/components/brand/AppLogo.vue +++ b/src/components/brand/AppLogo.vue @@ -1,19 +1,19 @@