Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added apps/desktop2/public/assets/teams.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export function SessionMetadata({
title: eventRow.title ?? "Untitled Event",
started_at: eventRow.started_at,
ended_at: eventRow.ended_at,
location: null, // TODO: Add location field to event schema
meeting_link: null, // TODO: Add meeting_link field to event schema
description: null, // TODO: Add description field to event schema
location: (eventRow.location as string | undefined) ?? null,
meeting_link: (eventRow.meeting_link as string | undefined) ?? null,
description: (eventRow.description as string | undefined) ?? null,
participants,
};
}, [sessionRow.event_id, eventRow, store, participantMappingIds]);
Expand Down
10 changes: 10 additions & 0 deletions apps/desktop2/src/devtool/seed/empty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Store as PersistedStore } from "../../store/tinybase/persisted";
import type { SeedDefinition } from "./shared";

export const emptySeed: SeedDefinition = {
id: "empty",
label: "Empty State",
run: (store: PersistedStore) => {
store.delTables();
},
};
3 changes: 2 additions & 1 deletion apps/desktop2/src/devtool/seed/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { emptySeed } from "./empty";
import type { SeedDefinition } from "./shared";
import { v1Seed } from "./v1";

export { type SeedDefinition } from "./shared";

export const seeds: SeedDefinition[] = [v1Seed];
export const seeds: SeedDefinition[] = [emptySeed, v1Seed];
103 changes: 69 additions & 34 deletions apps/desktop2/src/devtool/seed/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,53 +273,40 @@ export const createChatMessage = (

export const createEvent = (calendar_id: string) => {
const timePattern = faker.helpers.weightedArrayElement([
{ weight: 10, value: "past-recent" },
{ weight: 5, value: "past-older" },
{ weight: 15, value: "imminent" },
{ weight: 25, value: "today-tomorrow" },
{ weight: 20, value: "this-week" },
{ weight: 15, value: "next-few-weeks" },
{ weight: 10, value: "distant" },
{ weight: 5, value: "last-year" },
{ weight: 15, value: "past-two-weeks" },
{ weight: 10, value: "today" },
{ weight: 15, value: "next-few-days" },
{ weight: 15, value: "next-two-weeks" },
]);

let startsAt: Date;
const now = faker.defaultRefDate();

switch (timePattern) {
case "past-recent":
const daysAgo = faker.number.int({ min: 1, max: 7 });
startsAt = new Date(now.getTime() - daysAgo * 24 * 60 * 60 * 1000);
case "last-year":
const daysLastYear = faker.number.int({ min: 180, max: 365 });
startsAt = new Date(now.getTime() - daysLastYear * 24 * 60 * 60 * 1000);
break;

case "past-older":
const weeksAgo = faker.number.int({ min: 1, max: 4 });
startsAt = new Date(now.getTime() - weeksAgo * 7 * 24 * 60 * 60 * 1000);
case "past-two-weeks":
const daysPast = faker.number.int({ min: 1, max: 14 });
startsAt = new Date(now.getTime() - daysPast * 24 * 60 * 60 * 1000);
break;

case "imminent":
const minutes = faker.helpers.arrayElement([5, 10, 15, 30, 45, 60, 90, 120]);
startsAt = new Date(now.getTime() + minutes * 60 * 1000);
case "today":
const hoursToday = faker.number.float({ min: -12, max: 12, fractionDigits: 1 });
startsAt = new Date(now.getTime() + hoursToday * 60 * 60 * 1000);
break;

case "today-tomorrow":
const hoursAhead = faker.number.float({ min: 0.5, max: 36, fractionDigits: 1 });
startsAt = new Date(now.getTime() + hoursAhead * 60 * 60 * 1000);
case "next-few-days":
const daysNext = faker.number.int({ min: 1, max: 7 });
startsAt = new Date(now.getTime() + daysNext * 24 * 60 * 60 * 1000);
break;

case "this-week":
const daysAhead = faker.number.int({ min: 2, max: 7 });
startsAt = new Date(now.getTime() + daysAhead * 24 * 60 * 60 * 1000);
break;

case "next-few-weeks":
const weeksAhead = faker.number.int({ min: 1, max: 3 });
const extraDays = faker.number.int({ min: 0, max: 6 });
startsAt = new Date(now.getTime() + (weeksAhead * 7 + extraDays) * 24 * 60 * 60 * 1000);
break;

case "distant":
const monthsAhead = faker.number.float({ min: 1, max: 3, fractionDigits: 1 });
startsAt = new Date(now.getTime() + monthsAhead * 30 * 24 * 60 * 60 * 1000);
case "next-two-weeks":
const daysLater = faker.number.int({ min: 8, max: 14 });
startsAt = new Date(now.getTime() + daysLater * 24 * 60 * 60 * 1000);
break;

default:
Expand All @@ -329,6 +316,51 @@ export const createEvent = (calendar_id: string) => {
const durationHours = faker.number.float({ min: 0.25, max: 4, fractionDigits: 2 });
const endsAt = new Date(startsAt.getTime() + durationHours * 60 * 60 * 1000);

const meetingType = faker.helpers.weightedArrayElement([
{ weight: 50, value: "online" },
{ weight: 30, value: "offline" },
{ weight: 20, value: "hybrid" },
]);

const videoProviders = [
{ domain: "zoom.us", name: "Zoom" },
{ domain: "meet.google.com", name: "Google Meet" },
{ domain: "teams.microsoft.com", name: "Microsoft Teams" },
{ domain: "whereby.com", name: "Whereby" },
{ domain: "around.co", name: "Around" },
];

const locations = [
"Conference Room A",
"Conference Room B",
"Main Office - 3rd Floor",
"Starbucks Downtown",
"WeWork Coworking Space",
"Client Office",
"HQ Building 2",
"Meeting Room Delta",
"Cafeteria",
"Rooftop Lounge",
];

let meeting_link: string | undefined;
let location: string | undefined;
let description: string | undefined;

if (meetingType === "online" || meetingType === "hybrid") {
const provider = faker.helpers.arrayElement(videoProviders);
const meetingId = faker.string.alphanumeric(10);
meeting_link = `https://${provider.domain}/${meetingId}`;
}

if (meetingType === "offline" || meetingType === "hybrid") {
location = faker.helpers.arrayElement(locations);
}

if (faker.datatype.boolean({ probability: 0.7 })) {
description = faker.lorem.sentences(faker.number.int({ min: 1, max: 3 }));
}

return {
id: id(),
data: {
Expand All @@ -338,6 +370,9 @@ export const createEvent = (calendar_id: string) => {
started_at: startsAt.toISOString(),
ended_at: endsAt.toISOString(),
created_at: faker.date.recent({ days: 30 }).toISOString(),
location,
meeting_link,
description,
} satisfies Event,
};
};
Expand Down Expand Up @@ -449,7 +484,7 @@ export const generateMockData = (config: MockConfig) => {
);

Array.from({ length: sessionCount }, () => {
const shouldLinkToEvent = endedEvents.length > 0 && faker.datatype.boolean({ probability: 0.5 });
const shouldLinkToEvent = endedEvents.length > 0 && faker.datatype.boolean({ probability: 0.6 });
const shouldAddToFolder = allFolderIds.length > 0 && faker.datatype.boolean({ probability: 0.6 });

const eventId = shouldLinkToEvent ? faker.helpers.arrayElement(endedEvents).id : undefined;
Expand Down
1 change: 1 addition & 0 deletions apps/desktop2/src/devtool/seed/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const v1Seed: SeedDefinition = {
id: "v1",
label: "Seed V1",
run: (store: PersistedStore) => {
store.delTables();
store.setTables(V1);
},
};
6 changes: 6 additions & 0 deletions apps/desktop2/src/store/tinybase/persisted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const eventSchema = baseEventSchema.omit({ id: true }).extend({
created_at: z.string(),
started_at: z.string(),
ended_at: z.string(),
location: z.preprocess(val => val ?? undefined, z.string().optional()),
meeting_link: z.preprocess(val => val ?? undefined, z.string().optional()),
description: z.preprocess(val => val ?? undefined, z.string().optional()),
});

export const calendarSchema = baseCalendarSchema.omit({ id: true }).extend({ created_at: z.string() });
Expand Down Expand Up @@ -158,6 +161,9 @@ const SCHEMA = {
title: { type: "string" },
started_at: { type: "string" },
ended_at: { type: "string" },
location: { type: "string" },
meeting_link: { type: "string" },
description: { type: "string" },
} satisfies InferTinyBaseSchema<typeof eventSchema>,
mapping_session_participant: {
user_id: { type: "string" },
Expand Down
3 changes: 3 additions & 0 deletions packages/db/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export const events = pgTable(TABLE_EVENTS, {
title: text("title").notNull(),
started_at: timestamp("started_at").notNull(),
ended_at: timestamp("ended_at").notNull(),
location: text("location"),
meeting_link: text("meeting_link"),
description: text("description"),
});

export const TABLE_CALENDARS = "calendars";
Expand Down
28 changes: 28 additions & 0 deletions packages/ui/src/components/ui/kbd.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { cn } from "@hypr/ui/lib/utils";

function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
return (
<kbd
data-slot="kbd"
className={cn(
"bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium",
"[&_svg:not([class*='size-'])]:size-3",
"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
className,
)}
{...props}
/>
);
}

function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
return (
<kbd
data-slot="kbd-group"
className={cn("inline-flex items-center gap-1", className)}
{...props}
/>
);
}

export { Kbd, KbdGroup };
Loading