Skip to content
Open
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
13 changes: 5 additions & 8 deletions apps/desktop/src/components/left-sidebar/events-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { SplashLoader } from "@hypr/ui/components/ui/splash";
import { cn } from "@hypr/ui/lib/utils";
import { useSession } from "@hypr/utils/contexts";
import { formatUpcomingTime } from "@hypr/utils/datetime";
import { safeNavigate } from "@hypr/utils/navigation";

type EventWithSession = Event & { session: Session | null };

Expand Down Expand Up @@ -128,14 +127,12 @@ function EventItem({

const handleOpenCalendar = () => {
const date = new Date(event.start_date);
const formattedDate = format(date, "yyyy-MM-dd");
const url = `/app/finder?view=calendar&date=${formattedDate}`;

const params = {
to: "/app/calendar",
search: { date: format(date, "yyyy-MM-dd") },
} as const satisfies LinkProps;

const url = `${params.to}?date=${params.search.date}`;
safeNavigate({ type: "calendar" }, url);
windowsCommands.windowShow({ type: "main" }).then(() => {
windowsCommands.windowEmitNavigate({ type: "main" }, url);
});
};

const isActive = activeSessionId
Expand Down
13 changes: 5 additions & 8 deletions apps/desktop/src/components/left-sidebar/notes-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { SplashLoader } from "@hypr/ui/components/ui/splash";
import { cn } from "@hypr/ui/lib/utils";
import { useSession, useSessions } from "@hypr/utils/contexts";
import { format, formatDate, formatRelative } from "@hypr/utils/datetime";
import { safeNavigate } from "@hypr/utils/navigation";

interface NotesListProps {
filter: (session: Session) => boolean;
Expand Down Expand Up @@ -235,14 +234,12 @@ function NoteItem({
};

const handleOpenCalendar = () => {
const params = {
to: "/app/calendar",
search: { date: format(currentSession.created_at, "yyyy-MM-dd") },
} as const satisfies LinkProps;
const formattedDate = format(currentSession.created_at, "yyyy-MM-dd");
const url = `/app/finder?view=calendar&date=${formattedDate}`;

const url = `${params.to}?date=${params.search.date}`;

safeNavigate({ type: "calendar" }, url);
windowsCommands.windowShow({ type: "main" }).then(() => {
windowsCommands.windowEmitNavigate({ type: "main" }, url);
});
};

const buttonRef = useRef<HTMLButtonElement>(null);
Expand Down
10 changes: 7 additions & 3 deletions apps/desktop/src/components/workspace-calendar/event-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { useMemo, useState } from "react";
import { useHypr } from "@/contexts";
import type { Event } from "@hypr/plugin-db";
import { commands as dbCommands } from "@hypr/plugin-db";
import { commands as windowsCommands } from "@hypr/plugin-windows";
import { Button } from "@hypr/ui/components/ui/button";
import { Popover, PopoverContent, PopoverTrigger } from "@hypr/ui/components/ui/popover";
import { safeNavigate } from "@hypr/utils/navigation";

export function EventCard({
event,
Expand Down Expand Up @@ -72,7 +72,9 @@ export function EventCard({

const url = props.to.replace("$id", props.params.id);

safeNavigate({ type: "main" }, url);
windowsCommands.windowShow({ type: "main" }).then(() => {
windowsCommands.windowEmitNavigate({ type: "main" }, url);
});
} else {
const props = {
to: "/app/new",
Expand All @@ -83,7 +85,9 @@ export function EventCard({
`?calendarEventId=${props.search.calendarEventId}`,
);

safeNavigate({ type: "main" }, url);
windowsCommands.windowShow({ type: "main" }).then(() => {
windowsCommands.windowEmitNavigate({ type: "main" }, url);
});
}
};

Expand Down
6 changes: 4 additions & 2 deletions apps/desktop/src/components/workspace-calendar/note-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { useMemo, useState } from "react";
import { useHypr } from "@/contexts";
import { type Session } from "@hypr/plugin-db";
import { commands as dbCommands } from "@hypr/plugin-db";
import { commands as windowsCommands } from "@hypr/plugin-windows";
import { Button } from "@hypr/ui/components/ui/button";
import { Popover, PopoverContent, PopoverTrigger } from "@hypr/ui/components/ui/popover";
import { safeNavigate } from "@hypr/utils/navigation";

export function NoteCard({
session,
Expand Down Expand Up @@ -62,7 +62,9 @@ export function NoteCard({

const url = props.to.replace("$id", props.params.id);

safeNavigate({ type: "main" }, url);
windowsCommands.windowShow({ type: "main" }).then(() => {
windowsCommands.windowEmitNavigate({ type: "main" }, url);
});
};

const getStartDate = () => {
Expand Down
1 change: 0 additions & 1 deletion packages/utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from "./ai";
export * from "./datetime";
export * from "./fetch";
export * from "./navigation";
export * from "./organization";
export * from "./string";
41 changes: 0 additions & 41 deletions packages/utils/src/navigation.ts

This file was deleted.

Loading