feat: add cal video logo whitelabel for organization (#12616)
This commit is contained in:
1 parent
090b166b1c
commit
e9ea0fcc20
31 files changed
+115
-35
No files matched your search
@@ -110,7 +110,7 @@ export const AddNewTeamsForm = () => {
|
||||
onChange={(e) => handleInputChange(index, e)}
|
||||
addOnClassname="bg-transparent p-0 border-l-0"
|
||||
className={index > 0 ? "mb-2" : ""}
|
||||
placeholder={t(`org_team_names_example_${index + 1}`) || t("org_team_names_example")}
|
||||
placeholder={t(`org_team_names_example_${index + 1}`) || t("org_team_names_example_1")}
|
||||
addOnSuffix={
|
||||
index > 0 && (
|
||||
<Button
|
||||
|
||||
@@ -14,7 +14,8 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import { Button, Form, Meta, showToast, SettingsToggle } from "@calcom/ui";
|
||||
import { Button, Form, Meta, showToast, SettingsToggle, Avatar, ImageUploader } from "@calcom/ui";
|
||||
import { Plus } from "@calcom/ui/components/icon";
|
||||
|
||||
type BrandColorsFormValues = {
|
||||
brandColor: string;
|
||||
@@ -83,6 +84,48 @@ const OrgAppearanceView = ({
|
||||
/>
|
||||
{isAdminOrOwner ? (
|
||||
<div>
|
||||
<div className="my-6">
|
||||
<div className="flex items-center text-sm">
|
||||
<Avatar
|
||||
alt="calVideoLogo"
|
||||
imageSrc={currentOrg?.calVideoLogo}
|
||||
fallback={<Plus className="text-subtle h-6 w-6" />}
|
||||
size="lg"
|
||||
/>
|
||||
<div className="ms-4">
|
||||
<div className="flex gap-2">
|
||||
<ImageUploader
|
||||
target="avatar"
|
||||
id="cal-video-logo-upload"
|
||||
buttonMsg={
|
||||
currentOrg?.calVideoLogo ? t("update_cal_video_logo") : t("upload_cal_video_logo")
|
||||
}
|
||||
handleAvatarChange={(newLogo) => {
|
||||
mutation.mutate({
|
||||
calVideoLogo: newLogo,
|
||||
});
|
||||
}}
|
||||
disabled={mutation.isLoading}
|
||||
imageSrc={currentOrg?.calVideoLogo ?? undefined}
|
||||
uploadInstruction={t("cal_video_logo_upload_instruction")}
|
||||
triggerButtonColor={currentOrg?.calVideoLogo ? "secondary" : "primary"}
|
||||
/>
|
||||
{currentOrg?.calVideoLogo && (
|
||||
<Button
|
||||
color="destructive"
|
||||
disabled={mutation.isLoading}
|
||||
onClick={() => {
|
||||
mutation.mutate({
|
||||
calVideoLogo: null,
|
||||
});
|
||||
}}>
|
||||
{t("remove")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Form
|
||||
form={themeForm}
|
||||
handleSubmit={(value) => {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Team" ADD COLUMN "calVideoLogo" TEXT;
|
||||
@@ -282,6 +282,7 @@ model Team {
|
||||
slug String?
|
||||
logo String?
|
||||
logoUrl String?
|
||||
calVideoLogo String?
|
||||
appLogo String?
|
||||
appIconLogo String?
|
||||
bio String?
|
||||
|
||||
@@ -61,6 +61,7 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
|
||||
const data: Prisma.TeamUpdateArgs["data"] = {
|
||||
name: input.name,
|
||||
logo: input.logo,
|
||||
calVideoLogo: input.calVideoLogo,
|
||||
bio: input.bio,
|
||||
hideBranding: input.hideBranding,
|
||||
hideBookATeamMember: input.hideBookATeamMember,
|
||||
|
||||
@@ -16,6 +16,11 @@ export const ZUpdateInputSchema = z.object({
|
||||
.optional()
|
||||
.nullable()
|
||||
.transform((v) => v || null),
|
||||
calVideoLogo: z
|
||||
.string()
|
||||
.optional()
|
||||
.nullable()
|
||||
.transform((v) => v || null),
|
||||
slug: z.string().optional(),
|
||||
hideBranding: z.boolean().optional(),
|
||||
hideBookATeamMember: z.boolean().optional(),
|
||||
|
||||
@@ -68,6 +68,8 @@ type ImageUploaderProps = {
|
||||
imageSrc?: string;
|
||||
target: string;
|
||||
triggerButtonColor?: ButtonColor;
|
||||
uploadInstruction?: string;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
interface FileEvent<T = Element> extends FormEvent<T> {
|
||||
@@ -122,6 +124,8 @@ export default function ImageUploader({
|
||||
handleAvatarChange,
|
||||
triggerButtonColor,
|
||||
imageSrc,
|
||||
uploadInstruction,
|
||||
disabled = false,
|
||||
}: ImageUploaderProps) {
|
||||
const { t } = useLocale();
|
||||
const [croppedAreaPixels, setCroppedAreaPixels] = useState<Area | null>(null);
|
||||
@@ -173,6 +177,7 @@ export default function ImageUploader({
|
||||
<Button
|
||||
color={triggerButtonColor ?? "secondary"}
|
||||
type="button"
|
||||
disabled={disabled}
|
||||
data-testid="open-upload-avatar-dialog"
|
||||
className="cursor-pointer py-1 text-sm">
|
||||
{buttonMsg}
|
||||
@@ -207,6 +212,9 @@ export default function ImageUploader({
|
||||
/>
|
||||
{t("choose_a_file")}
|
||||
</label>
|
||||
{uploadInstruction && (
|
||||
<p className="text-muted mt-4 text-center text-sm">({uploadInstruction})</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter className="relative">
|
||||
|
||||
Reference in new issue
Block a user