diff --git a/apps/web/package.json b/apps/web/package.json index 8679e16c..2832f96d 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -42,7 +42,7 @@ "@swc/plugin-relay": "^1.5.36", "@types/react": "^18.0.26", "@types/react-dom": "^18.0.9", - "@vitejs/plugin-react": "3.0.1", + "@vitejs/plugin-react": "4.1.0", "autoprefixer": "^10.4.14", "postcss": "^8.4.23", "relay-compiler": "^14.1.0", diff --git a/apps/web/src/components/InboxList.tsx b/apps/web/src/components/InboxList.tsx index 408d2de5..c4a6fd4c 100644 --- a/apps/web/src/components/InboxList.tsx +++ b/apps/web/src/components/InboxList.tsx @@ -1,7 +1,7 @@ import { graphql, useFragment, useSmartSubscription } from "@flowdev/relay"; import { ItemCard } from "./ItemCard"; import { ReactSortable } from "react-sortablejs"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { Button } from "@flowdev/ui/Button"; import { NewItemCard } from "./NewItemCard"; import { InboxListSubscription } from "../relay/__generated__/InboxListSubscription.graphql"; @@ -10,7 +10,41 @@ import { InboxListItemToBeInList_item$key } from "../relay/__generated__/InboxLi type InboxListProps = {}; export const InboxList = (props: InboxListProps) => { - const [showNewTaskCard, setShowNewTaskCard] = useState(false); + const [showNewItemCard, setShowNewItemCard] = useState(false); + const [itemsConnectionId, setItemsConnectionId] = useState(null); + + return ( +
+
+
Inbox
+
+ Quickly add items to your inbox so you can triage them later. +
+
+ + {showNewItemCard && itemsConnectionId && ( + setShowNewItemCard(false)} + onCancel={() => setShowNewItemCard(false)} + /> + )} +
+
+ +
+ ); +}; + +const InboxListItems = (props: { onItemsConnectionIdChange: (id: string) => void }) => { const [data] = useSmartSubscription(graphql` subscription InboxListSubscription { items( @@ -57,45 +91,24 @@ export const InboxList = (props: InboxListProps) => { }) ?? [], ); - if (!data) return null; // TODO: loading state + useEffect(() => { + if (data?.items.__id) { + props.onItemsConnectionIdChange(data.items.__id); + } + }, [data?.items.__id]); return ( -
-
-
Inbox
-
- Quickly add items to your inbox so you can triage them later. -
-
- - {showNewTaskCard && ( - setShowNewTaskCard(false)} - onCancel={() => setShowNewTaskCard(false)} - /> - )} + {}} + group="shared" + className="no-scrollbar flex h-full flex-col overflow-y-scroll px-4" + > + {items.map((item) => ( +
+
-
- {}} - group="shared" - className="no-scrollbar flex h-full flex-col overflow-y-scroll px-4" - > - {items.map((item) => ( -
- -
- ))} -
-
+ ))} + ); }; diff --git a/bun.lockb b/bun.lockb index 584d28d5..4dbcca46 100755 Binary files a/bun.lockb and b/bun.lockb differ