diff --git a/packages/app/src/Pages/DeckLayout.tsx b/packages/app/src/Pages/DeckLayout.tsx index a52aeaee1..054075123 100644 --- a/packages/app/src/Pages/DeckLayout.tsx +++ b/packages/app/src/Pages/DeckLayout.tsx @@ -1,6 +1,6 @@ import "./Deck.css"; -import { CSSProperties, useContext, useState } from "react"; -import { Outlet } from "react-router-dom"; +import { CSSProperties, useContext, useEffect, useState } from "react"; +import { Outlet, useNavigate } from "react-router-dom"; import { FormattedMessage } from "react-intl"; import { NostrPrefix, createNostrLink } from "@snort/system"; @@ -19,70 +19,39 @@ import { Thread } from "Element/Thread"; import { RootTabs } from "Element/RootTabs"; import { SpotlightMedia } from "Element/SpotlightMedia"; import { ThreadContext, ThreadContextWrapper } from "Hooks/useThreadContext"; +import Toaster from "Toaster"; +import useLogin from "Hooks/useLogin"; + +type Cols = "notes" | "articles" | "media" | "streams" | "notifications"; export function SnortDeckLayout() { + const login = useLogin(); + const navigate = useNavigate(); const [thread, setThread] = useState(); useLoginFeed(); useTheme(); useLoginRelays(); - const { proxy } = useImgProxy(); + useEffect(() => { + if (!login.publicKey) { + navigate("/"); + } + }, [login]); + + if (!login.publicKey) return null; + const cols = ["notes", "media", "notifications", "articles"] as Array; return
-
-
-
- - -
-
- -
-
-
- -
-
-
-
- - -
-
- -
-
-
-
- - -
-
- { - const parsed = transformTextCached(e.id, e.content, e.tags); - const images = parsed.filter(a => a.type === "media" && a.mimeType?.startsWith("image/")); - return images.length > 0; - }} noteRenderer={e => { - const parsed = transformTextCached(e.id, e.content, e.tags); - const images = parsed.filter(a => a.type === "media" && a.mimeType?.startsWith("image/")); - - return
setThread(e.id)}>
- }} /> -
-
-
-
- - -
-
- -
-
+ {cols.map(c => { + switch (c) { + case "notes": return + case "media": return + case "articles": return + case "notifications": return + } + })}
{thread && <> setThread(undefined)} className="thread-overlay"> @@ -94,6 +63,7 @@ export function SnortDeckLayout() { } +
} @@ -104,4 +74,78 @@ function SpotlightFromThread({ onClose }: { onClose: () => void }) { const images = parsed.filter(a => a.type === "media" && a.mimeType?.startsWith("image/")); return a.content)} idx={0} onClose={onClose} /> +} + +function NotesCol() { + return ( +
+
+
+ + +
+
+ +
+
+
+ +
+
+ ); +} + +function ArticlesCol() { + return ( +
+
+ + +
+
+ +
+
+ ); +} + +function MediaCol({ setThread }: { setThread: (e: string) => void }) { + const { proxy } = useImgProxy(); + return ( +
+
+ + +
+
+ { + const parsed = transformTextCached(e.id, e.content, e.tags); + const images = parsed.filter(a => a.type === "media" && a.mimeType?.startsWith("image/")); + return images.length > 0; + }} noteRenderer={e => { + const parsed = transformTextCached(e.id, e.content, e.tags); + const images = parsed.filter(a => a.type === "media" && a.mimeType?.startsWith("image/")); + + return
setThread(e.id)}>
+ }} /> +
+
+ ); +} + +function NotificationsCol() { + + return ( +
+
+ + +
+
+ +
+
+ ); } \ No newline at end of file diff --git a/packages/app/src/Pages/Layout.tsx b/packages/app/src/Pages/Layout.tsx index 3963c6adb..10864cde2 100644 --- a/packages/app/src/Pages/Layout.tsx +++ b/packages/app/src/Pages/Layout.tsx @@ -4,6 +4,7 @@ import { useDispatch, useSelector } from "react-redux"; import { Link, Outlet, useLocation, useNavigate } from "react-router-dom"; import { FormattedMessage, useIntl } from "react-intl"; import { useUserProfile } from "@snort/system-react"; +import { NostrPrefix, createNostrLink, tryParseNostrLink } from "@snort/system"; import messages from "./messages"; @@ -19,7 +20,6 @@ import { profileLink } from "SnortUtils"; import { getCurrentSubscription } from "Subscription"; import Toaster from "Toaster"; import Spinner from "Icons/Spinner"; -import { NostrPrefix, createNostrLink, tryParseNostrLink } from "@snort/system"; import { fetchNip05Pubkey } from "Nip05/Verifier"; import { useTheme } from "Hooks/useTheme"; import { useLoginRelays } from "Hooks/useLoginRelays";