diff --git a/src/components/accountProvider.tsx b/src/components/accountProvider.tsx
index 6ee37d1e..fcdcb896 100644
--- a/src/components/accountProvider.tsx
+++ b/src/components/accountProvider.tsx
@@ -2,7 +2,7 @@ import { createContext } from 'react';
export const AccountContext = createContext({});
-let activeAccount: any = { id: '', pubkey: '', follows: null, metadata: '' };
+let activeAccount: any = { id: '', pubkey: '', follows: null, metadata: {} };
if (typeof window !== 'undefined') {
const { getActiveAccount } = await import('@utils/storage');
diff --git a/src/components/activeLink.tsx b/src/components/activeLink.tsx
index 5233bce0..b3f1d7be 100644
--- a/src/components/activeLink.tsx
+++ b/src/components/activeLink.tsx
@@ -2,7 +2,7 @@ import { usePageContext } from '@utils/hooks/usePageContext';
import { twMerge } from 'tailwind-merge';
-export function ActiveLink({
+export default function ActiveLink({
href,
className,
activeClassName,
diff --git a/src/components/appHeader.tsx b/src/components/appHeader.tsx
new file mode 100644
index 00000000..d3b2ba8b
--- /dev/null
+++ b/src/components/appHeader.tsx
@@ -0,0 +1,53 @@
+import EventCollector from '@components/eventCollector';
+
+import { ArrowLeft, ArrowRight, Refresh } from 'iconoir-react';
+
+let platformName = 'darwin';
+
+if (typeof window !== 'undefined') {
+ const { platform } = await import('@tauri-apps/api/os');
+ platformName = await platform();
+}
+
+export default function AppHeader({ collector }: { collector: boolean }) {
+ const goBack = () => {
+ window.history.back();
+ };
+
+ const goForward = () => {
+ window.history.forward();
+ };
+
+ const reload = () => {
+ window.location.reload();
+ };
+
+ return (
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/components/appHeader/actions.tsx b/src/components/appHeader/actions.tsx
deleted file mode 100644
index 911e510d..00000000
--- a/src/components/appHeader/actions.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { ArrowLeft, ArrowRight, Refresh } from 'iconoir-react';
-
-export default function AppActions() {
- const goBack = () => {
- window.history.back();
- };
-
- const goForward = () => {
- window.history.forward();
- };
-
- const reload = () => {
- window.location.reload();
- };
-
- return (
-
-
-
-
-
- );
-}
diff --git a/src/components/appHeader/index.tsx b/src/components/appHeader/index.tsx
deleted file mode 100644
index 7f10a490..00000000
--- a/src/components/appHeader/index.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import AppActions from '@components/appHeader/actions';
-import EventCollector from '@components/eventCollector';
-
-export default function AppHeader({ collector }: { collector: boolean }) {
- return (
-
- );
-}
diff --git a/src/components/channels/channelListItem.tsx b/src/components/channels/channelListItem.tsx
index 4b24d242..083da565 100644
--- a/src/components/channels/channelListItem.tsx
+++ b/src/components/channels/channelListItem.tsx
@@ -6,16 +6,7 @@ import { usePageContext } from '@utils/hooks/usePageContext';
import { twMerge } from 'tailwind-merge';
export const ChannelListItem = ({ data }: { data: any }) => {
- let metadata: any;
-
- if (typeof data.metadata === 'object') {
- metadata = data.metadata;
- } else {
- const json = JSON.parse(data.metadata);
- metadata = json;
- }
-
- const channel: any = useChannelMetadata(data.event_id, metadata);
+ const channel: any = useChannelMetadata(data.event_id, data.metadata);
const pageContext = usePageContext();
const searchParams: any = pageContext.urlParsed.search;
diff --git a/src/components/chats/chatList.tsx b/src/components/chats/chatList.tsx
index 3f0eac6a..378a6d29 100644
--- a/src/components/chats/chatList.tsx
+++ b/src/components/chats/chatList.tsx
@@ -17,18 +17,18 @@ if (typeof window !== 'undefined') {
export default function ChatList() {
const activeAccount: any = useContext(AccountContext);
- const profile = activeAccount ? JSON.parse(activeAccount.metadata) : null;
+ const profile = typeof window !== 'undefined' ? JSON.parse(activeAccount.metadata) : null;
return (
diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx
index c60ed5ba..43c2fb66 100644
--- a/src/components/navigation.tsx
+++ b/src/components/navigation.tsx
@@ -1,4 +1,4 @@
-import { ActiveLink } from '@components/activeLink';
+import ActiveLink from '@components/activeLink';
import ChannelList from '@components/channels/channelList';
import ChatList from '@components/chats/chatList';
diff --git a/src/utils/hooks/useChannelMetadata.tsx b/src/utils/hooks/useChannelMetadata.tsx
index 2f9208b9..d6795464 100644
--- a/src/utils/hooks/useChannelMetadata.tsx
+++ b/src/utils/hooks/useChannelMetadata.tsx
@@ -6,9 +6,18 @@ import { updateChannelMetadata } from '@utils/storage';
import { useCallback, useContext, useEffect, useState } from 'react';
-export const useChannelMetadata = (id: string, fallback: string) => {
+export const useChannelMetadata = (id: string, fallback: any) => {
+ let parseFallback: any;
+
+ if (typeof fallback === 'object') {
+ parseFallback = fallback.metadata;
+ } else {
+ const json = JSON.parse(fallback.metadata);
+ parseFallback = json;
+ }
+
const pool: any = useContext(RelayContext);
- const [metadata, setMetadata] = useState(fallback);
+ const [metadata, setMetadata] = useState(parseFallback);
const fetchMetadata = useCallback(() => {
const unsubscribe = pool.subscribe(