defaultPreferences.defaultRootTab
continuous-integration/drone/push Build is running Details

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,
"communityLeaders": true,
"nostrAddress": true,
"pushNotifications": true,
"forYouFeed": false
"pushNotifications": true
},
"signUp": {
"quickStart": false,
"defaultFollows": ["npub1sn0rtcjcf543gj4wsg7fa59s700d5ztys5ctj0g69g2x6802npjqhjjtws"]
},
"defaultPreferences": {
"hideMutedNotes": false
"hideMutedNotes": false,
"defaultRootTab": "following"
},
"media": {
"bypassImgProxyError": false,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,5 +8,5 @@ export const DefaultTab = () => {
}));
const tab = publicKey ? preferences.defaultRootTab : `trending/notes`;
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 { NotEncrypted } from "@snort/system";
import { SnortContext } from "@snort/system-react";
import classNames from "classnames";
import { FormEvent, useContext, useState } from "react";
import { FormattedMessage, useIntl } from "react-intl";
@ -12,7 +13,6 @@ import { trackEvent } from "@/Utils";
import { generateNewLogin, LoginSessionType, LoginStore } from "@/Utils/Login";
import { NewUserState } from ".";
import { SnortContext } from "@snort/system-react";
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,
} as UserPreferences)
}>
{CONFIG.features.forYouFeed && (
<option value="for-you">
<FormattedMessage defaultMessage="For you" id="xEjBS7" />
</option>
)}
<option value="for-you">
<FormattedMessage defaultMessage="For you" id="xEjBS7" />
</option>
<option value="following">
<FormattedMessage defaultMessage="Notes" id="7+Domh" />
</option>

View File

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