-
+
{info(search.tab).label}
-
@@ -113,61 +99,111 @@ function Component() {
);
}
+function Group(
+ {
+ tabs,
+ activeTab,
+ expandHeight = false,
+ includeTrafficLight = false,
+ }: {
+ tabs: (typeof TABS)[number][];
+ activeTab: typeof TABS[number];
+ expandHeight?: boolean;
+ includeTrafficLight?: boolean;
+ },
+) {
+ const navigate = Route.useNavigate();
+ return (
+
+ {includeTrafficLight &&
}
+ {tabs.map((tab) => {
+ const tabInfo = info(tab);
+ const Icon = tabInfo.icon;
+
+ return (
+
+ );
+ })}
+
+ );
+}
+
const info = (tab: typeof TABS[number]) => {
switch (tab) {
case "general":
return {
label: "General",
icon: Settings2,
- bottom: false,
+ group: 1,
};
case "calendar":
return {
label: "Calendar",
icon: CalendarDays,
- bottom: false,
+ group: 1,
};
case "ai":
return {
label: "Hyprnote AI",
icon: Sparkles,
- bottom: false,
+ group: 1,
};
case "notifications":
return {
label: "Notifications",
icon: Bell,
- bottom: false,
+ group: 1,
};
case "integrations":
return {
label: "Integrations",
icon: Puzzle,
- bottom: false,
+ group: 1,
};
case "templates":
return {
label: "Templates",
icon: BookText,
- bottom: false,
+ group: 1,
};
case "feedback":
return {
label: "Feedback",
icon: MessageCircleQuestion,
- bottom: true,
+ group: 2,
};
case "developers":
return {
label: "Talk to developers",
icon: Settings2,
- bottom: true,
+ group: 2,
};
case "billing":
return {
label: "Billing",
icon: CreditCard,
- bottom: true,
+ group: 3,
};
}
};
diff --git a/apps/desktop2/src/store/seed.ts b/apps/desktop2/src/store/seed.ts
index 45d179abff..5e65a096d1 100644
--- a/apps/desktop2/src/store/seed.ts
+++ b/apps/desktop2/src/store/seed.ts
@@ -27,7 +27,7 @@ interface MockConfig {
calendarsPerUser: number;
}
-const USER_ID = id();
+const USER_ID = "4c2c0e44-f674-4c67-87d0-00bcfb78dc8a";
const createOrganization = () => ({
id: id(),
diff --git a/apps/desktop2/src/store/tinybase/internal.ts b/apps/desktop2/src/store/tinybase/internal.ts
index 985e994ff3..928da687bf 100644
--- a/apps/desktop2/src/store/tinybase/internal.ts
+++ b/apps/desktop2/src/store/tinybase/internal.ts
@@ -1,17 +1,56 @@
import * as _UI from "tinybase/ui-react/with-schemas";
-import { createMergeableStore, type MergeableStore, type TablesSchema, ValuesSchema } from "tinybase/with-schemas";
+import { createMergeableStore, type MergeableStore, type TablesSchema } from "tinybase/with-schemas";
+import { z } from "zod";
import { createLocalPersister } from "./localPersister";
import { createLocalSynchronizer } from "./localSynchronizer";
+import { type InferTinyBaseSchema, jsonObject, type ToStorageType } from "./shared";
+
+export const generalSchema = z.object({
+ user_id: z.string(),
+ autostart: z.boolean().default(false),
+ telemetry_consent: z.boolean().default(true),
+ save_recordings: z.boolean().default(true),
+ notification_event: z.boolean().default(true),
+ notification_detect: z.boolean().default(true),
+ ai_language: z.string().default("en"),
+ spoken_languages: jsonObject(z.array(z.string()).default(["en"])),
+ jargons: jsonObject(z.array(z.string()).default([])),
+ current_llm_provider: z.string().default("hypr"),
+ current_stt_provider: z.string().default("hypr"),
+});
+
+export const aiSchema = z.object({
+ base_url: z.string(),
+ api_key: z.string(),
+});
+export type AI = z.infer
;
+export type AIStorage = ToStorageType;
+
+export type General = z.infer;
+export type GeneralStorage = ToStorageType;
export const STORE_ID = "internal";
export const SCHEMA = {
value: {
user_id: { type: "string" },
- device_id: { type: "string" },
- } as const satisfies ValuesSchema,
+ autostart: { type: "boolean" },
+ save_recordings: { type: "boolean" },
+ notification_event: { type: "boolean" },
+ notification_detect: { type: "boolean" },
+ telemetry_consent: { type: "boolean" },
+ ai_language: { type: "string" },
+ spoken_languages: { type: "string" },
+ jargons: { type: "string" },
+ current_llm_provider: { type: "string" },
+ current_stt_provider: { type: "string" },
+ } as const satisfies InferTinyBaseSchema,
table: {
+ ai: {
+ base_url: { type: "string" },
+ api_key: { type: "string" },
+ } as const satisfies InferTinyBaseSchema,
changes: {
row_id: { type: "string" },
table: { type: "string" },
diff --git a/apps/desktop2/src/store/tinybase/persisted.ts b/apps/desktop2/src/store/tinybase/persisted.ts
index 4ee0097fb9..de5ab739e1 100644
--- a/apps/desktop2/src/store/tinybase/persisted.ts
+++ b/apps/desktop2/src/store/tinybase/persisted.ts
@@ -16,7 +16,6 @@ import {
calendarSchema as baseCalendarSchema,
chatGroupSchema as baseChatGroupSchema,
chatMessageSchema as baseChatMessageSchema,
- configSchema as baseConfigSchema,
eventSchema as baseEventSchema,
folderSchema as baseFolderSchema,
humanSchema as baseHumanSchema,
@@ -30,7 +29,6 @@ import {
templateSchema as baseTemplateSchema,
transcriptSchema,
} from "@hypr/db";
-import { id } from "../../utils";
import * as internal from "./internal";
import { createLocalPersister, LOCAL_PERSISTER_ID } from "./localPersister";
import { createLocalSynchronizer } from "./localSynchronizer";
@@ -89,18 +87,6 @@ export const templateSchema = baseTemplateSchema.omit({ id: true }).extend({
sections: jsonObject(z.array(templateSectionSchema)),
});
-export const configSchema = baseConfigSchema.omit({ id: true }).extend({
- created_at: z.string(),
- spoken_languages: jsonObject(z.array(z.string())),
- jargons: jsonObject(z.array(z.string())),
- notification_ignored_platforms: jsonObject(z.array(z.string()).optional()),
- save_recordings: z.preprocess(val => val ?? undefined, z.boolean().optional()),
- selected_template_id: z.preprocess(val => val ?? undefined, z.string().optional()),
- ai_api_base: z.preprocess(val => val ?? undefined, z.string().optional()),
- ai_api_key: z.preprocess(val => val ?? undefined, z.string().optional()),
- ai_specificity: z.preprocess(val => val ?? undefined, z.string().optional()),
-});
-
export const chatGroupSchema = baseChatGroupSchema.omit({ id: true }).extend({ created_at: z.string() });
export const chatMessageSchema = baseChatMessageSchema.omit({ id: true }).extend({
created_at: z.string(),
@@ -119,14 +105,12 @@ export type Tag = z.infer;
export type MappingTagSession = z.infer;
export type Template = z.infer;
export type TemplateSection = z.infer;
-export type Config = z.infer;
export type ChatGroup = z.infer;
export type ChatMessage = z.infer;
export type SessionStorage = ToStorageType;
export type TemplateStorage = ToStorageType;
export type ChatMessageStorage = ToStorageType;
-export type ConfigStorage = ToStorageType;
const SCHEMA = {
value: {} as const satisfies ValuesSchema,
@@ -199,24 +183,6 @@ const SCHEMA = {
description: { type: "string" },
sections: { type: "string" },
} satisfies InferTinyBaseSchema,
- configs: {
- user_id: { type: "string" },
- created_at: { type: "string" },
- autostart: { type: "boolean" },
- display_language: { type: "string" },
- spoken_languages: { type: "string" },
- jargons: { type: "string" },
- telemetry_consent: { type: "boolean" },
- save_recordings: { type: "boolean" },
- selected_template_id: { type: "string" },
- summary_language: { type: "string" },
- notification_before: { type: "boolean" },
- notification_auto: { type: "boolean" },
- notification_ignored_platforms: { type: "string" },
- ai_api_base: { type: "string" },
- ai_api_key: { type: "string" },
- ai_specificity: { type: "string" },
- } satisfies InferTinyBaseSchema,
chat_groups: {
user_id: { type: "string" },
created_at: { type: "string" },
@@ -517,30 +483,3 @@ export const INDEXES = {
tagSessionsByTag: "tagSessionsByTag",
chatMessagesByGroup: "chatMessagesByGroup",
};
-
-// TODO
-export const useConfig = () => {
- const user_id = "0b28fde2-2f07-49da-946c-01fc4b94e9ae";
- const config_id = id();
-
- const defaultConfig = {
- user_id,
- created_at: new Date().toISOString(),
- autostart: false,
- display_language: "en",
- telemetry_consent: true,
- summary_language: "en",
- notification_before: true,
- notification_auto: true,
- spoken_languages: JSON.stringify(["en"]),
- jargons: JSON.stringify([]),
- save_recordings: false,
- selected_template_id: undefined,
- notification_ignored_platforms: undefined,
- ai_api_base: undefined,
- ai_api_key: undefined,
- ai_specificity: "3",
- } satisfies ToStorageType;
-
- return { id: config_id, user_id, config: defaultConfig };
-};
diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts
index 104171e696..959fbcb26f 100644
--- a/packages/db/src/schema.ts
+++ b/packages/db/src/schema.ts
@@ -87,25 +87,6 @@ export const templates = pgTable(TABLE_TEMPLATES, {
sections: json("sections").notNull(),
});
-export const TABLE_CONFIGS = "configs";
-export const configs = pgTable(TABLE_CONFIGS, {
- ...SHARED,
- autostart: boolean("autostart").notNull().default(false),
- display_language: text("display_language").notNull().default("en"),
- spoken_languages: json("spoken_languages").notNull().default([]),
- jargons: json("jargons").notNull().default([]),
- telemetry_consent: boolean("telemetry_consent").notNull().default(true),
- save_recordings: boolean("save_recordings").default(false),
- selected_template_id: uuid("selected_template_id"),
- summary_language: text("summary_language").notNull().default("en"),
- notification_before: boolean("notification_before").notNull().default(true),
- notification_auto: boolean("notification_auto").notNull().default(true),
- notification_ignored_platforms: json("notification_ignored_platforms"),
- ai_api_base: text("ai_api_base"),
- ai_api_key: text("ai_api_key"),
- ai_specificity: text("ai_specificity").default("3"),
-});
-
export const TABLE_CHAT_GROUPS = "chat_groups";
export const chatGroups = pgTable(TABLE_CHAT_GROUPS, {
...SHARED,
@@ -143,6 +124,5 @@ export const mappingSessionParticipantSchema = createSelectSchema(mappingSession
export const tagSchema = createSelectSchema(tags);
export const mappingTagSessionSchema = createSelectSchema(mappingTagSession);
export const templateSchema = createSelectSchema(templates);
-export const configSchema = createSelectSchema(configs);
export const chatGroupSchema = createSelectSchema(chatGroups);
export const chatMessageSchema = createSelectSchema(chatMessages);