fix: Unpublished screens (#10453)
* Implementation * Changes and e2e * Reverting launch.json * Reverting org create handler * Reverting yarn.lock * DRYness and nitpicks * Default org domain to undefined * Applying zomars suggestion * Suggestions * Fixing seed and type in suggestion * Fixing types --------- Co-authored-by: zomars <[email protected]>
This commit is contained in:
1 parent
4435451e9b
commit
4a6dc50909
29 files changed
+503
-161
No files matched your search
@@ -27,6 +27,7 @@ import { getQueryParam } from "./utils/query-param";
|
||||
import { useBrandColors } from "./utils/use-brand-colors";
|
||||
|
||||
const PoweredBy = dynamic(() => import("@calcom/ee/components/PoweredBy"));
|
||||
const UnpublishedEntity = dynamic(() => import("@calcom/ui").then((mod) => mod.UnpublishedEntity));
|
||||
const DatePicker = dynamic(() => import("./components/DatePicker").then((mod) => mod.DatePicker), {
|
||||
ssr: false,
|
||||
});
|
||||
@@ -38,7 +39,7 @@ const BookerComponent = ({
|
||||
bookingData,
|
||||
hideBranding = false,
|
||||
isTeamEvent,
|
||||
org,
|
||||
entity,
|
||||
}: BookerProps) => {
|
||||
const isMobile = useMediaQuery("(max-width: 768px)");
|
||||
const isTablet = useMediaQuery("(max-width: 1024px)");
|
||||
@@ -98,7 +99,7 @@ const BookerComponent = ({
|
||||
bookingData,
|
||||
layout: defaultLayout,
|
||||
isTeamEvent,
|
||||
org,
|
||||
org: entity.orgSlug,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -139,6 +140,10 @@ const BookerComponent = ({
|
||||
|
||||
const hideEventTypeDetails = isEmbed ? embedUiConfig.hideEventTypeDetails : false;
|
||||
|
||||
if (entity.isUnpublished) {
|
||||
return <UnpublishedEntity {...entity} />;
|
||||
}
|
||||
|
||||
if (event.isSuccess && !event.data) {
|
||||
return <NotFound />;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,16 @@ import type { GetBookingType } from "../lib/get-booking";
|
||||
export interface BookerProps {
|
||||
eventSlug: string;
|
||||
username: string;
|
||||
// Make it optional later, once we figure out where we can possibly need to set org
|
||||
org: string | null;
|
||||
|
||||
/**
|
||||
* Whether is a team or org, we gather basic info from both
|
||||
*/
|
||||
entity: {
|
||||
isUnpublished?: boolean;
|
||||
orgSlug?: string | null;
|
||||
teamSlug?: string | null;
|
||||
name?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* If month is NOT set as a prop on the component, we expect a query parameter
|
||||
|
||||
@@ -8,14 +8,18 @@ interface BookerSeoProps {
|
||||
rescheduleUid: string | undefined;
|
||||
hideBranding?: boolean;
|
||||
isTeamEvent?: boolean;
|
||||
org: string | null;
|
||||
entity: {
|
||||
orgSlug?: string | null;
|
||||
teamSlug?: string | null;
|
||||
name?: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export const BookerSeo = (props: BookerSeoProps) => {
|
||||
const { eventSlug, username, rescheduleUid, hideBranding, isTeamEvent, org } = props;
|
||||
const { eventSlug, username, rescheduleUid, hideBranding, isTeamEvent, entity } = props;
|
||||
const { t } = useLocale();
|
||||
const { data: event } = trpc.viewer.public.event.useQuery(
|
||||
{ username, eventSlug, isTeamEvent, org },
|
||||
{ username, eventSlug, isTeamEvent, org: entity.orgSlug ?? null },
|
||||
{ refetchOnWindowFocus: false }
|
||||
);
|
||||
|
||||
|
||||
@@ -23,11 +23,20 @@ export function getOrgSlug(hostname: string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function orgDomainConfig(hostname: string) {
|
||||
export function orgDomainConfig(hostname: string, fallback?: string | string[]) {
|
||||
const currentOrgDomain = getOrgSlug(hostname);
|
||||
const isValidOrgDomain = currentOrgDomain !== null && !RESERVED_SUBDOMAINS.includes(currentOrgDomain);
|
||||
if (isValidOrgDomain || !fallback) {
|
||||
return {
|
||||
currentOrgDomain: isValidOrgDomain ? currentOrgDomain : null,
|
||||
isValidOrgDomain,
|
||||
};
|
||||
}
|
||||
const fallbackOrgSlug = fallback as string;
|
||||
const isValidFallbackDomain = !RESERVED_SUBDOMAINS.includes(fallbackOrgSlug);
|
||||
return {
|
||||
currentOrgDomain,
|
||||
isValidOrgDomain: currentOrgDomain !== null && !RESERVED_SUBDOMAINS.includes(currentOrgDomain),
|
||||
currentOrgDomain: isValidFallbackDomain ? fallbackOrgSlug : null,
|
||||
isValidOrgDomain: isValidFallbackDomain,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,3 +48,17 @@ export function subdomainSuffix() {
|
||||
export function getOrgFullDomain(slug: string, options: { protocol: boolean } = { protocol: true }) {
|
||||
return `${options.protocol ? `${new URL(WEBAPP_URL).protocol}//` : ""}${slug}.${subdomainSuffix()}`;
|
||||
}
|
||||
|
||||
export function getSlugOrRequestedSlug(slug: string) {
|
||||
return {
|
||||
OR: [
|
||||
{ slug },
|
||||
{
|
||||
metadata: {
|
||||
path: ["requestedSlug"],
|
||||
equals: slug,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import type { LocationObject } from "@calcom/app-store/locations";
|
||||
import { privacyFilteredLocations } from "@calcom/app-store/locations";
|
||||
import { getAppFromSlug } from "@calcom/app-store/utils";
|
||||
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
|
||||
import { getSlugOrRequestedSlug } from "@calcom/features/ee/organizations/lib/orgDomains";
|
||||
import { isRecurringEvent, parseRecurringEvent } from "@calcom/lib";
|
||||
import { getDefaultEvent, getUsernameList } from "@calcom/lib/defaultEvents";
|
||||
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
@@ -17,6 +18,7 @@ import {
|
||||
userMetadata as userMetadataSchema,
|
||||
bookerLayouts as bookerLayoutsSchema,
|
||||
BookerLayouts,
|
||||
teamMetadataSchema,
|
||||
} from "@calcom/prisma/zod-utils";
|
||||
|
||||
const publicEventSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
||||
@@ -38,7 +40,24 @@ const publicEventSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
||||
currency: true,
|
||||
seatsPerTimeSlot: true,
|
||||
bookingFields: true,
|
||||
team: true,
|
||||
team: {
|
||||
select: {
|
||||
parentId: true,
|
||||
metadata: true,
|
||||
brandColor: true,
|
||||
darkBrandColor: true,
|
||||
slug: true,
|
||||
name: true,
|
||||
logo: true,
|
||||
theme: true,
|
||||
parent: {
|
||||
select: {
|
||||
slug: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
successRedirectUrl: true,
|
||||
workflows: {
|
||||
include: {
|
||||
@@ -73,6 +92,12 @@ const publicEventSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
||||
metadata: true,
|
||||
brandColor: true,
|
||||
darkBrandColor: true,
|
||||
organization: {
|
||||
select: {
|
||||
name: true,
|
||||
slug: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
hidden: true,
|
||||
@@ -86,11 +111,7 @@ export const getPublicEvent = async (
|
||||
prisma: PrismaClient
|
||||
) => {
|
||||
const usernameList = getUsernameList(username);
|
||||
const orgQuery = org
|
||||
? {
|
||||
slug: org ?? null,
|
||||
}
|
||||
: null;
|
||||
const orgQuery = org ? getSlugOrRequestedSlug(org) : null;
|
||||
// In case of dynamic group event, we fetch user's data and use the default event.
|
||||
if (usernameList.length > 1) {
|
||||
const users = await prisma.user.findMany({
|
||||
@@ -108,6 +129,12 @@ export const getPublicEvent = async (
|
||||
brandColor: true,
|
||||
darkBrandColor: true,
|
||||
theme: true,
|
||||
organization: {
|
||||
select: {
|
||||
slug: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -133,6 +160,8 @@ export const getPublicEvent = async (
|
||||
defaultLayout: BookerLayouts.MONTH_VIEW,
|
||||
} as BookerLayoutSettings;
|
||||
const disableBookingTitle = !defaultEvent.isDynamic;
|
||||
const unPublishedOrgUser = users.find((user) => user.organization?.slug === null);
|
||||
|
||||
return {
|
||||
...defaultEvent,
|
||||
bookingFields: getBookingFieldsWithSystemFields({ ...defaultEvent, disableBookingTitle }),
|
||||
@@ -151,13 +180,18 @@ export const getPublicEvent = async (
|
||||
firstUsersMetadata?.defaultBookerLayouts || defaultEventBookerLayouts
|
||||
),
|
||||
},
|
||||
entity: {
|
||||
isUnpublished: unPublishedOrgUser !== undefined,
|
||||
orgSlug: org,
|
||||
name: unPublishedOrgUser?.organization?.name ?? null,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const usersOrTeamQuery = isTeamEvent
|
||||
? {
|
||||
team: {
|
||||
slug: username,
|
||||
...getSlugOrRequestedSlug(username),
|
||||
parent: orgQuery,
|
||||
},
|
||||
}
|
||||
@@ -183,6 +217,7 @@ export const getPublicEvent = async (
|
||||
if (!event) return null;
|
||||
|
||||
const eventMetaData = EventTypeMetaDataSchema.parse(event.metadata || {});
|
||||
const teamMetadata = teamMetadataSchema.parse(event.team?.metadata || {});
|
||||
|
||||
const users = getUsersFromEvent(event) || (await getOwnerFromUsersArray(prisma, event.id));
|
||||
if (users === null) {
|
||||
@@ -201,7 +236,15 @@ export const getPublicEvent = async (
|
||||
// Sets user data on profile object for easier access
|
||||
profile: getProfileFromEvent(event),
|
||||
users,
|
||||
orgDomain: org,
|
||||
entity: {
|
||||
isUnpublished:
|
||||
event.team?.slug === null ||
|
||||
event.owner?.organization?.slug === null ||
|
||||
event.team?.parent?.slug === null,
|
||||
orgSlug: org,
|
||||
teamSlug: (event.team?.slug || teamMetadata?.requestedSlug) ?? null,
|
||||
name: (event.owner?.organization?.name || event.team?.parent?.name || event.team?.name) ?? null,
|
||||
},
|
||||
isDynamic: false,
|
||||
};
|
||||
};
|
||||
@@ -218,20 +261,6 @@ function getProfileFromEvent(event: Event) {
|
||||
if (!profile) throw new Error("Event has no owner");
|
||||
|
||||
const username = "username" in profile ? profile.username : team?.slug;
|
||||
if (!username) {
|
||||
if (event.slug === "test") {
|
||||
// @TODO: This is a temporary debug statement that should be removed asap.
|
||||
throw new Error(
|
||||
"Ciaran event error" +
|
||||
JSON.stringify(team) +
|
||||
" -- " +
|
||||
JSON.stringify(hosts) +
|
||||
" -- " +
|
||||
JSON.stringify(owner)
|
||||
);
|
||||
}
|
||||
throw new Error("Event has no username/team slug");
|
||||
}
|
||||
const weekStart = hosts?.[0]?.user?.weekStart || owner?.weekStart || "Monday";
|
||||
const basePath = team ? `/team/${username}` : `/${username}`;
|
||||
const eventMetaData = EventTypeMetaDataSchema.parse(event.metadata || {});
|
||||
|
||||
@@ -26,7 +26,7 @@ describe("Org Domains Utils", () => {
|
||||
it("should return a non valid org domain", () => {
|
||||
setupEnvs();
|
||||
expect(orgDomainConfig("app.cal.com")).toEqual({
|
||||
currentOrgDomain: "app",
|
||||
currentOrgDomain: null,
|
||||
isValidOrgDomain: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
import { getSlugOrRequestedSlug } from "@calcom/ee/organizations/lib/orgDomains";
|
||||
import prisma, { baseEventTypeSelect } from "@calcom/prisma";
|
||||
import { SchedulingType } from "@calcom/prisma/enums";
|
||||
import { EventTypeMetaDataSchema, teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
@@ -8,7 +9,13 @@ import { WEBAPP_URL } from "../../../constants";
|
||||
|
||||
export type TeamWithMembers = Awaited<ReturnType<typeof getTeamWithMembers>>;
|
||||
|
||||
export async function getTeamWithMembers(id?: number, slug?: string, userId?: number) {
|
||||
export async function getTeamWithMembers(args: {
|
||||
id?: number;
|
||||
slug?: string;
|
||||
userId?: number;
|
||||
orgSlug?: string | null;
|
||||
}) {
|
||||
const { id, slug, userId, orgSlug } = args;
|
||||
const userSelect = Prisma.validator<Prisma.UserSelect>()({
|
||||
username: true,
|
||||
email: true,
|
||||
@@ -92,6 +99,11 @@ export async function getTeamWithMembers(id?: number, slug?: string, userId?: nu
|
||||
const where: Prisma.TeamFindFirstArgs["where"] = {};
|
||||
|
||||
if (userId) where.members = { some: { userId } };
|
||||
if (orgSlug) {
|
||||
where.parent = getSlugOrRequestedSlug(orgSlug);
|
||||
} else {
|
||||
where.parentId = null;
|
||||
}
|
||||
if (id) where.id = id;
|
||||
if (slug) where.slug = slug;
|
||||
|
||||
|
||||
+45
-29
@@ -1,5 +1,6 @@
|
||||
import type { Prisma, UserPermissionRole } from "@prisma/client";
|
||||
import { uuid } from "short-uuid";
|
||||
import type z from "zod";
|
||||
|
||||
import dailyMeta from "@calcom/app-store/dailyvideo/_metadata";
|
||||
import googleMeetMeta from "@calcom/app-store/googlevideo/_metadata";
|
||||
@@ -11,8 +12,12 @@ import { BookingStatus, MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
import prisma from ".";
|
||||
import mainAppStore from "./seed-app-store";
|
||||
import type { teamMetadataSchema } from "./zod-utils";
|
||||
|
||||
async function createUserAndEventType(opts: {
|
||||
async function createUserAndEventType({
|
||||
user,
|
||||
eventTypes = [],
|
||||
}: {
|
||||
user: {
|
||||
email: string;
|
||||
password: string;
|
||||
@@ -23,20 +28,20 @@ async function createUserAndEventType(opts: {
|
||||
role?: UserPermissionRole;
|
||||
theme?: "dark" | "light";
|
||||
};
|
||||
eventTypes: Array<
|
||||
Prisma.EventTypeCreateInput & {
|
||||
eventTypes?: Array<
|
||||
Prisma.EventTypeUncheckedCreateInput & {
|
||||
_bookings?: Prisma.BookingCreateInput[];
|
||||
}
|
||||
>;
|
||||
}) {
|
||||
const userData = {
|
||||
...opts.user,
|
||||
password: await hashPassword(opts.user.password),
|
||||
...user,
|
||||
password: await hashPassword(user.password),
|
||||
emailVerified: new Date(),
|
||||
completedOnboarding: opts.user.completedOnboarding ?? true,
|
||||
completedOnboarding: user.completedOnboarding ?? true,
|
||||
locale: "en",
|
||||
schedules:
|
||||
opts.user.completedOnboarding ?? true
|
||||
user.completedOnboarding ?? true
|
||||
? {
|
||||
create: {
|
||||
name: "Working Hours",
|
||||
@@ -50,20 +55,20 @@ async function createUserAndEventType(opts: {
|
||||
: undefined,
|
||||
};
|
||||
|
||||
const user = await prisma.user.upsert({
|
||||
where: { email_username: { email: opts.user.email, username: opts.user.username } },
|
||||
const theUser = await prisma.user.upsert({
|
||||
where: { email_username: { email: user.email, username: user.username } },
|
||||
update: userData,
|
||||
create: userData,
|
||||
});
|
||||
|
||||
console.log(
|
||||
`👤 Upserted '${opts.user.username}' with email "${opts.user.email}" & password "${opts.user.password}". Booking page 👉 ${process.env.NEXT_PUBLIC_WEBAPP_URL}/${opts.user.username}`
|
||||
`👤 Upserted '${user.username}' with email "${user.email}" & password "${user.password}". Booking page 👉 ${process.env.NEXT_PUBLIC_WEBAPP_URL}/${user.username}`
|
||||
);
|
||||
|
||||
for (const eventTypeInput of opts.eventTypes) {
|
||||
for (const eventTypeInput of eventTypes) {
|
||||
const { _bookings: bookingFields = [], ...eventTypeData } = eventTypeInput;
|
||||
eventTypeData.userId = user.id;
|
||||
eventTypeData.users = { connect: { id: user.id } };
|
||||
eventTypeData.userId = theUser.id;
|
||||
eventTypeData.users = { connect: { id: theUser.id } };
|
||||
|
||||
const eventType = await prisma.eventType.findFirst({
|
||||
where: {
|
||||
@@ -98,13 +103,13 @@ async function createUserAndEventType(opts: {
|
||||
...bookingInput,
|
||||
user: {
|
||||
connect: {
|
||||
email: opts.user.email,
|
||||
email: user.email,
|
||||
},
|
||||
},
|
||||
attendees: {
|
||||
create: {
|
||||
email: opts.user.email,
|
||||
name: opts.user.name,
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
timeZone: "Europe/London",
|
||||
},
|
||||
},
|
||||
@@ -124,15 +129,32 @@ async function createUserAndEventType(opts: {
|
||||
}
|
||||
}
|
||||
|
||||
return user;
|
||||
return theUser;
|
||||
}
|
||||
|
||||
async function createTeamAndAddUsers(
|
||||
teamInput: Prisma.TeamCreateInput,
|
||||
users: { id: number; username: string; role?: MembershipRole }[]
|
||||
users: { id: number; username: string; role?: MembershipRole }[] = []
|
||||
) {
|
||||
const checkUnpublishedTeam = async (slug: string) => {
|
||||
return await prisma.team.findFirst({
|
||||
where: {
|
||||
metadata: {
|
||||
path: ["requestedSlug"],
|
||||
equals: slug,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
const createTeam = async (team: Prisma.TeamCreateInput) => {
|
||||
try {
|
||||
const requestedSlug = (team.metadata as z.infer<typeof teamMetadataSchema>)?.requestedSlug;
|
||||
if (requestedSlug) {
|
||||
const unpublishedTeam = await checkUnpublishedTeam(requestedSlug);
|
||||
if (unpublishedTeam) {
|
||||
throw Error("Unique constraint failed on the fields");
|
||||
}
|
||||
}
|
||||
return await prisma.team.create({
|
||||
data: {
|
||||
...team,
|
||||
@@ -168,6 +190,8 @@ async function createTeamAndAddUsers(
|
||||
});
|
||||
console.log(`\t👤 Added '${teamInput.name}' membership for '${username}' with role '${role}'`);
|
||||
}
|
||||
|
||||
return team;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
@@ -178,7 +202,6 @@ async function main() {
|
||||
username: "delete-me",
|
||||
name: "delete-me",
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
await createUserAndEventType({
|
||||
@@ -189,7 +212,6 @@ async function main() {
|
||||
name: "onboarding",
|
||||
completedOnboarding: false,
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
await createUserAndEventType({
|
||||
@@ -279,19 +301,19 @@ async function main() {
|
||||
title: "Zoom Event",
|
||||
slug: "zoom",
|
||||
length: 60,
|
||||
locations: [{ type: zoomMeta.appData?.location.type }],
|
||||
locations: [{ type: zoomMeta.appData?.location?.type }],
|
||||
},
|
||||
{
|
||||
title: "Daily Event",
|
||||
slug: "daily",
|
||||
length: 60,
|
||||
locations: [{ type: dailyMeta.appData?.location.type }],
|
||||
locations: [{ type: dailyMeta.appData?.location?.type }],
|
||||
},
|
||||
{
|
||||
title: "Google Meet",
|
||||
slug: "google-meet",
|
||||
length: 60,
|
||||
locations: [{ type: googleMeetMeta.appData?.location.type }],
|
||||
locations: [{ type: googleMeetMeta.appData?.location?.type }],
|
||||
},
|
||||
{
|
||||
title: "Yoga class",
|
||||
@@ -503,7 +525,6 @@ async function main() {
|
||||
username: "teamfree",
|
||||
name: "Team Free Example",
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
const proUserTeam = await createUserAndEventType({
|
||||
@@ -513,7 +534,6 @@ async function main() {
|
||||
username: "teampro",
|
||||
name: "Team Pro Example",
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
await createUserAndEventType({
|
||||
@@ -525,7 +545,6 @@ async function main() {
|
||||
name: "Admin Example",
|
||||
role: "ADMIN",
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
const pro2UserTeam = await createUserAndEventType({
|
||||
@@ -535,7 +554,6 @@ async function main() {
|
||||
username: "teampro2",
|
||||
name: "Team Pro Example 2",
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
const pro3UserTeam = await createUserAndEventType({
|
||||
@@ -545,7 +563,6 @@ async function main() {
|
||||
username: "teampro3",
|
||||
name: "Team Pro Example 3",
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
const pro4UserTeam = await createUserAndEventType({
|
||||
@@ -555,7 +572,6 @@ async function main() {
|
||||
username: "teampro4",
|
||||
name: "Team Pro Example 4",
|
||||
},
|
||||
eventTypes: [],
|
||||
});
|
||||
|
||||
await createTeamAndAddUsers(
|
||||
|
||||
@@ -28,7 +28,7 @@ export const createHandler = async ({ ctx, input }: CreateOptions) => {
|
||||
where: {
|
||||
slug: slug,
|
||||
// If this is under an org, check that the team doesn't already exist
|
||||
...(isOrgChildTeam && { parentId: user.organizationId }),
|
||||
parentId: isOrgChildTeam ? user.organizationId : null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type GetOptions = {
|
||||
};
|
||||
|
||||
export const getHandler = async ({ ctx, input }: GetOptions) => {
|
||||
const team = await getTeamWithMembers(input.teamId, undefined, ctx.user.id);
|
||||
const team = await getTeamWithMembers({ id: input.teamId, userId: ctx.user.id });
|
||||
|
||||
if (!team) {
|
||||
throw new TRPCError({ code: "NOT_FOUND", message: "Team not found." });
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { EmptyScreen, Avatar } from "@calcom/ui";
|
||||
|
||||
export type UnpublishedEntityProps = {
|
||||
teamSlug?: string | null;
|
||||
orgSlug?: string | null;
|
||||
name?: string | null;
|
||||
};
|
||||
|
||||
export function UnpublishedEntity(props: UnpublishedEntityProps) {
|
||||
const { t } = useLocale();
|
||||
const slug = props.orgSlug || props.teamSlug;
|
||||
return (
|
||||
<div className="m-8 flex items-center justify-center">
|
||||
<EmptyScreen
|
||||
avatar={<Avatar alt={slug ?? ""} imageSrc={`/team/${slug}/avatar.png`} size="lg" />}
|
||||
headline={t("team_is_unpublished", {
|
||||
team: props.name,
|
||||
})}
|
||||
description={t("team_is_unpublished_description", {
|
||||
entity: props.orgSlug ? t("organization").toLowerCase() : t("team").toLowerCase(),
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export { UnpublishedEntity } from "./UnpublishedEntity";
|
||||
export type { UnpublishedEntityProps } from "./UnpublishedEntity";
|
||||
@@ -83,6 +83,7 @@ export type { AlertProps } from "./components/alert";
|
||||
export { Credits } from "./components/credits";
|
||||
export { Divider, VerticalDivider } from "./components/divider";
|
||||
export { EmptyScreen } from "./components/empty-screen";
|
||||
export { UnpublishedEntity } from "./components/unpublished-entity";
|
||||
export { List, ListItem, ListItemText, ListItemTitle, ListLinkItem } from "./components/list";
|
||||
export type { ListItemProps, ListProps } from "./components/list";
|
||||
export { HeadSeo } from "./components/head-seo";
|
||||
|
||||
Reference in new issue
Block a user