* Fixing slack create event * Fixes verify working 90% of the time :S * Verify V2 * Fixing verify - not needed on interaction payload * Fixing verifcation + response * Fix verifcation * DM user error/success * Remove random 200 * Timeout return * Adding Zod schema verification * Added validations, cleanup * Type fixes * Update event.ts Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
28 lines
833 B
TypeScript
28 lines
833 B
TypeScript
import { Booking } from "@prisma/client";
|
|
import dayjs from "dayjs";
|
|
import { Blocks, Elements, Message } from "slack-block-builder";
|
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
|
|
|
const TodayMessage = (bookings: Booking[]) => {
|
|
if (bookings.length === 0) {
|
|
return Message()
|
|
.blocks(Blocks.Section({ text: "You do not have any bookings for today." }))
|
|
.asUser()
|
|
.buildToObject();
|
|
}
|
|
return Message()
|
|
.blocks(
|
|
Blocks.Section({ text: `Todays Bookings.` }),
|
|
Blocks.Divider(),
|
|
bookings.map((booking) =>
|
|
Blocks.Section({
|
|
text: `${booking.title} | ${dayjs(booking.startTime).format("HH:mm")}`,
|
|
}).accessory(Elements.Button({ text: "Cancel", url: `${WEBAPP_URL}/cancel/${booking.uid}` }))
|
|
)
|
|
)
|
|
.buildToObject();
|
|
};
|
|
|
|
export default TodayMessage;
|