chore: reduce team data footprint (#11478)

This commit is contained in:
Leo Giovanetti authored and GitHub committed 2023-09-21 18:08:34 -03:00
1 parent 86b3a33ff6
commit 578495de87
10 files changed
+75 -53

No files matched your search

@@ -10,10 +10,15 @@ import type { teamMetadataSchema } from "@calcom/prisma/zod-utils";
*/
export type OrganizationBranding =
| ({
/** 1 */
id: number;
/** Acme */
name?: string;
/** acme */
slug: string;
/** https://acme.cal.com */
fullDomain: string;
/** cal.com */
domainSuffix: string;
} & z.infer<typeof teamMetadataSchema>)
| null
@@ -121,7 +121,7 @@ export default function MemberListItem(props: Props) {
const bookerUrlWithoutProtocol = bookerUrl.replace(/^https?:\/\//, "");
const bookingLink = !!props.member.username && `${bookerUrlWithoutProtocol}/${props.member.username}`;
const isAdmin = props.team && ["ADMIN", "OWNER"].includes(props.team.membership?.role);
const appList = props.member.connectedApps.map(({ logo, name, externalId }) => {
const appList = props.member.connectedApps?.map(({ logo, name, externalId }) => {
return logo ? (
externalId ? (
<div className="ltr:mr-2 rtl:ml-2 ">
@@ -11,7 +11,6 @@ interface Props {
id?: number;
name?: string | null;
slug?: string | null;
logo?: string | null;
bio?: string | null;
hideBranding?: boolean | undefined;
role: MembershipRole;
@@ -1,5 +1,5 @@
import classNames from "@calcom/lib/classNames";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { MembershipRole } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
@@ -20,7 +20,6 @@ interface Props {
id?: number;
name?: string | null;
slug?: string | null;
logo?: string | null;
bio?: string | null;
hideBranding?: boolean | undefined;
role: MembershipRole;
@@ -66,7 +65,7 @@ export default function TeamInviteListItem(props: Props) {
<div className="flex">
<Avatar
size="mdLg"
imageSrc={getPlaceholderAvatar(team?.logo, team?.name as string)}
imageSrc={`${WEBAPP_URL}/team/${team.slug}/avatar.png`}
alt="Team Logo"
className=""
/>
@@ -149,7 +149,6 @@ const MembersView = () => {
{
id: team.id,
accepted: team.membership.accepted || false,
logo: team.logo,
name: team.name,
slug: team.slug,
role: team.membership.role,
@@ -94,7 +94,6 @@ const ProfileView = () => {
if (team) {
form.setValue("name", team.name || "");
form.setValue("slug", team.slug || "");
form.setValue("logo", team.logo || "");
form.setValue("bio", team.bio || "");
if (team.slug === null && (team?.metadata as Prisma.JsonObject)?.requestedSlug) {
form.setValue("slug", ((team?.metadata as Prisma.JsonObject)?.requestedSlug as string) || "");
@@ -165,7 +164,6 @@ const ProfileView = () => {
handleSubmit={(values) => {
if (team) {
const variables = {
logo: values.logo,
name: values.name,
slug: values.slug,
bio: values.bio,