2023-04-14 11:33:19 +00:00
|
|
|
import { useMemo } from "react";
|
2023-02-09 11:24:15 +00:00
|
|
|
import { useIntl, FormattedMessage } from "react-intl";
|
2023-02-12 12:31:48 +00:00
|
|
|
import { useNavigate, Link } from "react-router-dom";
|
2023-04-14 11:33:19 +00:00
|
|
|
|
2023-02-05 18:02:13 +00:00
|
|
|
import { RecommendedFollows } from "Const";
|
2023-02-12 12:31:48 +00:00
|
|
|
import Logo from "Element/Logo";
|
2023-02-05 18:02:13 +00:00
|
|
|
import FollowListBase from "Element/FollowListBase";
|
2023-04-14 11:33:19 +00:00
|
|
|
import { clearEntropy } from "Login";
|
|
|
|
import useLogin from "Hooks/useLogin";
|
2023-05-10 09:29:22 +00:00
|
|
|
import TrendingUsers from "Element/TrendingUsers";
|
2023-02-05 18:02:13 +00:00
|
|
|
|
2023-02-09 11:24:15 +00:00
|
|
|
import messages from "./messages";
|
2023-02-05 18:02:13 +00:00
|
|
|
|
2023-02-09 11:24:15 +00:00
|
|
|
export default function DiscoverFollows() {
|
|
|
|
const { formatMessage } = useIntl();
|
2023-04-14 11:33:19 +00:00
|
|
|
const login = useLogin();
|
2023-02-12 12:31:48 +00:00
|
|
|
const navigate = useNavigate();
|
2023-02-09 11:24:15 +00:00
|
|
|
const sortedReccomends = useMemo(() => {
|
2023-04-04 13:40:51 +00:00
|
|
|
return RecommendedFollows.sort(() => (Math.random() >= 0.5 ? -1 : 1)).map(a => a.toLowerCase());
|
2023-02-07 20:04:50 +00:00
|
|
|
}, []);
|
2023-02-05 18:02:13 +00:00
|
|
|
|
2023-03-10 19:15:52 +00:00
|
|
|
async function clearEntropyAndGo() {
|
2023-04-14 11:33:19 +00:00
|
|
|
clearEntropy(login);
|
2023-03-10 19:15:52 +00:00
|
|
|
navigate("/");
|
|
|
|
}
|
|
|
|
|
2023-02-07 20:04:50 +00:00
|
|
|
return (
|
2023-02-13 10:47:52 +00:00
|
|
|
<div className="main-content new-user" dir="auto">
|
2023-02-12 12:31:48 +00:00
|
|
|
<Logo />
|
2023-02-09 11:24:15 +00:00
|
|
|
<div className="progress-bar">
|
|
|
|
<div className="progress"></div>
|
|
|
|
</div>
|
|
|
|
<h1>
|
|
|
|
<FormattedMessage {...messages.Ready} />
|
|
|
|
</h1>
|
|
|
|
<p>
|
|
|
|
<FormattedMessage {...messages.Share} values={{ link: <Link to="/">{formatMessage(messages.World)}</Link> }} />
|
|
|
|
</p>
|
2023-02-12 12:31:48 +00:00
|
|
|
<div className="next-actions continue-actions">
|
2023-03-10 19:15:52 +00:00
|
|
|
<button type="button" onClick={() => clearEntropyAndGo()}>
|
2023-02-12 12:31:48 +00:00
|
|
|
<FormattedMessage {...messages.Done} />{" "}
|
|
|
|
</button>
|
|
|
|
</div>
|
2023-02-09 11:24:15 +00:00
|
|
|
<h3>
|
|
|
|
<FormattedMessage {...messages.PopularAccounts} />
|
|
|
|
</h3>
|
2023-05-10 09:29:22 +00:00
|
|
|
<div>{sortedReccomends.length > 0 && <FollowListBase pubkeys={sortedReccomends} />}</div>
|
|
|
|
<TrendingUsers />
|
2023-02-09 11:24:15 +00:00
|
|
|
</div>
|
2023-02-07 20:04:50 +00:00
|
|
|
);
|
|
|
|
}
|