Skip to content

Commit 87d2b64

Browse files
coderabbit
1 parent 0f9bf07 commit 87d2b64

File tree

11 files changed

+54
-27
lines changed

11 files changed

+54
-27
lines changed

apps/desktop/src/components/main/body/calendars/calendar-day.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function TabContentCalendarDay({
1717
day: string;
1818
isCurrentMonth: boolean;
1919
isFirstColumn: boolean;
20-
isLastColumn: boolean;
2120
isLastRow: boolean;
2221
selectedCalendars: Set<string>;
2322
}) {

apps/desktop/src/components/main/body/calendars/day-events.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export function TabContentCalendarDayEvents({ eventId }: { eventId: string }) {
1313
const [open, setOpen] = useState(false);
1414
const { openNew } = useTabs();
1515

16+
const title = event?.title || "Untitled Event";
17+
1618
const sessionIds = persisted.UI.useSliceRowIds(
1719
persisted.INDEXES.sessionsByEvent,
1820
eventId,
@@ -32,7 +34,7 @@ export function TabContentCalendarDayEvents({ eventId }: { eventId: string }) {
3234
};
3335

3436
const formatEventTime = () => {
35-
if (!event.started_at || !event.ended_at) {
37+
if (!event || !event.started_at || !event.ended_at) {
3638
return "";
3739
}
3840
const start = new Date(event.started_at);
@@ -57,13 +59,13 @@ export function TabContentCalendarDayEvents({ eventId }: { eventId: string }) {
5759
["w-full justify-start px-1 text-neutral-600 h-6", open && "bg-neutral-100 hover:bg-neutral-100"],
5860
)}
5961
>
60-
<Calendar className="text-pink-600" />
61-
<p className="truncate">{event.title}</p>
62+
<Calendar size={12} className="text-pink-600" />
63+
<p className="truncate">{title}</p>
6264
</Button>
6365
</PopoverTrigger>
6466
<PopoverContent className="w-72 p-4 bg-white border-neutral-200 m-2 shadow-lg outline-none focus:outline-none focus:ring-0">
6567
<div className="font-semibold text-lg text-neutral-800 mb-2">
66-
{event.title || "Untitled Event"}
68+
{title}
6769
</div>
6870

6971
<p className="text-sm text-neutral-600 mb-4">

apps/desktop/src/components/main/body/calendars/day-sessions.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ export function TabContentCalendarDaySessions({ sessionId }: { sessionId: string
99
const session = persisted.UI.useRow("sessions", sessionId, persisted.STORE_ID);
1010
const { openNew } = useTabs();
1111

12-
const event = persisted.UI.useRow("events", session.event_id || "dummy", persisted.STORE_ID);
12+
const eventId = session?.event_id ?? "";
13+
const event = persisted.UI.useRow("events", eventId, persisted.STORE_ID);
1314

1415
const handleClick = () => {
1516
openNew({ type: "sessions", id: sessionId, state: { editor: "raw" } });
1617
};
1718

1819
return (
1920
<Button variant="ghost" className="w-full justify-start px-1 text-neutral-600 h-6" onClick={handleClick}>
20-
<StickyNote className="text-blue-600" />
21-
<p className="truncate">{event && session.event_id ? event.title : session.title || "Untitled"}</p>
21+
<StickyNote size={12} className="text-blue-600" />
22+
<p className="truncate">{event && eventId ? event.title : session?.title || "Untitled"}</p>
2223
</Button>
2324
);
2425
}

apps/desktop/src/components/main/body/calendars/tab-content-calendar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function TabContentCalendar({ tab }: { tab: Tab }) {
2525
if (tab.type !== "calendars") {
2626
return null;
2727
}
28+
return <TabContentCalendarInner tab={tab} />;
29+
}
2830

31+
function TabContentCalendarInner({ tab }: { tab: Extract<Tab, { type: "calendars" }> }) {
2932
const [sidebarOpen, setSidebarOpen] = useState(false);
3033

3134
const { openCurrent } = useTabs();
@@ -159,7 +162,6 @@ export function TabContentCalendar({ tab }: { tab: Tab }) {
159162
day={day}
160163
isCurrentMonth={isSameMonth(new Date(day), tab.month)}
161164
isFirstColumn={dayIndex === 0}
162-
isLastColumn={dayIndex === 6}
163165
isLastRow={weekIndex === 5}
164166
selectedCalendars={selectedCalendars}
165167
/>

apps/desktop/src/components/main/body/contacts/organization-details.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function OrganizationDetailsColumn({
4242
<div className="flex-1">
4343
<EditableOrganizationNameField organizationId={selectedOrganizationId} />
4444
<p className="text-sm text-neutral-500 mt-1">
45-
{peopleInOrg.length} {peopleInOrg.length === 1 ? "person" : "people"}
45+
{peopleInOrg?.length ?? 0} {(peopleInOrg?.length ?? 0) === 1 ? "person" : "people"}
4646
</p>
4747
</div>
4848
</div>
@@ -54,7 +54,7 @@ export function OrganizationDetailsColumn({
5454
<div className="p-6">
5555
<h3 className="text-sm font-medium text-neutral-600 mb-4">People</h3>
5656
<div className="overflow-y-auto" style={{ maxHeight: "55vh" }}>
57-
{peopleInOrg.length > 0
57+
{(peopleInOrg?.length ?? 0) > 0
5858
? (
5959
<div className="grid grid-cols-3 gap-4">
6060
{peopleInOrg.map((humanId: string) => {
@@ -90,7 +90,10 @@ export function OrganizationDetailsColumn({
9090
<Button
9191
variant="ghost"
9292
size="icon"
93-
onClick={() => openUrl(`mailto:${human.email}`)}
93+
onClick={(e) => {
94+
e.stopPropagation();
95+
openUrl(`mailto:${human.email}`);
96+
}}
9497
title="Send email"
9598
>
9699
<Mail />
@@ -100,7 +103,14 @@ export function OrganizationDetailsColumn({
100103
<Button
101104
variant="ghost"
102105
size="icon"
103-
onClick={() => openUrl(human.linkedin_username as string)}
106+
onClick={(e) => {
107+
e.stopPropagation();
108+
const v = String(human.linkedin_username ?? "");
109+
const href = /^https?:\/\//i.test(v)
110+
? v
111+
: `https://www.linkedin.com/in/${v.replace(/^@/, "")}`;
112+
void openUrl(href);
113+
}}
104114
title="View LinkedIn profile"
105115
>
106116
<Icon icon="logos:linkedin-icon" />

apps/desktop/src/components/main/body/sessions/outer-header/metadata/date.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { formatDate, isSameDay } from "@hypr/utils";
33
import { useMeetingMetadata } from "./shared";
44

55
export function MeetingDate({ sessionId }: { sessionId: string }) {
6-
const meta = useMeetingMetadata(sessionId)!;
6+
const meta = useMeetingMetadata(sessionId);
7+
8+
if (!meta?.started_at && !meta?.ended_at) {
9+
return null;
10+
}
711

812
return (
913
<p className="text-sm text-neutral-700">

apps/desktop/src/components/main/body/sessions/outer-header/metadata/description.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useMeetingMetadata } from "./shared";
22

33
export function MeetingDescription({ sessionId }: { sessionId: string }) {
4-
const meta = useMeetingMetadata(sessionId)!;
4+
const meta = useMeetingMetadata(sessionId);
55

6-
if (!meta.description) {
6+
if (!meta?.description) {
77
return null;
88
}
99

apps/desktop/src/components/main/body/sessions/outer-header/metadata/link.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ import { useCallback } from "react";
1313
import { useMeetingMetadata } from "./shared";
1414

1515
export function MeetingLink({ sessionId }: { sessionId: string }) {
16-
const meta = useMeetingMetadata(sessionId)!;
16+
const meta = useMeetingMetadata(sessionId);
1717

1818
const handleCopyLink = useCallback(() => {
19-
if (meta.meeting_link) {
19+
if (meta?.meeting_link) {
2020
navigator.clipboard.writeText(meta.meeting_link);
2121
}
22-
}, [meta.meeting_link]);
22+
}, [meta?.meeting_link]);
23+
24+
if (!meta?.meeting_link) {
25+
return null;
26+
}
2327

2428
return (
2529
<div className="flex items-center justify-between gap-2 -ml-2.5">

apps/desktop/src/components/main/body/sessions/outer-header/metadata/location.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { MapPinIcon } from "lucide-react";
33
import { useMeetingMetadata } from "./shared";
44

55
export function MeetingLocation({ sessionId }: { sessionId: string }) {
6-
const meta = useMeetingMetadata(sessionId)!;
6+
const meta = useMeetingMetadata(sessionId);
77

8-
if (!meta.location) {
8+
if (!meta?.location) {
99
return null;
1010
}
1111

apps/desktop/src/components/main/body/sessions/outer-header/overflow.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FileTextIcon, FolderIcon, Link2Icon, MicIcon, MicOffIcon, MoreHorizontalIcon, TrashIcon } from "lucide-react";
2+
import { useState } from "react";
23

34
import { Button } from "@hypr/ui/components/ui/button";
45
import {
@@ -15,16 +16,18 @@ import { useStartListening } from "../../../../../hooks/useStartListening";
1516
import { SearchableFolderSubmenuContent } from "./shared/folder";
1617

1718
export function OverflowButton({ sessionId }: { sessionId: string }) {
19+
const [open, setOpen] = useState(false);
20+
1821
return (
19-
<DropdownMenu>
22+
<DropdownMenu open={open} onOpenChange={setOpen}>
2023
<DropdownMenuTrigger asChild>
2124
<Button size="icon" variant="ghost">
2225
<MoreHorizontalIcon size={16} />
2326
</Button>
2427
</DropdownMenuTrigger>
2528
<DropdownMenuContent align="end" className="w-56">
2629
<Copy />
27-
<Folder sessionId={sessionId} />
30+
<Folder sessionId={sessionId} setOpen={setOpen} />
2831
<ExportPDF />
2932
<DropdownMenuSeparator />
3033
<Listening sessionId={sessionId} />
@@ -50,14 +53,14 @@ function Copy() {
5053
);
5154
}
5255

53-
function Folder({ sessionId }: { sessionId: string }) {
56+
function Folder({ sessionId, setOpen }: { sessionId: string; setOpen?: (open: boolean) => void }) {
5457
return (
5558
<DropdownMenuSub>
5659
<DropdownMenuSubTrigger className="cursor-pointer">
5760
<FolderIcon />
5861
<span>Move to</span>
5962
</DropdownMenuSubTrigger>
60-
<SearchableFolderSubmenuContent sessionId={sessionId} />
63+
<SearchableFolderSubmenuContent sessionId={sessionId} setOpen={setOpen} />
6164
</DropdownMenuSub>
6265
);
6366
}

0 commit comments

Comments
 (0)