Skip to content

Commit 0d95329

Browse files
Finder view merge (#1213)
* feat(windows): add new Finder window type The changes in this commit introduce a new window type called "Finder" to the `HyprWindow` type in the `bindings.gen.ts` file. This change is made to accommodate the addition of a new Finder-like functionality in the application. Additionally, the corresponding changes are made in the `routeTree.gen.ts` file to add a new route for the Finder functionality, replacing the previously existing Calendar route. * feat(table-view): Improve event navigation and session handling When a user clicks on an event row, the application now checks if there is an existing session for that event. If a session exists, the user is navigated to the corresponding note. If no session exists, a new note is created with the event ID pre-filled. This ensures that users can easily access and manage their calendar events within the application. * cleanup comments * i18n * feat(apple-calendar): Prevent duplicate event handling This commit introduces a mechanism to prevent the handling of duplicate system events during the Apple Calendar sync process. The changes focus on the following key improvements: - Tracks the I that have been handled to avoid processing them multiple times. - Skips the processing of system events that have already been handled, either as updates or rescheduled events. - Ensures that rescheduled system events are also marked as handled to prevent duplicate creation. These changes help to improve the reliability and consistency of the Apple Calendar sync functionality by avoiding the creation of duplicate events in the database. * feat(app.finder): deduplicate events by tracking_id Deduplicates events by tracking_id to handle any sync issues. Keeps the most recent event (by database id) for each tracking_id. This ensures that the event list displayed in the app is accurate and up-to-date, even if there are any issues with event synchronization. * feat(note-card): Improve note card UI and navigation The changes made in this commit focus on improving the UI and navigation functionality of the note card component in the workspace calendar. The key changes are: 1. Simplified the note card header by removing the file/document icon and using a more compact heading. 2. Improved the layout and styling of the note card content, making it more visually appealing and consistent. 3. Replaced the `safeNavigate` utility with direct calls to the `windowsCommands` module to handle navigation, ensuring a smoother user experience. These changes aim to enhance the overall user interface and interaction within the workspace calendar, providing a more polished and intuitive experience for users. * i18n * feat: Open Finder window when clicking on event or note date The changes made in this commit are focused on improving the user experience when clicking on the date of an event or note in the left sidebar. Previously, the application would open the main window, but now it will open the Finder window instead, which is more appropriate for navigating to a specific date. The changes were made in the `events-list.tsx` and `notes-list.tsx` files, where the `windowsCommands.windowShow()` and `windowsCommands.windowEmitNavigate()` functions were updated to use the "finder" type instead of the "main" type. * feat: Improve event and note card UI The changes made in this commit focus on improving the visual appearance and layout of the event and note cards in the workspace calendar. The key changes are: - Vertically center the content within the cards to create a more balanced and consistent look. - Remove the top margin from the calendar and file icons, as they were causing the content to appear misaligned. - Remove the time display from the card previews, as the full time information is already shown in the popover content. These changes help to streamline the UI and make the cards more visually appealing and easier to scan at a glance. * added contact view * commit before checkout * ran tests * commit before merge * ran tests * coderabbit --------- Co-authored-by: John Jeong <jeeheontransformers@gmail.com>
1 parent d1bab82 commit 0d95329

30 files changed

+1877
-452
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ Secrets*.toml
1313
restate-data
1414

1515
.windsurfrules
16-
.turbo
16+
.turbo
17+
18+
CLAUDE.md

apps/desktop/src/components/command-palette.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { useEffect, useRef, useState } from "react";
2323
import { useHypr } from "@/contexts/hypr";
2424
import { type SearchMatch } from "@/stores/search";
2525
import { commands as dbCommands } from "@hypr/plugin-db";
26+
import { commands as windowsCommands } from "@hypr/plugin-windows";
2627

2728
interface CommandPaletteProps {
2829
open: boolean;
@@ -281,10 +282,22 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
281282
navigate({ to: "/app/new", search: { calendarEventId: match.item.id } });
282283
break;
283284
case "human":
284-
navigate({ to: "/app/human/$id", params: { id: match.item.id } });
285+
// Open finder window and navigate to contact view with person selected
286+
windowsCommands.windowShow({ type: "finder" }).then(() => {
287+
windowsCommands.windowNavigate(
288+
{ type: "finder" },
289+
`/app/finder?view=contact&personId=${match.item.id}`,
290+
);
291+
});
285292
break;
286293
case "organization":
287-
navigate({ to: "/app/organization/$id", params: { id: match.item.id } });
294+
// Open finder window and navigate to contact view with organization selected
295+
windowsCommands.windowShow({ type: "finder" }).then(() => {
296+
windowsCommands.windowNavigate(
297+
{ type: "finder" },
298+
`/app/finder?view=contact&orgId=${match.item.id}`,
299+
);
300+
});
288301
break;
289302
}
290303
onOpenChange(false);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export { ViewSelector } from "./view-selector";
2+
export { CalendarView } from "./views/calendar-view";
3+
export { FolderView } from "./views/folder-view";
4+
export { TableView } from "./views/table-view";
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { Button } from "@hypr/ui/components/ui/button";
2+
import { cn } from "@hypr/ui/lib/utils";
3+
import { Calendar, Folder, Table, Users } from "lucide-react";
4+
5+
type ViewType = "folder" | "calendar" | "table" | "contact";
6+
7+
interface ViewSelectorProps {
8+
currentView: ViewType;
9+
onViewChange: (view: ViewType) => void;
10+
}
11+
12+
export function ViewSelector({ currentView, onViewChange }: ViewSelectorProps) {
13+
return (
14+
<div className="flex items-center gap-1 bg-neutral-100 rounded-md">
15+
<Button
16+
variant={currentView === "folder" ? "default" : "ghost"}
17+
size="sm"
18+
className={cn(
19+
"h-8 transition-all",
20+
currentView === "folder" ? "px-1.5 py-1 min-w-[70px]" : "w-8 px-0 py-0",
21+
)}
22+
onClick={() => onViewChange("folder")}
23+
>
24+
<Folder size={14} />
25+
{currentView === "folder" && "Folder"}
26+
</Button>
27+
28+
<Button
29+
variant={currentView === "calendar" ? "default" : "ghost"}
30+
size="sm"
31+
className={cn(
32+
"h-8 transition-all",
33+
currentView === "calendar" ? "px-1.5 py-1 min-w-[95px]" : "w-8 px-0 py-0",
34+
)}
35+
onClick={() => onViewChange("calendar")}
36+
>
37+
<Calendar size={14} />
38+
{currentView === "calendar" && "Calendar"}
39+
</Button>
40+
41+
<Button
42+
variant={currentView === "table" ? "default" : "ghost"}
43+
size="sm"
44+
className={cn(
45+
"h-8 transition-all",
46+
currentView === "table" ? "px-1.5 py-1 min-w-[70px]" : "w-8 px-0 py-0",
47+
)}
48+
onClick={() => onViewChange("table")}
49+
>
50+
<Table size={14} />
51+
{currentView === "table" && "Table"}
52+
</Button>
53+
54+
<Button
55+
variant={currentView === "contact" ? "default" : "ghost"}
56+
size="sm"
57+
className={cn(
58+
"h-8 transition-all",
59+
currentView === "contact" ? "px-1.5 py-1 min-w-[90px]" : "w-8 px-0 py-0",
60+
)}
61+
onClick={() => onViewChange("contact")}
62+
>
63+
<Users size={14} />
64+
{currentView === "contact" && "Contacts"}
65+
</Button>
66+
</div>
67+
);
68+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import { Trans, useLingui } from "@lingui/react/macro";
2+
import { addMonths, subMonths } from "date-fns";
3+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
4+
import { useState } from "react";
5+
6+
import WorkspaceCalendar from "@/components/workspace-calendar";
7+
import { Button } from "@hypr/ui/components/ui/button";
8+
import { cn } from "@hypr/ui/lib/utils";
9+
10+
interface CalendarViewProps {
11+
date: Date;
12+
sessions: any[];
13+
events: any[];
14+
onNavigate: (params: { date: string }) => void;
15+
}
16+
17+
export function CalendarView({ date, sessions, events, onNavigate }: CalendarViewProps) {
18+
const { i18n } = useLingui();
19+
const [currentDate, setCurrentDate] = useState(date);
20+
21+
// Embedded directly to handle navigation
22+
const handlePreviousMonth = () => {
23+
const prevMonth = subMonths(currentDate, 1);
24+
setCurrentDate(prevMonth);
25+
onNavigate({ date: prevMonth.toISOString() });
26+
};
27+
28+
const handleNextMonth = () => {
29+
const nextMonth = addMonths(currentDate, 1);
30+
setCurrentDate(nextMonth);
31+
onNavigate({ date: nextMonth.toISOString() });
32+
};
33+
34+
const handleToday = () => {
35+
const today = new Date();
36+
setCurrentDate(today);
37+
onNavigate({ date: today.toISOString() });
38+
};
39+
40+
const weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
41+
42+
return (
43+
<div className="flex flex-col h-full">
44+
<header className="flex w-full flex-col">
45+
<div data-tauri-drag-region className="relative h-11 w-full flex items-center justify-center">
46+
<h1 className="text-xl font-bold" data-tauri-drag-region>
47+
{i18n.date(currentDate, { month: "long", year: "numeric" })}
48+
</h1>
49+
50+
<div className="absolute right-2 flex h-fit rounded-md overflow-clip border border-neutral-200">
51+
<Button
52+
variant="outline"
53+
className="p-0.5 rounded-none border-none"
54+
onClick={handlePreviousMonth}
55+
>
56+
<ChevronLeftIcon size={16} />
57+
</Button>
58+
59+
<Button
60+
variant="outline"
61+
className="text-sm px-1 py-0.5 rounded-none border-none"
62+
onClick={handleToday}
63+
>
64+
<Trans>Today</Trans>
65+
</Button>
66+
67+
<Button
68+
variant="outline"
69+
className="p-0.5 rounded-none border-none"
70+
onClick={handleNextMonth}
71+
>
72+
<ChevronRightIcon size={16} />
73+
</Button>
74+
</div>
75+
</div>
76+
77+
<div className="border-b border-neutral-200 grid grid-cols-7 h-8">
78+
{weekDays.map((day, index) => (
79+
<div
80+
key={day}
81+
className={cn(
82+
"text-center font-light text-sm pb-2 pt-1",
83+
index === weekDays.length - 1 && "border-r-0",
84+
)}
85+
>
86+
{day}
87+
</div>
88+
))}
89+
</div>
90+
</header>
91+
92+
<div className="flex-1 overflow-hidden">
93+
<WorkspaceCalendar
94+
month={currentDate}
95+
sessions={sessions}
96+
events={events}
97+
/>
98+
</div>
99+
</div>
100+
);
101+
}

0 commit comments

Comments
 (0)