refactor: move new users page to task
This commit is contained in:
parent
b238da4024
commit
7b6a813c8a
33
packages/app/src/Components/Tasks/FollowMorePeople.tsx
Normal file
33
packages/app/src/Components/Tasks/FollowMorePeople.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
import { CachedMetadata } from "@snort/system";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { BaseUITask } from "@/Components/Tasks/index";
|
||||
import { LoginSession } from "@/Utils/Login";
|
||||
|
||||
export class FollowMorePeopleTask extends BaseUITask {
|
||||
id = "follow-more-people";
|
||||
|
||||
check(_meta: CachedMetadata, session: LoginSession): boolean {
|
||||
return !this.state.muted && (session.state.follows?.length ?? 0) < 10;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="It looks like you dont follow enough people, take a look at {newUsersPage} to discover people to follow!"
|
||||
values={{
|
||||
newUsersPage: (
|
||||
<Link to={"/discover"}>
|
||||
<FormattedMessage defaultMessage="new users page" />
|
||||
</Link>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import useLogin from "@/Hooks/useLogin";
|
||||
|
||||
import { BackupKeyTask } from "./BackupKey";
|
||||
import { DonateTask } from "./DonateTask";
|
||||
import { FollowMorePeopleTask } from "./FollowMorePeople";
|
||||
import { Nip5Task } from "./Nip5Task";
|
||||
import { NoticeZapPoolDefault } from "./NoticeZapPool";
|
||||
import { RenewSubTask } from "./RenewSubscription";
|
||||
@ -20,7 +21,7 @@ class TaskStore extends ExternalStore<Array<UITask>> {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
const AllTasks: Array<UITask> = [new BackupKeyTask(), new Nip5Task()];
|
||||
const AllTasks: Array<UITask> = [new BackupKeyTask(), new FollowMorePeopleTask(), new Nip5Task()];
|
||||
if (CONFIG.features.zapPool) {
|
||||
AllTasks.push(new NoticeZapPoolDefault());
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
import SuggestedProfiles from "@/Components/SuggestedProfiles";
|
||||
import { Tab, TabSelector } from "@/Components/TabSelectors/TabSelectors";
|
||||
import TrendingNotes from "@/Components/Trending/TrendingPosts";
|
||||
import TrendingUsers from "@/Components/Trending/TrendingUsers";
|
||||
@ -10,20 +9,21 @@ export default function Discover() {
|
||||
const { formatMessage } = useIntl();
|
||||
// tabs
|
||||
const Tabs = {
|
||||
Follows: { text: formatMessage({ defaultMessage: "Suggested Follows", id: "C8HhVE" }), value: 0 },
|
||||
Posts: { text: formatMessage({ defaultMessage: "Trending Notes", id: "Ix8l+B" }), value: 1 },
|
||||
Profiles: { text: formatMessage({ defaultMessage: "Trending People", id: "CVWeJ6" }), value: 2 },
|
||||
Profiles: { text: formatMessage({ defaultMessage: "Trending People", id: "CVWeJ6" }), value: 0 },
|
||||
};
|
||||
const [tab, setTab] = useState<Tab>(Tabs.Follows);
|
||||
const [tab, setTab] = useState<Tab>(Tabs.Profiles);
|
||||
|
||||
function renderTab() {
|
||||
switch (tab.value) {
|
||||
case 0:
|
||||
return <SuggestedProfiles />;
|
||||
case 1:
|
||||
return <TrendingNotes />;
|
||||
case 2:
|
||||
return <TrendingUsers />;
|
||||
case 0:
|
||||
return (
|
||||
<div className="p">
|
||||
<TrendingUsers />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -31,7 +31,7 @@ export default function Discover() {
|
||||
return (
|
||||
<>
|
||||
<div className="tabs p">
|
||||
{[Tabs.Follows, Tabs.Posts, Tabs.Profiles].map(a => (
|
||||
{[Tabs.Profiles, Tabs.Posts].map(a => (
|
||||
<TabSelector key={a.value} tab={tab} setTab={setTab} t={a} />
|
||||
))}
|
||||
</div>
|
||||
|
@ -1,31 +1,9 @@
|
||||
import { NostrEvent, NostrLink } from "@snort/system";
|
||||
import { useContext, useMemo } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import TimelineFollows from "@/Components/Feed/TimelineFollows";
|
||||
import { TaskList } from "@/Components/Tasks/TaskList";
|
||||
import useFollowsControls from "@/Hooks/useFollowControls";
|
||||
import { DeckContext } from "@/Pages/Deck/DeckLayout";
|
||||
import messages from "@/Pages/messages";
|
||||
|
||||
const FollowsHint = () => {
|
||||
const { followList } = useFollowsControls();
|
||||
if (followList.length === 0) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
{...messages.NoFollows}
|
||||
values={{
|
||||
newUsersPage: (
|
||||
<Link to={"/discover"}>
|
||||
<FormattedMessage {...messages.NewUsers} />
|
||||
</Link>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export const NotesTab = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@ -42,7 +20,6 @@ export const NotesTab = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<FollowsHint />
|
||||
<TaskList />
|
||||
<TimelineFollows postsOnly={true} noteOnClick={noteOnClick} />
|
||||
</>
|
||||
|
@ -4,10 +4,6 @@ export default defineMessages({
|
||||
Login: { defaultMessage: "Login", id: "AyGauy" },
|
||||
Global: { defaultMessage: "Global", id: "EWyQH5" },
|
||||
NewUsers: { defaultMessage: "New users page", id: "NndBJE" },
|
||||
NoFollows: {
|
||||
defaultMessage: "Hmm nothing here.. Checkout {newUsersPage} to follow some recommended nostrich's!",
|
||||
id: "NdOYJJ",
|
||||
},
|
||||
Reactions: { defaultMessage: "Reactions", id: "XgWvGA" },
|
||||
Followers: { defaultMessage: "Followers", id: "pzTOmv" },
|
||||
FollowersCount: { defaultMessage: "{n} Followers", id: "3tVy+Z" },
|
||||
|
@ -898,9 +898,6 @@
|
||||
"NAuFNH": {
|
||||
"defaultMessage": "You already have a subscription of this type, please renew or pay"
|
||||
},
|
||||
"NdOYJJ": {
|
||||
"defaultMessage": "Hmm nothing here.. Checkout {newUsersPage} to follow some recommended nostrich's!"
|
||||
},
|
||||
"NepkXH": {
|
||||
"defaultMessage": "Can't vote with {amount} sats, please set a different default zap amount"
|
||||
},
|
||||
@ -1217,6 +1214,9 @@
|
||||
"YDURw6": {
|
||||
"defaultMessage": "Service URL"
|
||||
},
|
||||
"YQZY/S": {
|
||||
"defaultMessage": "It looks like you dont follow enough people, take a look at {newUsersPage} to discover people to follow!"
|
||||
},
|
||||
"YR2I9M": {
|
||||
"defaultMessage": "No keys, no {app}, There is no way to reset it if you don't back up. It only takes a minute."
|
||||
},
|
||||
@ -1578,6 +1578,9 @@
|
||||
"iYc3Ld": {
|
||||
"defaultMessage": "Payments"
|
||||
},
|
||||
"icCxlA": {
|
||||
"defaultMessage": "new users page"
|
||||
},
|
||||
"ieGrWo": {
|
||||
"defaultMessage": "Follow"
|
||||
},
|
||||
|
@ -297,7 +297,6 @@
|
||||
"N2IrpM": "Confirm",
|
||||
"NAidKb": "Notifications",
|
||||
"NAuFNH": "You already have a subscription of this type, please renew or pay",
|
||||
"NdOYJJ": "Hmm nothing here.. Checkout {newUsersPage} to follow some recommended nostrich's!",
|
||||
"NepkXH": "Can't vote with {amount} sats, please set a different default zap amount",
|
||||
"NndBJE": "New users page",
|
||||
"Nr9Yyx": "Reposts",
|
||||
@ -403,6 +402,7 @@
|
||||
"Xopqkl": "Your default zap amount is {number} sats, example values are calculated from this.",
|
||||
"YDMrKK": "Users",
|
||||
"YDURw6": "Service URL",
|
||||
"YQZY/S": "It looks like you dont follow enough people, take a look at {newUsersPage} to discover people to follow!",
|
||||
"YR2I9M": "No keys, no {app}, There is no way to reset it if you don't back up. It only takes a minute.",
|
||||
"YU7ZYp": "Public Chat",
|
||||
"YXA3AH": "Enable reactions",
|
||||
@ -523,6 +523,7 @@
|
||||
"iNWbVV": "Handle",
|
||||
"iXPL0Z": "Can't login with private key on an insecure connection, please use a Nostr key manager extension instead",
|
||||
"iYc3Ld": "Payments",
|
||||
"icCxlA": "new users page",
|
||||
"ieGrWo": "Follow",
|
||||
"ipHVx5": "Generate Invoice",
|
||||
"itPgxd": "Profile",
|
||||
|
Loading…
x
Reference in New Issue
Block a user