Skip to content

Commit c0a570d

Browse files
committed
daily summary tab
1 parent c8c9240 commit c0a570d

9 files changed

Lines changed: 123 additions & 5 deletions

File tree

.github/workflows/desktop_cd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
uses: ./.github/actions/hf_unzip_resource
111111
with:
112112
repo: Cactus-Compute/LFM2-VL-450M
113-
path: weights/lfm2-vl-450m-int8-apple.zip
113+
path: weights/lfm2-vl-450m-int8.zip
114114
local-dir: apps/desktop/src-tauri/resources/models/cactus/_downloads
115115
output-dir: apps/desktop/src-tauri/resources/models/cactus/char-vlm/weight
116116
token: ${{ secrets.HF_TOKEN }}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { TabContentDailySummary } from "./tab-content";
2+
export { TabItemDailySummary } from "./tab-item";
3+
export { openDailySummaryTab } from "./open-tab";
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { type Tab, useTabs } from "~/store/zustand/tabs";
2+
import { id } from "~/shared/utils";
3+
4+
export function openDailySummaryTab(date: string) {
5+
const state = useTabs.getState();
6+
const { tabs } = state;
7+
8+
const existing = tabs.find(
9+
(tab) => tab.type === "daily_summary" && tab.id === date,
10+
);
11+
if (existing) {
12+
state.select(existing);
13+
return;
14+
}
15+
16+
const newTab: Tab = {
17+
type: "daily_summary",
18+
id: date,
19+
active: true,
20+
slotId: id(),
21+
pinned: false,
22+
};
23+
24+
const deactivated = tabs.map((tab) => ({ ...tab, active: false }));
25+
useTabs.setState({
26+
tabs: [...deactivated, newTab],
27+
currentTab: newTab,
28+
});
29+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { StandardTabWrapper } from "~/shared/main";
2+
import { type Tab } from "~/store/zustand/tabs";
3+
import { DateHeader } from "~/main2/home/date-header";
4+
import { DailyNoteEditor } from "~/main2/home/note-editor";
5+
6+
type DailySummaryTab = Extract<Tab, { type: "daily_summary" }>;
7+
8+
export function TabContentDailySummary({ tab }: { tab: DailySummaryTab }) {
9+
return (
10+
<StandardTabWrapper>
11+
<div className="h-full overflow-auto">
12+
<DateHeader date={tab.id} />
13+
<DailyNoteEditor date={tab.id} />
14+
</div>
15+
</StandardTabWrapper>
16+
);
17+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { CalendarIcon } from "lucide-react";
2+
3+
import { TabItemBase, type TabItem } from "~/shared/tabs";
4+
import { type Tab } from "~/store/zustand/tabs";
5+
6+
type DailySummaryTab = Extract<Tab, { type: "daily_summary" }>;
7+
8+
function formatDateHeader(dateStr: string): string {
9+
const date = new Date(dateStr + "T00:00:00");
10+
const month = date.toLocaleDateString("en-US", { month: "short" });
11+
const day = date.getDate();
12+
return `${month} ${day}`;
13+
}
14+
15+
export const TabItemDailySummary: TabItem<DailySummaryTab> = ({
16+
tab,
17+
tabIndex,
18+
handleCloseThis,
19+
handleSelectThis,
20+
handleCloseOthers,
21+
handleCloseAll,
22+
handlePinThis,
23+
handleUnpinThis,
24+
}) => {
25+
return (
26+
<TabItemBase
27+
icon={<CalendarIcon className="h-4 w-4" />}
28+
title={formatDateHeader(tab.id)}
29+
selected={tab.active}
30+
pinned={tab.pinned}
31+
tabIndex={tabIndex}
32+
handleCloseThis={() => handleCloseThis(tab)}
33+
handleSelectThis={() => handleSelectThis(tab)}
34+
handleCloseOthers={handleCloseOthers}
35+
handleCloseAll={handleCloseAll}
36+
handlePinThis={() => handlePinThis(tab)}
37+
handleUnpinThis={() => handleUnpinThis(tab)}
38+
/>
39+
);
40+
};

apps/desktop/src/main2/home/date-header.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { openDailySummaryTab } from "~/daily-summary";
2+
13
function ordinalSuffix(day: number): string {
24
if (day >= 11 && day <= 13) return "th";
35
switch (day % 10) {
@@ -28,15 +30,17 @@ export function DateHeader({ date, muted }: { date: string; muted?: boolean }) {
2830
const isToday = date === getTodayString();
2931
return (
3032
<div className="flex items-center gap-3 px-6 pt-6 pb-3">
31-
<h2
33+
<button
34+
type="button"
35+
onClick={() => openDailySummaryTab(date)}
3236
className={
3337
muted
34-
? "text-lg font-medium text-neutral-400"
35-
: "text-xl font-semibold text-neutral-900"
38+
? "text-lg font-medium text-neutral-400 hover:text-neutral-600"
39+
: "text-xl font-semibold text-neutral-900 hover:text-neutral-600"
3640
}
3741
>
3842
{formatDateHeader(date)}
39-
</h2>
43+
</button>
4044
{isToday && (
4145
<span className="rounded-full bg-neutral-900 px-2 py-0.5 text-xs font-medium text-white">
4246
Today

apps/desktop/src/shared/main/tab-content.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TabContentChat } from "~/chat/tab/tab-content";
44
import { TabContentChatShortcut } from "~/chat_shortcuts";
55
import { TabContentContact } from "~/contacts";
66
import { TabContentHuman } from "~/contacts/humans";
7+
import { TabContentDailySummary } from "~/daily-summary";
78
import { TabContentEdit } from "~/edit";
89
import { TabContentFolder } from "~/folders";
910
import { TabContentOnboarding } from "~/onboarding";
@@ -53,5 +54,8 @@ export function MainTabContent({ tab }: { tab: Tab }) {
5354
if (tab.type === "task") {
5455
return <TabContentTask tab={tab} />;
5556
}
57+
if (tab.type === "daily_summary") {
58+
return <TabContentDailySummary tab={tab} />;
59+
}
5660
return null;
5761
}

apps/desktop/src/shared/main/tab-item.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TabItemChat } from "~/chat/tab/tab-item";
44
import { TabItemChatShortcut } from "~/chat_shortcuts";
55
import { TabItemContact } from "~/contacts";
66
import { TabItemHuman } from "~/contacts/humans";
7+
import { TabItemDailySummary } from "~/daily-summary";
78
import { TabItemEdit } from "~/edit";
89
import { TabItemFolder } from "~/folders";
910
import { TabItemOnboarding } from "~/onboarding";
@@ -224,5 +225,19 @@ export function MainTabItem({
224225
/>
225226
);
226227
}
228+
if (tab.type === "daily_summary") {
229+
return (
230+
<TabItemDailySummary
231+
tab={tab}
232+
tabIndex={tabIndex}
233+
handleCloseThis={handleClose}
234+
handleSelectThis={handleSelect}
235+
handleCloseOthers={handleCloseOthers}
236+
handleCloseAll={handleCloseAll}
237+
handlePinThis={handlePinThis}
238+
handleUnpinThis={handleUnpinThis}
239+
/>
240+
);
241+
}
227242
return null;
228243
}

apps/desktop/src/store/zustand/tabs/schema.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ export type Tab =
129129
type: "task";
130130
id: string;
131131
resources: TaskResource[];
132+
})
133+
| (BaseTab & {
134+
type: "daily_summary";
135+
id: string;
132136
});
133137

134138
export type TaskResource =
@@ -258,6 +262,8 @@ export const uniqueIdfromTab = (tab: Tab): string => {
258262
return `edit-${tab.requestId}`;
259263
case "task":
260264
return `task-${tab.id}`;
265+
case "daily_summary":
266+
return `daily_summary-${tab.id}`;
261267
}
262268
};
263269

0 commit comments

Comments
 (0)