-
diff --git a/src/renderer/_default.page.server.tsx b/src/renderer/_default.page.server.tsx
index 52a010e3..abce7dfa 100644
--- a/src/renderer/_default.page.server.tsx
+++ b/src/renderer/_default.page.server.tsx
@@ -30,7 +30,7 @@ export function render(pageContext: PageContextServer) {
}
return escapeInject`
-
+
diff --git a/src/shared/appHeader.tsx b/src/shared/appHeader.tsx
index 62f79103..e7001de4 100644
--- a/src/shared/appHeader.tsx
+++ b/src/shared/appHeader.tsx
@@ -1,16 +1,8 @@
import ArrowLeftIcon from "@icons/arrowLeft";
import ArrowRightIcon from "@icons/arrowRight";
import EventCollector from "@shared/eventCollector";
-import useSWR from "swr";
-
-const fetcher = async () => {
- const { platform } = await import("@tauri-apps/api/os");
- return await platform();
-};
-
-export default function AppHeader() {
- const { data: platform } = useSWR("platform", fetcher);
+export function AppHeader() {
const goBack = () => {
window.history.back();
};
@@ -19,10 +11,6 @@ export default function AppHeader() {
window.history.forward();
};
- const reload = () => {
- window.location.reload();
- };
-
return (
state.account);
const now = useRef(new Date());
@@ -60,8 +54,6 @@ export default function EventCollector() {
event.created_at,
parentID,
);
- // notify user reload to get newer note
- setHasNewerNote(true);
break;
}
// contacts
@@ -78,6 +70,7 @@ export default function EventCollector() {
account.pubkey,
event.pubkey,
event.content,
+ event.tags,
event.created_at,
);
break;
@@ -106,13 +99,20 @@ export default function EventCollector() {
});
useEffect(() => {
- // listen window close event
- getCurrent().listen(TauriEvent.WINDOW_CLOSE_REQUESTED, () => {
- // update last login time
- updateLastLogin(dateToUnix(now.current));
- // close window
- appWindow.close();
- });
+ async function initWindowEvent() {
+ const { TauriEvent } = await import("@tauri-apps/api/event");
+ const { appWindow, getCurrent } = await import("@tauri-apps/api/window");
+
+ // listen window close event
+ getCurrent().listen(TauriEvent.WINDOW_CLOSE_REQUESTED, () => {
+ // update last login time
+ updateLastLogin(dateToUnix(now.current));
+ // close window
+ appWindow.close();
+ });
+ }
+
+ initWindowEvent().catch(console.error);
}, []);
return (
diff --git a/src/shared/form/imagePicker.tsx b/src/shared/form/imagePicker.tsx
index 0e31a1fa..390b5cc8 100644
--- a/src/shared/form/imagePicker.tsx
+++ b/src/shared/form/imagePicker.tsx
@@ -2,7 +2,6 @@ import PlusIcon from "@icons/plus";
import { channelContentAtom } from "@stores/channel";
import { chatContentAtom } from "@stores/chat";
-import { noteContentAtom } from "@stores/note";
import { createBlobFromFile } from "@utils/createBlobFromFile";
@@ -15,9 +14,6 @@ export function ImagePicker({ type }: { type: string }) {
let atom;
switch (type) {
- case "note":
- atom = noteContentAtom;
- break;
case "chat":
atom = chatContentAtom;
break;
diff --git a/src/shared/navigation.tsx b/src/shared/navigation.tsx
index f3b69b0c..7d1a62fa 100644
--- a/src/shared/navigation.tsx
+++ b/src/shared/navigation.tsx
@@ -5,7 +5,7 @@ import NavArrowDownIcon from "@icons/navArrowDown";
import ThreadsIcon from "@icons/threads";
import WorldIcon from "@icons/world";
import ActiveLink from "@shared/activeLink";
-import AppHeader from "@shared/appHeader";
+import { AppHeader } from "@shared/appHeader";
import { ComposerModal } from "@shared/composer/modal";
export default function Navigation() {
diff --git a/src/stores/chat.tsx b/src/stores/chat.tsx
deleted file mode 100644
index d2d3c5db..00000000
--- a/src/stores/chat.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { atom } from "jotai";
-import { atomWithReset } from "jotai/utils";
-
-export const chatMessagesAtom = atomWithReset([]);
-export const sortedChatMessagesAtom = atom((get) => {
- const messages = get(chatMessagesAtom);
- return messages.sort(
- (x: { created_at: number }, y: { created_at: number }) =>
- x.created_at - y.created_at,
- );
-});
-
-// chat content
-export const chatContentAtom = atomWithReset("");
diff --git a/src/utils/storage.tsx b/src/utils/storage.tsx
index 50c8bccc..f3da1d0f 100644
--- a/src/utils/storage.tsx
+++ b/src/utils/storage.tsx
@@ -297,12 +297,13 @@ export async function createChat(
receiver_pubkey: string,
sender_pubkey: string,
content: string,
+ tags: string[][],
created_at: number,
) {
const db = await connect();
return await db.execute(
- "INSERT OR IGNORE INTO chats (event_id, receiver_pubkey, sender_pubkey, content, created_at) VALUES (?, ?, ?, ?, ?);",
- [event_id, receiver_pubkey, sender_pubkey, content, created_at],
+ "INSERT OR IGNORE INTO chats (event_id, receiver_pubkey, sender_pubkey, content, tags, created_at) VALUES (?, ?, ?, ?, ?, ?);",
+ [event_id, receiver_pubkey, sender_pubkey, content, tags, created_at],
);
}