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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ Secrets*.toml
restate-data

.windsurfrules
.turbo
.turbo

CLAUDE.md
17 changes: 15 additions & 2 deletions apps/desktop/src/components/command-palette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { useEffect, useRef, useState } from "react";
import { useHypr } from "@/contexts/hypr";
import { type SearchMatch } from "@/stores/search";
import { commands as dbCommands } from "@hypr/plugin-db";
import { commands as windowsCommands } from "@hypr/plugin-windows";

interface CommandPaletteProps {
open: boolean;
Expand Down Expand Up @@ -281,10 +282,22 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
navigate({ to: "/app/new", search: { calendarEventId: match.item.id } });
break;
case "human":
navigate({ to: "/app/human/$id", params: { id: match.item.id } });
// Open finder window and navigate to contact view with person selected
windowsCommands.windowShow({ type: "finder" }).then(() => {
windowsCommands.windowNavigate(
{ type: "finder" },
`/app/finder?view=contact&personId=${match.item.id}`,
);
});
break;
case "organization":
navigate({ to: "/app/organization/$id", params: { id: match.item.id } });
// Open finder window and navigate to contact view with organization selected
windowsCommands.windowShow({ type: "finder" }).then(() => {
windowsCommands.windowNavigate(
{ type: "finder" },
`/app/finder?view=contact&orgId=${match.item.id}`,
);
});
break;
}
onOpenChange(false);
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src/components/finder/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { ViewSelector } from "./view-selector";
export { CalendarView } from "./views/calendar-view";
export { FolderView } from "./views/folder-view";
export { TableView } from "./views/table-view";
68 changes: 68 additions & 0 deletions apps/desktop/src/components/finder/view-selector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Button } from "@hypr/ui/components/ui/button";
import { cn } from "@hypr/ui/lib/utils";
import { Calendar, Folder, Table, Users } from "lucide-react";

type ViewType = "folder" | "calendar" | "table" | "contact";

interface ViewSelectorProps {
currentView: ViewType;
onViewChange: (view: ViewType) => void;
}

export function ViewSelector({ currentView, onViewChange }: ViewSelectorProps) {
return (
<div className="flex items-center gap-1 bg-neutral-100 rounded-md">
<Button
variant={currentView === "folder" ? "default" : "ghost"}
size="sm"
className={cn(
"h-8 transition-all",
currentView === "folder" ? "px-1.5 py-1 min-w-[70px]" : "w-8 px-0 py-0",
)}
onClick={() => onViewChange("folder")}
>
<Folder size={14} />
{currentView === "folder" && "Folder"}
</Button>

<Button
variant={currentView === "calendar" ? "default" : "ghost"}
size="sm"
className={cn(
"h-8 transition-all",
currentView === "calendar" ? "px-1.5 py-1 min-w-[95px]" : "w-8 px-0 py-0",
)}
onClick={() => onViewChange("calendar")}
>
<Calendar size={14} />
{currentView === "calendar" && "Calendar"}
</Button>

<Button
variant={currentView === "table" ? "default" : "ghost"}
size="sm"
className={cn(
"h-8 transition-all",
currentView === "table" ? "px-1.5 py-1 min-w-[70px]" : "w-8 px-0 py-0",
)}
onClick={() => onViewChange("table")}
>
<Table size={14} />
{currentView === "table" && "Table"}
</Button>

<Button
variant={currentView === "contact" ? "default" : "ghost"}
size="sm"
className={cn(
"h-8 transition-all",
currentView === "contact" ? "px-1.5 py-1 min-w-[90px]" : "w-8 px-0 py-0",
)}
onClick={() => onViewChange("contact")}
>
<Users size={14} />
{currentView === "contact" && "Contacts"}
</Button>
</div>
);
}
101 changes: 101 additions & 0 deletions apps/desktop/src/components/finder/views/calendar-view.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { Trans, useLingui } from "@lingui/react/macro";
import { addMonths, subMonths } from "date-fns";
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
import { useState } from "react";

import WorkspaceCalendar from "@/components/workspace-calendar";
import { Button } from "@hypr/ui/components/ui/button";
import { cn } from "@hypr/ui/lib/utils";

interface CalendarViewProps {
date: Date;
sessions: any[];
events: any[];
onNavigate: (params: { date: string }) => void;
}

export function CalendarView({ date, sessions, events, onNavigate }: CalendarViewProps) {
const { i18n } = useLingui();
const [currentDate, setCurrentDate] = useState(date);

// Embedded directly to handle navigation
const handlePreviousMonth = () => {
const prevMonth = subMonths(currentDate, 1);
setCurrentDate(prevMonth);
onNavigate({ date: prevMonth.toISOString() });
};

const handleNextMonth = () => {
const nextMonth = addMonths(currentDate, 1);
setCurrentDate(nextMonth);
onNavigate({ date: nextMonth.toISOString() });
};

const handleToday = () => {
const today = new Date();
setCurrentDate(today);
onNavigate({ date: today.toISOString() });
};

const weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];

return (
<div className="flex flex-col h-full">
<header className="flex w-full flex-col">
<div data-tauri-drag-region className="relative h-11 w-full flex items-center justify-center">
<h1 className="text-xl font-bold" data-tauri-drag-region>
{i18n.date(currentDate, { month: "long", year: "numeric" })}
</h1>

<div className="absolute right-2 flex h-fit rounded-md overflow-clip border border-neutral-200">
<Button
variant="outline"
className="p-0.5 rounded-none border-none"
onClick={handlePreviousMonth}
>
<ChevronLeftIcon size={16} />
</Button>

<Button
variant="outline"
className="text-sm px-1 py-0.5 rounded-none border-none"
onClick={handleToday}
>
<Trans>Today</Trans>
</Button>

<Button
variant="outline"
className="p-0.5 rounded-none border-none"
onClick={handleNextMonth}
>
<ChevronRightIcon size={16} />
</Button>
</div>
</div>

<div className="border-b border-neutral-200 grid grid-cols-7 h-8">
{weekDays.map((day, index) => (
<div
key={day}
className={cn(
"text-center font-light text-sm pb-2 pt-1",
index === weekDays.length - 1 && "border-r-0",
)}
>
{day}
</div>
))}
</div>
</header>

<div className="flex-1 overflow-hidden">
<WorkspaceCalendar
month={currentDate}
sessions={sessions}
events={events}
/>
</div>
</div>
);
}
Loading
Loading