defaultPreferences.defaultRootTab
Some checks are pending
continuous-integration/drone/push Build is running

This commit is contained in:
Martti Malmi 2024-02-12 11:55:14 +02:00
parent 3e43300077
commit 18c366502c
10 changed files with 17 additions and 18 deletions

View File

@ -18,15 +18,15 @@
"notificationGraph": true, "notificationGraph": true,
"communityLeaders": true, "communityLeaders": true,
"nostrAddress": true, "nostrAddress": true,
"pushNotifications": true, "pushNotifications": true
"forYouFeed": false
}, },
"signUp": { "signUp": {
"quickStart": false, "quickStart": false,
"defaultFollows": ["npub1sn0rtcjcf543gj4wsg7fa59s700d5ztys5ctj0g69g2x6802npjqhjjtws"] "defaultFollows": ["npub1sn0rtcjcf543gj4wsg7fa59s700d5ztys5ctj0g69g2x6802npjqhjjtws"]
}, },
"defaultPreferences": { "defaultPreferences": {
"hideMutedNotes": false "hideMutedNotes": false,
"defaultRootTab": "following"
}, },
"media": { "media": {
"bypassImgProxyError": false, "bypassImgProxyError": false,

View File

@ -16,11 +16,11 @@
"deck": true, "deck": true,
"zapPool": true, "zapPool": true,
"notificationGraph": false, "notificationGraph": false,
"communityLeaders": true, "communityLeaders": true
"forYouFeed": true
}, },
"defaultPreferences": { "defaultPreferences": {
"hideMutedNotes": true "hideMutedNotes": true,
"defaultRootTab": "for-you"
}, },
"signUp": { "signUp": {
"quickStart": true, "quickStart": true,

View File

@ -25,7 +25,8 @@
"defaultFollows": [] "defaultFollows": []
}, },
"defaultPreferences": { "defaultPreferences": {
"hideMutedNotes": false "hideMutedNotes": false,
"defaultRootTab": "following"
}, },
"media": { "media": {
"bypassImgProxyError": false, "bypassImgProxyError": false,

View File

@ -61,10 +61,10 @@ declare const CONFIG: {
communityLeaders: boolean; communityLeaders: boolean;
nostrAddress: boolean; nostrAddress: boolean;
pushNotifications: boolean; pushNotifications: boolean;
forYouFeed: boolean;
}; };
defaultPreferences: { defaultPreferences: {
hideMutedNotes: boolean; hideMutedNotes: boolean;
defaultRootTab: "following" | "for-you";
}; };
signUp: { signUp: {
quickStart: boolean; quickStart: boolean;

View File

@ -10,7 +10,7 @@ export function rootTabItems(base: string, pubKey: string | undefined, tags: New
{ {
tab: "for-you", tab: "for-you",
path: `${base}/for-you`, path: `${base}/for-you`,
show: Boolean(pubKey) && CONFIG.features.forYouFeed, show: Boolean(pubKey),
element: ( element: (
<> <>
<Icon name="user-v2" /> <Icon name="user-v2" />

View File

@ -26,7 +26,7 @@ export function RootTabs({ base = "/" }: { base: string }) {
let defaultTab: RootTabRoutePath; let defaultTab: RootTabRoutePath;
if (pubKey) { if (pubKey) {
defaultTab = preferences.defaultRootTab ?? (CONFIG.features.forYouFeed ? "for-you" : "following"); defaultTab = preferences.defaultRootTab;
} else { } else {
defaultTab = `trending/notes`; defaultTab = `trending/notes`;
} }

View File

@ -8,5 +8,5 @@ export const DefaultTab = () => {
})); }));
const tab = publicKey ? preferences.defaultRootTab : `trending/notes`; const tab = publicKey ? preferences.defaultRootTab : `trending/notes`;
const elm = RootTabRoutes.find(a => a.path === tab)?.element; const elm = RootTabRoutes.find(a => a.path === tab)?.element;
return elm ?? RootTabRoutes.find(a => a.path === (CONFIG.features.forYouFeed ? "for-you" : "following"))?.element; return elm ?? RootTabRoutes.find(a => a.path === preferences.defaultRootTab)?.element;
}; };

View File

@ -1,5 +1,6 @@
import { unwrap } from "@snort/shared"; import { unwrap } from "@snort/shared";
import { NotEncrypted } from "@snort/system"; import { NotEncrypted } from "@snort/system";
import { SnortContext } from "@snort/system-react";
import classNames from "classnames"; import classNames from "classnames";
import { FormEvent, useContext, useState } from "react"; import { FormEvent, useContext, useState } from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
@ -12,7 +13,6 @@ import { trackEvent } from "@/Utils";
import { generateNewLogin, LoginSessionType, LoginStore } from "@/Utils/Login"; import { generateNewLogin, LoginSessionType, LoginStore } from "@/Utils/Login";
import { NewUserState } from "."; import { NewUserState } from ".";
import { SnortContext } from "@snort/system-react";
const NSEC_NPUB_REGEX = /(nsec1|npub1)[a-zA-Z0-9]{20,65}/gi; const NSEC_NPUB_REGEX = /(nsec1|npub1)[a-zA-Z0-9]{20,65}/gi;

View File

@ -84,11 +84,9 @@ const PreferencesPage = () => {
defaultRootTab: e.target.value, defaultRootTab: e.target.value,
} as UserPreferences) } as UserPreferences)
}> }>
{CONFIG.features.forYouFeed && ( <option value="for-you">
<option value="for-you"> <FormattedMessage defaultMessage="For you" id="xEjBS7" />
<FormattedMessage defaultMessage="For you" id="xEjBS7" /> </option>
</option>
)}
<option value="following"> <option value="following">
<FormattedMessage defaultMessage="Notes" id="7+Domh" /> <FormattedMessage defaultMessage="Notes" id="7+Domh" />
</option> </option>

View File

@ -114,7 +114,7 @@ export const DefaultPreferences = {
autoShowLatest: false, autoShowLatest: false,
fileUploader: "void.cat", fileUploader: "void.cat",
imgProxyConfig: DefaultImgProxy, imgProxyConfig: DefaultImgProxy,
defaultRootTab: CONFIG.features.forYouFeed ? "for-you" : "following", defaultRootTab: "following",
defaultZapAmount: 50, defaultZapAmount: 50,
autoZap: false, autoZap: false,
telemetry: true, telemetry: true,