From 65806a990dcb91b85df398aa291710927b7ee52e Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Thu, 30 Oct 2025 08:55:27 +0900 Subject: [PATCH 1/5] rename persisted to main --- apps/desktop/src/components/chat/header.tsx | 12 ++--- .../components/chat/message/tool/search.tsx | 4 +- apps/desktop/src/components/chat/session.tsx | 20 +++---- apps/desktop/src/components/chat/view.tsx | 10 ++-- .../body/calendars/calendar-checkbox-row.tsx | 4 +- .../main/body/calendars/calendar-day.tsx | 16 +++--- .../main/body/calendars/day-events.tsx | 12 ++--- .../main/body/calendars/day-sessions.tsx | 6 +-- .../components/main/body/calendars/index.tsx | 4 +- .../components/main/body/contacts/details.tsx | 54 +++++++++---------- .../components/main/body/contacts/index.tsx | 10 ++-- .../body/contacts/organization-details.tsx | 18 +++---- .../main/body/contacts/organizations.tsx | 34 ++++++------ .../components/main/body/contacts/people.tsx | 36 ++++++------- .../src/components/main/body/events.tsx | 6 +-- .../components/main/body/folders/index.tsx | 38 ++++++------- .../src/components/main/body/humans.tsx | 4 +- .../main/body/sessions/floating/generate.tsx | 8 +-- .../main/body/sessions/floating/listen.tsx | 6 +-- .../components/main/body/sessions/index.tsx | 4 +- .../sessions/note-input/enhanced/editor.tsx | 8 +-- .../main/body/sessions/note-input/raw.tsx | 8 +-- .../note-input/transcript/viewer/segment.ts | 22 ++++---- .../transcript/viewer/test-utils.ts | 4 +- .../body/sessions/outer-header/folder.tsx | 10 ++-- .../outer-header/metadata/participants.tsx | 14 ++--- .../sessions/outer-header/metadata/shared.ts | 18 +++---- .../body/sessions/outer-header/overflow.tsx | 6 +-- .../sessions/outer-header/shared/folder.tsx | 14 ++--- .../components/main/body/sessions/shared.tsx | 8 +-- .../main/body/sessions/title-input.tsx | 8 +-- .../main/body/shared/folder-breadcrumb.tsx | 8 +-- .../components/main/sidebar/search/item.tsx | 8 +-- .../main/sidebar/timeline/index.tsx | 14 ++--- .../components/main/sidebar/timeline/item.tsx | 4 +- .../settings/memory/custom-vocabulary.tsx | 2 +- .../components/settings/template/editor.tsx | 14 ++--- .../components/settings/template/index.tsx | 10 ++-- .../settings/template/sections-list.tsx | 4 +- .../template/use-template-navigation.ts | 8 +-- .../src/contexts/search/engine/index.tsx | 2 +- .../src/contexts/search/engine/indexing.ts | 2 +- .../src/contexts/search/engine/listeners.ts | 4 +- apps/desktop/src/devtool/index.tsx | 2 +- apps/desktop/src/devtool/seed/data/loader.ts | 2 +- .../src/devtool/seed/shared/builders.ts | 2 +- .../src/devtool/seed/shared/calendar.ts | 2 +- apps/desktop/src/devtool/seed/shared/chat.ts | 2 +- apps/desktop/src/devtool/seed/shared/event.ts | 2 +- .../desktop/src/devtool/seed/shared/folder.ts | 2 +- apps/desktop/src/devtool/seed/shared/human.ts | 2 +- apps/desktop/src/devtool/seed/shared/index.ts | 2 +- .../src/devtool/seed/shared/mapping.ts | 2 +- .../desktop/src/devtool/seed/shared/memory.ts | 2 +- .../src/devtool/seed/shared/organization.ts | 2 +- .../src/devtool/seed/shared/session.ts | 2 +- apps/desktop/src/devtool/seed/shared/tag.ts | 2 +- .../src/devtool/seed/shared/template.ts | 2 +- .../src/devtool/seed/shared/transcript.ts | 2 +- .../src/devtool/seed/versions/curated.ts | 2 +- .../src/devtool/seed/versions/empty.ts | 2 +- .../src/devtool/seed/versions/random.ts | 4 +- apps/desktop/src/hooks/useAutoEnhance.ts | 12 ++--- .../desktop/src/hooks/useAutoGenerateTitle.ts | 10 ++-- apps/desktop/src/hooks/useStartListening.ts | 6 +-- apps/desktop/src/main.tsx | 2 +- .../src/routes/app/settings/_layout.tsx | 8 +-- .../src/store/tinybase/cloudPersister.ts | 16 +++--- .../store/tinybase/{persisted.ts => main.ts} | 0 .../src/store/zustand/ai-task/index.ts | 2 +- .../zustand/ai-task/task-configs/enhance.ts | 2 +- .../zustand/ai-task/task-configs/index.ts | 2 +- .../zustand/ai-task/task-configs/title.ts | 2 +- .../src/store/zustand/ai-task/tasks.ts | 2 +- .../src/store/zustand/listener/transcript.ts | 4 +- apps/desktop/src/store/zustand/tabs/schema.ts | 2 +- apps/desktop/src/types/index.ts | 2 +- apps/desktop/src/utils/segments.ts | 8 +-- apps/desktop/src/utils/timeline.ts | 10 ++-- apps/desktop/src/utils/transcript.ts | 2 +- 80 files changed, 319 insertions(+), 319 deletions(-) rename apps/desktop/src/store/tinybase/{persisted.ts => main.ts} (100%) diff --git a/apps/desktop/src/components/chat/header.tsx b/apps/desktop/src/components/chat/header.tsx index 43b22b710..42b041a04 100644 --- a/apps/desktop/src/components/chat/header.tsx +++ b/apps/desktop/src/components/chat/header.tsx @@ -6,7 +6,7 @@ import { Button } from "@hypr/ui/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "@hypr/ui/components/ui/dropdown-menu"; import { cn } from "@hypr/utils"; import { useShell } from "../../contexts/shell"; -import * as persisted from "../../store/tinybase/persisted"; +import * as main from "../../store/tinybase/main"; export function ChatHeader({ currentChatGroupId, @@ -86,19 +86,19 @@ function ChatGroups({ }) { const [isDropdownOpen, setIsDropdownOpen] = useState(false); - const currentChatTitle = persisted.UI.useCell( + const currentChatTitle = main.UI.useCell( "chat_groups", currentChatGroupId || "", "title", - persisted.STORE_ID, + main.STORE_ID, ); - const recentChatGroupIds = persisted.UI.useSortedRowIds( + const recentChatGroupIds = main.UI.useSortedRowIds( "chat_groups", "created_at", true, 0, 5, - persisted.STORE_ID, + main.STORE_ID, ); return ( @@ -162,7 +162,7 @@ function ChatGroupItem({ isActive: boolean; onSelect: (groupId: string) => void; }) { - const chatGroup = persisted.UI.useRow("chat_groups", groupId, persisted.STORE_ID); + const chatGroup = main.UI.useRow("chat_groups", groupId, main.STORE_ID); if (!chatGroup) { return null; diff --git a/apps/desktop/src/components/chat/message/tool/search.tsx b/apps/desktop/src/components/chat/message/tool/search.tsx index 236080f18..8baab9a32 100644 --- a/apps/desktop/src/components/chat/message/tool/search.tsx +++ b/apps/desktop/src/components/chat/message/tool/search.tsx @@ -9,7 +9,7 @@ import { CarouselNext, CarouselPrevious, } from "@hypr/ui/components/ui/carousel"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { useTabs } from "../../../../store/zustand/tabs"; import { Disclosure } from "../shared"; import { ToolRenderer } from "../types"; @@ -91,7 +91,7 @@ function RenderContent({ part }: { part: Part }) { } function RenderSession({ sessionId }: { sessionId: string }) { - const session = persisted.UI.useRow("sessions", sessionId, persisted.STORE_ID); + const session = main.UI.useRow("sessions", sessionId, main.STORE_ID); const { openNew } = useTabs(); const handleClick = useCallback(() => { diff --git a/apps/desktop/src/components/chat/session.tsx b/apps/desktop/src/components/chat/session.tsx index c8273fc32..78f64eb42 100644 --- a/apps/desktop/src/components/chat/session.tsx +++ b/apps/desktop/src/components/chat/session.tsx @@ -7,7 +7,7 @@ import type { HyprUIMessage } from "../../chat/types"; import { useToolRegistry } from "../../contexts/tool"; import { useLanguageModel } from "../../hooks/useLLMConnection"; import * as internal from "../../store/tinybase/internal"; -import * as persisted from "../../store/tinybase/persisted"; +import * as main from "../../store/tinybase/main"; import { id } from "../../utils"; interface ChatSessionProps { @@ -29,14 +29,14 @@ export function ChatSession({ children, }: ChatSessionProps) { const transport = useTransport(); - const store = persisted.UI.useStore(persisted.STORE_ID); + const store = main.UI.useStore(main.STORE_ID); const { user_id } = internal.UI.useValues(internal.STORE_ID); - const createChatMessage = persisted.UI.useSetRowCallback( + const createChatMessage = main.UI.useSetRowCallback( "chat_messages", - (p: Omit & { id: string }) => p.id, - (p: Omit & { id: string }) => ({ + (p: Omit & { id: string }) => p.id, + (p: Omit & { id: string }) => ({ user_id, chat_group_id: p.chat_group_id, content: p.content, @@ -44,15 +44,15 @@ export function ChatSession({ role: p.role, metadata: JSON.stringify(p.metadata), parts: JSON.stringify(p.parts), - } satisfies persisted.ChatMessageStorage), + } satisfies main.ChatMessageStorage), [user_id], - persisted.STORE_ID, + main.STORE_ID, ); - const messageIds = persisted.UI.useSliceRowIds( - persisted.INDEXES.chatMessagesByGroup, + const messageIds = main.UI.useSliceRowIds( + main.INDEXES.chatMessagesByGroup, chatGroupId ?? "", - persisted.STORE_ID, + main.STORE_ID, ); const initialMessages = useMemo((): HyprUIMessage[] => { diff --git a/apps/desktop/src/components/chat/view.tsx b/apps/desktop/src/components/chat/view.tsx index ebe76218a..252072d9c 100644 --- a/apps/desktop/src/components/chat/view.tsx +++ b/apps/desktop/src/components/chat/view.tsx @@ -3,7 +3,7 @@ import { useCallback, useRef } from "react"; import type { HyprUIMessage } from "../../chat/types"; import { useShell } from "../../contexts/shell"; import * as internal from "../../store/tinybase/internal"; -import * as persisted from "../../store/tinybase/persisted"; +import * as main from "../../store/tinybase/main"; import { id } from "../../utils"; import { useLanguageModel } from "../../hooks/useLLMConnection"; @@ -21,7 +21,7 @@ export function ChatView() { const { user_id } = internal.UI.useValues(internal.STORE_ID); - const createChatGroup = persisted.UI.useSetRowCallback( + const createChatGroup = main.UI.useSetRowCallback( "chat_groups", (p: { groupId: string; title: string }) => p.groupId, (p: { groupId: string; title: string }) => ({ @@ -30,10 +30,10 @@ export function ChatView() { title: p.title, }), [user_id], - persisted.STORE_ID, + main.STORE_ID, ); - const createChatMessage = persisted.UI.useSetRowCallback( + const createChatMessage = main.UI.useSetRowCallback( "chat_messages", (p: { id: string; chat_group_id: string; content: string; role: string; parts: any; metadata: any }) => p.id, (p: { id: string; chat_group_id: string; content: string; role: string; parts: any; metadata: any }) => ({ @@ -46,7 +46,7 @@ export function ChatView() { parts: JSON.stringify(p.parts), }), [user_id], - persisted.STORE_ID, + main.STORE_ID, ); const handleSendMessage = useCallback( diff --git a/apps/desktop/src/components/main/body/calendars/calendar-checkbox-row.tsx b/apps/desktop/src/components/main/body/calendars/calendar-checkbox-row.tsx index 24efa6b78..d64d14e2d 100644 --- a/apps/desktop/src/components/main/body/calendars/calendar-checkbox-row.tsx +++ b/apps/desktop/src/components/main/body/calendars/calendar-checkbox-row.tsx @@ -1,11 +1,11 @@ import { Checkbox } from "@hypr/ui/components/ui/checkbox"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; export function CalendarCheckboxRow( { id, checked, onToggle }: { id: string; checked: boolean; onToggle: (checked: boolean) => void }, ) { - const calendar = persisted.UI.useRow("calendars", id, persisted.STORE_ID); + const calendar = main.UI.useRow("calendars", id, main.STORE_ID); return (
(null); const [maxVisibleItems, setMaxVisibleItems] = useState(5); - const allEventIds = persisted.UI.useSliceRowIds( - persisted.INDEXES.eventsByDate, + const allEventIds = main.UI.useSliceRowIds( + main.INDEXES.eventsByDate, day, - persisted.STORE_ID, + main.STORE_ID, ); - const store = persisted.UI.useStore(persisted.STORE_ID); + const store = main.UI.useStore(main.STORE_ID); const eventIds = allEventIds.filter((eventId) => { const event = store?.getRow("events", eventId); return event?.calendar_id && selectedCalendars.has(event.calendar_id as string); }); - const sessionIds = persisted.UI.useSliceRowIds( - persisted.INDEXES.sessionByDateWithoutEvent, + const sessionIds = main.UI.useSliceRowIds( + main.INDEXES.sessionByDateWithoutEvent, day, - persisted.STORE_ID, + main.STORE_ID, ); const dayNumber = format(new Date(day), "d"); diff --git a/apps/desktop/src/components/main/body/calendars/day-events.tsx b/apps/desktop/src/components/main/body/calendars/day-events.tsx index a3452e3e9..bead9340e 100644 --- a/apps/desktop/src/components/main/body/calendars/day-events.tsx +++ b/apps/desktop/src/components/main/body/calendars/day-events.tsx @@ -5,23 +5,23 @@ import { cn, format, isSameDay } from "@hypr/utils"; import { Calendar, Pen, StickyNote } from "lucide-react"; import { useState } from "react"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { useTabs } from "../../../../store/zustand/tabs"; export function TabContentCalendarDayEvents({ eventId }: { eventId: string }) { - const event = persisted.UI.useRow("events", eventId, persisted.STORE_ID); + const event = main.UI.useRow("events", eventId, main.STORE_ID); const [open, setOpen] = useState(false); const { openNew } = useTabs(); const title = event?.title || "Untitled Event"; - const sessionIds = persisted.UI.useSliceRowIds( - persisted.INDEXES.sessionsByEvent, + const sessionIds = main.UI.useSliceRowIds( + main.INDEXES.sessionsByEvent, eventId, - persisted.STORE_ID, + main.STORE_ID, ); const linkedSessionId = sessionIds[0]; - const linkedSession = persisted.UI.useRow("sessions", linkedSessionId || "dummy", persisted.STORE_ID); + const linkedSession = main.UI.useRow("sessions", linkedSessionId || "dummy", main.STORE_ID); const handleOpenNote = () => { setOpen(false); diff --git a/apps/desktop/src/components/main/body/calendars/day-sessions.tsx b/apps/desktop/src/components/main/body/calendars/day-sessions.tsx index e83f86d9d..9a9028057 100644 --- a/apps/desktop/src/components/main/body/calendars/day-sessions.tsx +++ b/apps/desktop/src/components/main/body/calendars/day-sessions.tsx @@ -2,15 +2,15 @@ import { Button } from "@hypr/ui/components/ui/button"; import { StickyNote } from "lucide-react"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { useTabs } from "../../../../store/zustand/tabs"; export function TabContentCalendarDaySessions({ sessionId }: { sessionId: string }) { - const session = persisted.UI.useRow("sessions", sessionId, persisted.STORE_ID); + const session = main.UI.useRow("sessions", sessionId, main.STORE_ID); const { openNew } = useTabs(); const eventId = session?.event_id ?? ""; - const event = persisted.UI.useRow("events", eventId, persisted.STORE_ID); + const event = main.UI.useRow("events", eventId, main.STORE_ID); const handleClick = () => { openNew({ type: "sessions", id: sessionId }); diff --git a/apps/desktop/src/components/main/body/calendars/index.tsx b/apps/desktop/src/components/main/body/calendars/index.tsx index 544bafefc..9cc8c8814 100644 --- a/apps/desktop/src/components/main/body/calendars/index.tsx +++ b/apps/desktop/src/components/main/body/calendars/index.tsx @@ -15,7 +15,7 @@ import { import { Calendar, CalendarDays, ChevronLeft, ChevronRight } from "lucide-react"; import { useState } from "react"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { type Tab, useTabs } from "../../../../store/zustand/tabs"; import { StandardTabWrapper } from "../index"; import { type TabItem, TabItemBase } from "../shared"; @@ -58,7 +58,7 @@ function TabContentCalendarInner({ tab }: { tab: Extract>(() => new Set(calendarIds)); diff --git a/apps/desktop/src/components/main/body/contacts/details.tsx b/apps/desktop/src/components/main/body/contacts/details.tsx index 681cf5ceb..42b24ecd6 100644 --- a/apps/desktop/src/components/main/body/contacts/details.tsx +++ b/apps/desktop/src/components/main/body/contacts/details.tsx @@ -5,7 +5,7 @@ import { Button } from "@hypr/ui/components/ui/button"; import { Input } from "@hypr/ui/components/ui/input"; import { Popover, PopoverContent, PopoverTrigger } from "@hypr/ui/components/ui/popover"; import { Textarea } from "@hypr/ui/components/ui/textarea"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { getInitials } from "./shared"; export function DetailsColumn({ @@ -17,16 +17,16 @@ export function DetailsColumn({ handleDeletePerson: (id: string) => void; handleSessionClick: (id: string) => void; }) { - const selectedPersonData = persisted.UI.useRow("humans", selectedHumanId ?? "", persisted.STORE_ID); + const selectedPersonData = main.UI.useRow("humans", selectedHumanId ?? "", main.STORE_ID); - const mappingIdsByHuman = persisted.UI.useSliceRowIds( - persisted.INDEXES.sessionsByHuman, + const mappingIdsByHuman = main.UI.useSliceRowIds( + main.INDEXES.sessionsByHuman, selectedHumanId ?? "", - persisted.STORE_ID, + main.STORE_ID, ); - const allMappings = persisted.UI.useTable("mapping_session_participant", persisted.STORE_ID); - const allSessions = persisted.UI.useTable("sessions", persisted.STORE_ID); + const allMappings = main.UI.useTable("mapping_session_participant", main.STORE_ID); + const allSessions = main.UI.useTable("sessions", main.STORE_ID); const personSessions = React.useMemo(() => { if (!mappingIdsByHuman || mappingIdsByHuman.length === 0) { @@ -185,15 +185,15 @@ export function DetailsColumn({ } function EditablePersonNameField({ personId }: { personId: string }) { - const value = persisted.UI.useCell("humans", personId, "name", persisted.STORE_ID); + const value = main.UI.useCell("humans", personId, "name", main.STORE_ID); - const handleChange = persisted.UI.useSetCellCallback( + const handleChange = main.UI.useSetCellCallback( "humans", personId, "name", (e: React.ChangeEvent) => e.target.value, [], - persisted.STORE_ID, + main.STORE_ID, ); return ( @@ -207,15 +207,15 @@ function EditablePersonNameField({ personId }: { personId: string }) { } function EditablePersonJobTitleField({ personId }: { personId: string }) { - const value = persisted.UI.useCell("humans", personId, "job_title", persisted.STORE_ID); + const value = main.UI.useCell("humans", personId, "job_title", main.STORE_ID); - const handleChange = persisted.UI.useSetCellCallback( + const handleChange = main.UI.useSetCellCallback( "humans", personId, "job_title", (e: React.ChangeEvent) => e.target.value, [], - persisted.STORE_ID, + main.STORE_ID, ); return ( @@ -234,15 +234,15 @@ function EditablePersonJobTitleField({ personId }: { personId: string }) { } function EditablePersonEmailField({ personId }: { personId: string }) { - const value = persisted.UI.useCell("humans", personId, "email", persisted.STORE_ID); + const value = main.UI.useCell("humans", personId, "email", main.STORE_ID); - const handleChange = persisted.UI.useSetCellCallback( + const handleChange = main.UI.useSetCellCallback( "humans", personId, "email", (e: React.ChangeEvent) => e.target.value, [], - persisted.STORE_ID, + main.STORE_ID, ); return ( @@ -262,15 +262,15 @@ function EditablePersonEmailField({ personId }: { personId: string }) { } function EditablePersonLinkedInField({ personId }: { personId: string }) { - const value = persisted.UI.useCell("humans", personId, "linkedin_username", persisted.STORE_ID); + const value = main.UI.useCell("humans", personId, "linkedin_username", main.STORE_ID); - const handleChange = persisted.UI.useSetCellCallback( + const handleChange = main.UI.useSetCellCallback( "humans", personId, "linkedin_username", (e: React.ChangeEvent) => e.target.value, [], - persisted.STORE_ID, + main.STORE_ID, ); return ( @@ -289,15 +289,15 @@ function EditablePersonLinkedInField({ personId }: { personId: string }) { } function EditablePersonMemoField({ personId }: { personId: string }) { - const value = persisted.UI.useCell("humans", personId, "memo", persisted.STORE_ID); + const value = main.UI.useCell("humans", personId, "memo", main.STORE_ID); - const handleChange = persisted.UI.useSetCellCallback( + const handleChange = main.UI.useSetCellCallback( "humans", personId, "memo", (e: React.ChangeEvent) => e.target.value, [], - persisted.STORE_ID, + main.STORE_ID, ); return ( @@ -318,16 +318,16 @@ function EditablePersonMemoField({ personId }: { personId: string }) { function EditPersonOrganizationSelector({ personId }: { personId: string }) { const [open, setOpen] = useState(false); - const orgId = persisted.UI.useCell("humans", personId, "org_id", persisted.STORE_ID) as string | null; - const organization = persisted.UI.useRow("organizations", orgId ?? "", persisted.STORE_ID); + const orgId = main.UI.useCell("humans", personId, "org_id", main.STORE_ID) as string | null; + const organization = main.UI.useRow("organizations", orgId ?? "", main.STORE_ID); - const handleChange = persisted.UI.useSetCellCallback( + const handleChange = main.UI.useSetCellCallback( "humans", personId, "org_id", (newOrgId: string | null) => newOrgId ?? "", [], - persisted.STORE_ID, + main.STORE_ID, ); const handleRemoveOrganization = () => { @@ -373,7 +373,7 @@ function OrganizationControl({ }) { const [searchTerm, setSearchTerm] = useState(""); - const organizationsData = persisted.UI.useResultTable(persisted.QUERIES.visibleOrganizations, persisted.STORE_ID); + const organizationsData = main.UI.useResultTable(main.QUERIES.visibleOrganizations, main.STORE_ID); const allOrganizations = Object.entries(organizationsData).map(([id, data]) => ({ id, diff --git a/apps/desktop/src/components/main/body/contacts/index.tsx b/apps/desktop/src/components/main/body/contacts/index.tsx index 3a6596868..a33e231c8 100644 --- a/apps/desktop/src/components/main/body/contacts/index.tsx +++ b/apps/desktop/src/components/main/body/contacts/index.tsx @@ -3,7 +3,7 @@ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@hypr/ui/c import { Contact2Icon } from "lucide-react"; import { useCallback, useEffect } from "react"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { type Tab, useTabs } from "../../../../store/zustand/tabs"; import { StandardTabWrapper } from "../index"; import { type TabItem, TabItemBase } from "../shared"; @@ -70,10 +70,10 @@ function ContactView({ tab }: { tab: Extract }) { openCurrent({ type: "sessions", id }); }, [openCurrent]); - const deletePersonFromStore = persisted.UI.useDelRowCallback( + const deletePersonFromStore = main.UI.useDelRowCallback( "humans", (human_id: string) => human_id, - persisted.STORE_ID, + main.STORE_ID, ); const handleDeletePerson = useCallback((id: string) => { @@ -81,10 +81,10 @@ function ContactView({ tab }: { tab: Extract }) { deletePersonFromStore(id); }, [invalidateResource, deletePersonFromStore]); - const deleteOrganizationFromStore = persisted.UI.useDelRowCallback( + const deleteOrganizationFromStore = main.UI.useDelRowCallback( "organizations", (org_id: string) => org_id, - persisted.STORE_ID, + main.STORE_ID, ); const handleDeleteOrganization = useCallback((id: string) => { diff --git a/apps/desktop/src/components/main/body/contacts/organization-details.tsx b/apps/desktop/src/components/main/body/contacts/organization-details.tsx index 37a5a5e4c..9f7081bc8 100644 --- a/apps/desktop/src/components/main/body/contacts/organization-details.tsx +++ b/apps/desktop/src/components/main/body/contacts/organization-details.tsx @@ -5,7 +5,7 @@ import { Icon } from "@iconify-icon/react"; import { openUrl } from "@tauri-apps/plugin-opener"; import { Building2, Mail } from "lucide-react"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { getInitials } from "./shared"; export function OrganizationDetailsColumn({ @@ -17,15 +17,15 @@ export function OrganizationDetailsColumn({ handleDeleteOrganization: (id: string) => void; onPersonClick?: (personId: string) => void; }) { - const selectedOrgData = persisted.UI.useRow("organizations", selectedOrganizationId ?? "", persisted.STORE_ID); + const selectedOrgData = main.UI.useRow("organizations", selectedOrganizationId ?? "", main.STORE_ID); - const peopleInOrg = persisted.UI.useSliceRowIds( - persisted.INDEXES.humansByOrg, + const peopleInOrg = main.UI.useSliceRowIds( + main.INDEXES.humansByOrg, selectedOrganizationId ?? "", - persisted.STORE_ID, + main.STORE_ID, ); - const allHumans = persisted.UI.useTable("humans", persisted.STORE_ID); + const allHumans = main.UI.useTable("humans", main.STORE_ID); return (
@@ -168,15 +168,15 @@ export function OrganizationDetailsColumn({ } function EditableOrganizationNameField({ organizationId }: { organizationId: string }) { - const value = persisted.UI.useCell("organizations", organizationId, "name", persisted.STORE_ID); + const value = main.UI.useCell("organizations", organizationId, "name", main.STORE_ID); - const handleChange = persisted.UI.useSetCellCallback( + const handleChange = main.UI.useSetCellCallback( "organizations", organizationId, "name", (e: React.ChangeEvent) => e.target.value, [], - persisted.STORE_ID, + main.STORE_ID, ); return ( diff --git a/apps/desktop/src/components/main/body/contacts/organizations.tsx b/apps/desktop/src/components/main/body/contacts/organizations.tsx index 44c3a317a..1a11fb2f8 100644 --- a/apps/desktop/src/components/main/body/contacts/organizations.tsx +++ b/apps/desktop/src/components/main/body/contacts/organizations.tsx @@ -3,7 +3,7 @@ import { cn } from "@hypr/utils"; import { Building2, CornerDownLeft, User } from "lucide-react"; import React, { useState } from "react"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { ColumnHeader, type SortOption } from "./shared"; export function OrganizationsColumn({ @@ -19,7 +19,7 @@ export function OrganizationsColumn({ const [searchValue, setSearchValue] = useState(""); const { organizationIds, sortOption, setSortOption } = useSortedOrganizationIds(); - const allOrgs = persisted.UI.useTable("organizations", persisted.STORE_ID); + const allOrgs = main.UI.useTable("organizations", main.STORE_ID); const filteredOrganizationIds = React.useMemo(() => { if (!searchValue.trim()) { @@ -79,37 +79,37 @@ export function OrganizationsColumn({ function useSortedOrganizationIds() { const [sortOption, setSortOption] = useState("alphabetical"); - const alphabeticalIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleOrganizations, + const alphabeticalIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleOrganizations, "name", false, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); - const reverseAlphabeticalIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleOrganizations, + const reverseAlphabeticalIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleOrganizations, "name", true, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); - const newestIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleOrganizations, + const newestIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleOrganizations, "created_at", true, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); - const oldestIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleOrganizations, + const oldestIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleOrganizations, "created_at", false, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); const organizationIds = sortOption === "alphabetical" @@ -134,7 +134,7 @@ function OrganizationItem({ isViewingDetails: boolean; setSelectedOrganization: (id: string | null) => void; }) { - const organization = persisted.UI.useRow("organizations", organizationId, persisted.STORE_ID); + const organization = main.UI.useRow("organizations", organizationId, main.STORE_ID); if (!organization) { return null; } @@ -167,7 +167,7 @@ function NewOrganizationForm({ }) { const [name, setName] = useState(""); - const handleAdd = persisted.UI.useAddRowCallback( + const handleAdd = main.UI.useAddRowCallback( "organizations", () => ({ name: name.trim(), @@ -175,7 +175,7 @@ function NewOrganizationForm({ updated_at: new Date().toISOString(), }), [name], - persisted.STORE_ID, + main.STORE_ID, () => { setName(""); onSave(); diff --git a/apps/desktop/src/components/main/body/contacts/people.tsx b/apps/desktop/src/components/main/body/contacts/people.tsx index 468e1131e..4cd799f8a 100644 --- a/apps/desktop/src/components/main/body/contacts/people.tsx +++ b/apps/desktop/src/components/main/body/contacts/people.tsx @@ -2,7 +2,7 @@ import { cn } from "@hypr/utils"; import { useMemo, useState } from "react"; -import * as persisted from "../../../../store/tinybase/persisted"; +import * as main from "../../../../store/tinybase/main"; import { ColumnHeader, getInitials, type SortOption } from "./shared"; export function PeopleColumn({ @@ -17,7 +17,7 @@ export function PeopleColumn({ const [searchValue, setSearchValue] = useState(""); const { humanIds, sortOption, setSortOption } = useSortedHumanIds(currentOrgId); - const allHumans = persisted.UI.useTable("humans", persisted.STORE_ID); + const allHumans = main.UI.useTable("humans", main.STORE_ID); const filteredHumanIds = useMemo(() => { if (!searchValue.trim()) { @@ -62,43 +62,43 @@ export function PeopleColumn({ export function useSortedHumanIds(currentOrgId?: string | null) { const [sortOption, setSortOption] = useState("alphabetical"); - const allAlphabeticalIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleHumans, + const allAlphabeticalIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleHumans, "name", false, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); - const allReverseAlphabeticalIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleHumans, + const allReverseAlphabeticalIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleHumans, "name", true, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); - const allNewestIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleHumans, + const allNewestIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleHumans, "created_at", true, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); - const allOldestIds = persisted.UI.useResultSortedRowIds( - persisted.QUERIES.visibleHumans, + const allOldestIds = main.UI.useResultSortedRowIds( + main.QUERIES.visibleHumans, "created_at", false, 0, undefined, - persisted.STORE_ID, + main.STORE_ID, ); - const thisOrgHumanIds = persisted.UI.useSliceRowIds( - persisted.INDEXES.humansByOrg, + const thisOrgHumanIds = main.UI.useSliceRowIds( + main.INDEXES.humansByOrg, currentOrgId ?? "", - persisted.STORE_ID, + main.STORE_ID, ); const humanIds = currentOrgId @@ -129,7 +129,7 @@ function PersonItem({ active: boolean; setSelectedPerson: (id: string | null) => void; }) { - const person = persisted.UI.useRow("humans", humanId, persisted.STORE_ID); + const person = main.UI.useRow("humans", humanId, main.STORE_ID); return (