diff --git a/app/src/database/index.ts b/app/src/database/index.ts
index ace4ca0..ce5afee 100644
--- a/app/src/database/index.ts
+++ b/app/src/database/index.ts
@@ -42,6 +42,13 @@ export async function getConfiguration(): Promise {
return configuration;
}
+export async function getGroups(): Promise {
+ const database = await openDatabase;
+ const transaction = database.transaction("groups", "readonly");
+ const store = transaction.objectStore("groups");
+ return (await store.getAll()) as Group[];
+}
+
export async function getGroup(groupId: string): Promise {
const database = await openDatabase;
const transaction = database.transaction("groups", "readonly");
diff --git a/app/src/routes/index.tsx b/app/src/routes/index.tsx
index 897a58a..40aaf5b 100644
--- a/app/src/routes/index.tsx
+++ b/app/src/routes/index.tsx
@@ -3,6 +3,8 @@ import Onboarding from "../components/Onboarding";
import { useAppContext } from "../components/AppContext";
import TopAppBar from "../components/TopAppBar";
import { setupCrackle } from "../useCrackle";
+import { getGroups } from "../database";
+import { ROUTES } from ".";
// https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-@import-tag
/** @import { Signal, JSX, Accessor, ParentProps } from "solid-js" */
/** @import { Message } from "../components/AppContext" */
@@ -27,21 +29,20 @@ function FloatingActionButton() {
);
}
-function ChatList() {
- const [app, setApp] = useAppContext();
+async function signOut() {
+ //TODO make sign out not suddenly delete everything
+ const handle = await setupCrackle;
+ await handle.wipe();
+}
+function ChatList() {
+ const [groups] = createResource(getGroups);
return (
+ )}
-
+
{
/** @type {(item: Accessor) => JSX.Element} */ (
message
) => {
- const dateString = message().sent.toLocaleDateString();
+ const dateString =
+ message().sentAt.toLocaleDateString();
const isToday =
dateString === new Date().toLocaleDateString();
@@ -115,14 +111,14 @@ function ChatList() {
"Is today?",
isToday,
dateString,
- message().sent.toLocaleTimeString()
+ message().sentAt.toLocaleTimeString()
);
return (
//TODO format date correctly for datetime attribute