feat: use cal video as the default location (#6643)
* feat: use cal video as default while creating new events * feat: use cal video as default value * chore: remove default value * fix: default value logic * chore: remove console.log
This commit is contained in:
@@ -139,11 +139,13 @@ export const EventSetupTab = (
|
||||
return true;
|
||||
});
|
||||
|
||||
const defaultValue = locationOptions.find((item) => item.label === "video")?.options;
|
||||
return (
|
||||
<div className="w-full">
|
||||
{validLocations.length === 0 && (
|
||||
<div className="flex">
|
||||
<LocationSelect
|
||||
defaultValue={defaultValue}
|
||||
placeholder={t("select")}
|
||||
options={locationOptions}
|
||||
isSearchable={false}
|
||||
|
||||
@@ -404,7 +404,7 @@ export const eventTypesRouter = router({
|
||||
create: authedProcedure.input(createEventTypeInput).mutation(async ({ ctx, input }) => {
|
||||
const { schedulingType, teamId, ...rest } = input;
|
||||
const userId = ctx.user.id;
|
||||
|
||||
const appKeys = await getAppKeysFromSlug("daily-video");
|
||||
const data: Prisma.EventTypeCreateInput = {
|
||||
...rest,
|
||||
owner: teamId ? undefined : { connect: { id: userId } },
|
||||
@@ -413,14 +413,10 @@ export const eventTypesRouter = router({
|
||||
id: userId,
|
||||
},
|
||||
},
|
||||
...((typeof rest?.locations === "undefined" || rest.locations?.length === 0) &&
|
||||
typeof appKeys.api_key === "string" && { locations: [{ type: DailyLocationType }] }),
|
||||
};
|
||||
|
||||
const appKeys = await getAppKeysFromSlug("daily-video");
|
||||
// Shouldn't override input locations
|
||||
if (rest.locations?.length === 0 && typeof appKeys.api_key === "string") {
|
||||
data.locations = [{ type: DailyLocationType }];
|
||||
}
|
||||
|
||||
if (teamId && schedulingType) {
|
||||
const hasMembership = await ctx.prisma.membership.findFirst({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user