feat: added banner for orgs (#13644)
Use this banner to test https://pbs.twimg.com/profile_banners/1063089191565905920/1685635865/1500x500 - [x] add backend - [x] add file upload (require 1500x500px) in Organization/Appearance - [x] for now, apply this to all Org event types. later we could think about sub-team overwrites, but for now org is enough 1) Upload Banner Screen <img width="1512" alt="Screenshot 2024-02-15 at 10 26 36 PM" src="https://github.com/calcom/cal.com/assets/53316345/3c7417ee-7ef7-4138-b5f8-38f255a407fa"> 2) <img width="1512" alt="Screenshot 2024-02-15 at 10 27 02 PM" src="https://github.com/calcom/cal.com/assets/53316345/a74dffbf-3727-4b2f-82d5-fefd55c12901"> 3) Go to Org Team Event Types <img width="1512" alt="Screenshot 2024-02-15 at 10 27 21 PM" src="https://github.com/calcom/cal.com/assets/53316345/5f188bd7-8a66-4da7-be73-1b5e178b5b3b"> __________________________________________________ DESIGNS  __   mobile: 
This commit is contained in:
1 parent
0972307998
commit
dfd683ffc4
16 files changed
+435
-88
No files matched your search
@@ -22,6 +22,7 @@ import {
|
||||
Button,
|
||||
Form,
|
||||
ImageUploader,
|
||||
BannerUploader,
|
||||
Label,
|
||||
Meta,
|
||||
showToast,
|
||||
@@ -40,12 +41,14 @@ import { useOrgBranding } from "../../../organizations/context/provider";
|
||||
const orgProfileFormSchema = z.object({
|
||||
name: z.string(),
|
||||
logo: z.string().nullable(),
|
||||
banner: z.string().nullable(),
|
||||
bio: z.string(),
|
||||
});
|
||||
|
||||
type FormValues = {
|
||||
name: string;
|
||||
logo: string | null;
|
||||
banner: string | null;
|
||||
bio: string;
|
||||
slug: string;
|
||||
};
|
||||
@@ -110,6 +113,7 @@ const OrgProfileView = () => {
|
||||
const defaultValues: FormValues = {
|
||||
name: currentOrganisation?.name || "",
|
||||
logo: currentOrganisation?.logo || "",
|
||||
banner: currentOrganisation?.bannerUrl || "",
|
||||
bio: currentOrganisation?.bio || "",
|
||||
slug:
|
||||
currentOrganisation?.slug ||
|
||||
@@ -178,6 +182,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
name: (res.data?.name || "") as string,
|
||||
bio: (res.data?.bio || "") as string,
|
||||
slug: defaultValues["slug"],
|
||||
banner: (res.data?.bannerUrl || "") as string,
|
||||
});
|
||||
await utils.viewer.teams.get.invalidate();
|
||||
await utils.viewer.organizations.listCurrent.invalidate();
|
||||
@@ -201,6 +206,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
name: values.name,
|
||||
slug: values.slug,
|
||||
bio: values.bio,
|
||||
banner: values.banner,
|
||||
};
|
||||
|
||||
mutation.mutate(variables);
|
||||
@@ -250,6 +256,53 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-2 flex items-center">
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="banner"
|
||||
render={({ field: { value } }) => {
|
||||
const showRemoveBannerButton = !!value;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Avatar
|
||||
data-testid="profile-upload-banner"
|
||||
alt={`${defaultValues.name} Banner` || ""}
|
||||
imageSrc={value}
|
||||
size="lg"
|
||||
/>
|
||||
<div className="ms-4">
|
||||
<div className="flex gap-2">
|
||||
<BannerUploader
|
||||
height={500}
|
||||
width={1500}
|
||||
target="banner"
|
||||
uploadInstruction={t("org_banner_instructions", { height: 500, width: 1500 })}
|
||||
id="banner-upload"
|
||||
buttonMsg={t("upload_banner")}
|
||||
handleAvatarChange={(newBanner) => {
|
||||
form.setValue("banner", newBanner, { shouldDirty: true });
|
||||
}}
|
||||
imageSrc={value || undefined}
|
||||
triggerButtonColor={showRemoveBannerButton ? "secondary" : "primary"}
|
||||
/>
|
||||
{showRemoveBannerButton && (
|
||||
<Button
|
||||
color="destructive"
|
||||
onClick={() => {
|
||||
form.setValue("banner", "", { shouldDirty: true });
|
||||
}}>
|
||||
{t("remove")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="name"
|
||||
|
||||
Reference in new issue
Block a user