diff --git a/apps/web/modules/onboarding/organization/brand/organization-brand-view.tsx b/apps/web/modules/onboarding/organization/brand/organization-brand-view.tsx index c3352258d7..d68889a8d0 100644 --- a/apps/web/modules/onboarding/organization/brand/organization-brand-view.tsx +++ b/apps/web/modules/onboarding/organization/brand/organization-brand-view.tsx @@ -2,11 +2,12 @@ import { useRouter, useSearchParams } from "next/navigation"; import posthog from "posthog-js"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Button } from "@calcom/ui/components/button"; import { ColorPicker, Label } from "@calcom/ui/components/form"; +import { BannerUploader, ImageUploader } from "@calcom/ui/components/image-uploader"; import { OnboardingCard } from "../../components/OnboardingCard"; import { OnboardingLayout } from "../../components/OnboardingLayout"; @@ -25,49 +26,24 @@ export const OrganizationBrandView = ({ userEmail }: OrganizationBrandViewProps) const { organizationDetails, organizationBrand, setOrganizationBrand } = useOnboardingStore(); const { isMigrationFlow, hasTeams } = useMigrationFlow(); - const [_logoFile, setLogoFile] = useState(null); - const [_bannerFile, setBannerFile] = useState(null); const [logoPreview, setLogoPreview] = useState(null); const [bannerPreview, setBannerPreview] = useState(null); const [brandColor, setBrandColor] = useState("#000000"); - // Load from store on mount useEffect(() => { setLogoPreview(organizationBrand.logo); setBannerPreview(organizationBrand.banner); setBrandColor(organizationBrand.color); }, [organizationBrand]); - const handleLogoChange = (file: File | null) => { - setLogoFile(file); - if (file) { - const reader = new FileReader(); - reader.onloadend = () => { - const base64 = reader.result as string; - setLogoPreview(base64); - setOrganizationBrand({ logo: base64 }); - }; - reader.readAsDataURL(file); - } else { - setLogoPreview(null); - setOrganizationBrand({ logo: null }); - } + const handleLogoChange = (newLogo: string) => { + setLogoPreview(newLogo); + setOrganizationBrand({ logo: newLogo }); }; - const handleBannerChange = (file: File | null) => { - setBannerFile(file); - if (file) { - const reader = new FileReader(); - reader.onloadend = () => { - const base64 = reader.result as string; - setBannerPreview(base64); - setOrganizationBrand({ banner: base64 }); - }; - reader.readAsDataURL(file); - } else { - setBannerPreview(null); - setOrganizationBrand({ banner: null }); - } + const handleBannerChange = (newBanner: string) => { + setBannerPreview(newBanner); + setOrganizationBrand({ banner: newBanner }); }; const handleColorChange = (color: string) => { @@ -154,21 +130,28 @@ export const OrganizationBrandView = ({ userEmail }: OrganizationBrandViewProps) /> )} -
- - handleBannerChange(e.target.files?.[0] || null)} +
+ + {bannerPreview && ( + + )}

@@ -188,21 +171,26 @@ export const OrganizationBrandView = ({ userEmail }: OrganizationBrandViewProps) /> )} -

+ + {logoPreview && ( - handleLogoChange(e.target.files?.[0] || null)} - /> -
+ )}

{t("onboarding_logo_size_hint")}

diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 9f3bef3843..4205a45954 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -4291,8 +4291,8 @@ "onboarding_org_brand_subtitle": "Customize your booking pages with your logo and a custom banner", "onboarding_primary_color_label": "Primary color", "onboarding_banner_label": "Banner", - "onboarding_logo_size_hint": "Recommended size 64x64px (max 10mb)", - "onboarding_banner_size_hint": "Recommended size 1500x150px (max 10mb)", + "onboarding_logo_size_hint": "Recommended size 64x64px (max 5mb)", + "onboarding_banner_size_hint": "Recommended size 1500x500px (max 5mb)", "onboarding_preview_nameless": "Nameless", "onboarding_preview_example_title": "Enterprise sales", "onboarding_preview_example_description": "Jump on a call with one of our sales reps to learn more",