for you feed etc

This commit is contained in:
Martti Malmi
2024-01-13 22:44:16 +02:00
parent 2ab2001014
commit 35ec58377c
18 changed files with 469 additions and 269 deletions

View File

@ -5,6 +5,7 @@ import Icon from "@/Components/Icons/Icon";
import { Newest } from "@/Utils/Login";
export type RootTab =
| "for-you"
| "following"
| "followed-by-friends"
| "conversations"
@ -16,6 +17,17 @@ export type RootTab =
export function rootTabItems(base: string, pubKey: string | undefined, tags: Newest<Array<string>>) {
const menuItems = [
{
tab: "for-you",
path: `${base}/for-you`,
show: Boolean(pubKey) && CONFIG.features.forYouFeed,
element: (
<>
<Icon name="user-v2" />
<FormattedMessage defaultMessage="For you" id="xEjBS7" />
</>
),
},
{
tab: "following",
path: `${base}/notes`,

View File

@ -25,7 +25,7 @@ export function RootTabs({ base = "/" }: { base: string }) {
const defaultTab = pubKey ? preferences.defaultRootTab ?? `${base}/notes` : `${base}/trending/notes`;
const initialPathname = location.pathname === "/" ? defaultTab : location.pathname;
const initialRootType = menuItems.find(a => a.path === initialPathname)?.tab || "following";
const initialRootType = menuItems.find(a => a.path === initialPathname)?.tab || "for-you";
const [rootType, setRootType] = useState<RootTab>(initialRootType);