Skip to content

Commit 9ba1c73

Browse files
joshsnyjonathanlabclaude
authored
chore: move api state out of zustand (#16)
Co-authored-by: JonathanLab <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent a94cf83 commit 9ba1c73

27 files changed

+984
-875
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pnpm run lint # Linting
3838
You can set these environment variables instead of entering credentials in the app:
3939

4040
- `POSTHOG_API_KEY` - Your PostHog personal API key
41-
- `POSTHOG_API_HOST` - PostHog instance URL (defaults to https://app.posthog.com)
41+
- `POSTHOG_API_HOST` - PostHog instance URL (defaults to https://us.posthog.com)
4242

4343
## Architecture
4444

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@
6262
"@posthog/agent": "^1.3.1",
6363
"@radix-ui/react-icons": "^1.3.2",
6464
"@radix-ui/themes": "^3.2.1",
65+
"@tanstack/react-query": "^5.90.2",
6566
"axios": "^1.6.7",
6667
"clsx": "^2.1.0",
6768
"cmdk": "^1.1.1",
6869
"date-fns": "^3.3.1",
6970
"radix-themes-tw": "0.2.3",
7071
"react": "^18.2.0",
7172
"react-dom": "^18.2.0",
73+
"react-hook-form": "^7.64.0",
7274
"react-hotkeys-hook": "^4.4.4",
7375
"socket.io-client": "^4.7.4",
7476
"uuid": "^9.0.1",

pnpm-lock.yaml

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/posthogClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class PostHogAPIClient {
6464
title: string,
6565
description: string,
6666
repositoryConfig?: { organization: string; repository: string },
67+
workflowId?: string,
6768
) {
6869
const teamId = await this.getTeamId();
6970

@@ -72,6 +73,7 @@ export class PostHogAPIClient {
7273
description,
7374
origin_product: "user_created" as const,
7475
...(repositoryConfig && { repository_config: repositoryConfig }),
76+
...(workflowId && { workflow: workflowId }),
7577
};
7678

7779
const data = await this.api.post(`/api/projects/{project_id}/tasks/`, {

src/renderer/components/AuthScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function AuthScreen() {
9696
type="url"
9797
value={apiHost}
9898
onChange={(e) => setApiHost(e.target.value)}
99-
placeholder="https://app.posthog.com"
99+
placeholder="https://us.posthog.com"
100100
required
101101
/>
102102
</Flex>

src/renderer/components/Combobox.tsx

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ interface ComboboxProps {
1717
emptyMessage?: string;
1818
size?: "1" | "2" | "3";
1919
variant?: "classic" | "surface" | "soft" | "ghost";
20-
allowNone?: boolean;
21-
noneLabel?: string;
2220
renderItem?: (item: ComboboxItem) => ReactNode;
2321
side?: "top" | "bottom" | "left" | "right";
2422
align?: "start" | "center" | "end";
@@ -33,31 +31,21 @@ export function Combobox({
3331
emptyMessage = "No items found",
3432
size = "2",
3533
variant = "surface",
36-
allowNone = true,
37-
noneLabel = "None",
3834
renderItem,
3935
side = "bottom",
4036
align = "start",
4137
}: ComboboxProps) {
4238
const [open, setOpen] = useState(false);
4339

4440
const selectedItem = useMemo(() => {
45-
if (!value || value === "__none__") return null;
41+
if (!value) return null;
4642
return items.find((item) => item.value === value);
4743
}, [value, items]);
4844

49-
const displayValue = selectedItem
50-
? selectedItem.label
51-
: value === "__none__"
52-
? noneLabel
53-
: placeholder;
45+
const displayValue = selectedItem ? selectedItem.label : placeholder;
5446

5547
const handleSelect = (selectedValue: string) => {
56-
if (selectedValue === value) {
57-
onValueChange("__none__");
58-
} else {
59-
onValueChange(selectedValue);
60-
}
48+
onValueChange(selectedValue);
6149
setOpen(false);
6250
};
6351

@@ -77,24 +65,6 @@ export function Combobox({
7765
<Command.List>
7866
<Command.Empty>{emptyMessage}</Command.Empty>
7967
<Command.Group>
80-
{allowNone && (
81-
<Command.Item
82-
value="__none__"
83-
onSelect={() => handleSelect("__none__")}
84-
>
85-
<Flex justify="between" align="center" gap="2" width="100%">
86-
<Text size={size} color="gray">
87-
{noneLabel}
88-
</Text>
89-
<CheckIcon
90-
className="mr-2 h-4 w-4"
91-
style={{
92-
opacity: value === "__none__" ? 1 : 0,
93-
}}
94-
/>
95-
</Flex>
96-
</Command.Item>
97-
)}
9868
{items.map((item) => {
9969
const isSelected = value === item.value;
10070
return (

src/renderer/components/MainLayout.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Box, Flex } from "@radix-ui/themes";
22
import type { Task } from "@shared/types";
3-
import { useEffect, useState } from "react";
3+
import { useState } from "react";
44
import { useHotkeys } from "react-hotkeys-hook";
5-
import { useIntegrationStore } from "../stores/integrationStore";
5+
import { useIntegrations } from "../hooks/useIntegrations";
66
import { useTabStore } from "../stores/tabStore";
77
import { CommandMenu } from "./command";
88
import { StatusBar } from "./StatusBar";
@@ -15,19 +15,11 @@ import { WorkflowView } from "./WorkflowView";
1515

1616
export function MainLayout() {
1717
const { activeTabId, tabs, createTab, setActiveTab } = useTabStore();
18-
const { fetchIntegrations } = useIntegrationStore();
18+
useIntegrations();
1919
const [commandMenuOpen, setCommandMenuOpen] = useState(false);
2020
const [taskCreateOpen, setTaskCreateOpen] = useState(false);
2121
const [workflowCreateOpen, setWorkflowCreateOpen] = useState(false);
2222

23-
useEffect(() => {
24-
fetchIntegrations();
25-
}, [fetchIntegrations]);
26-
27-
useEffect(() => {
28-
fetchIntegrations();
29-
}, [fetchIntegrations]);
30-
3123
useHotkeys("mod+k", () => setCommandMenuOpen((prev) => !prev), {
3224
enabled: !commandMenuOpen,
3325
});

0 commit comments

Comments
 (0)