show trending hashtags instead of notes in sidebar if not logged in
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Martti Malmi 2023-12-05 20:49:16 +02:00
parent 79c3c3ffc1
commit 9e3032ce89
3 changed files with 28 additions and 11 deletions

View File

@ -1,27 +1,40 @@
import SearchBox from "@/Element/SearchBox"; import SearchBox from "@/Element/SearchBox";
import TrendingNotes from "@/Element/Trending/TrendingPosts"; import TrendingNotes from "@/Element/Trending/TrendingPosts";
import TrendingHashtags from "@/Element/Trending/TrendingHashtags";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import classNames from "classnames"; import classNames from "classnames";
import useLogin from "@/Hooks/useLogin";
export default function RightColumn() { export default function RightColumn() {
const { pubkey } = useLogin(s => ({ pubkey: s.publicKey }));
const hideRightColumnPaths = ["/login", "/new", "/messages", "/settings"]; const hideRightColumnPaths = ["/login", "/new", "/messages", "/settings"];
const show = !hideRightColumnPaths.some(path => location.pathname.startsWith(path)); const show = !hideRightColumnPaths.some(path => location.pathname.startsWith(path));
const getTitleMessage = () => {
return pubkey ? (
<FormattedMessage defaultMessage="Trending notes" id="6k7xfM" />
) : (
<FormattedMessage defaultMessage="Trending hashtags" id="CbM2hK" />
);
};
const getContent = () => {
return pubkey ? <TrendingNotes small={true} count={100} /> : <TrendingHashtags short={true} />;
};
return ( return (
<div <div
className={classNames("flex-col hidden lg:w-1/3 sticky top-0 h-screen py-3 px-4 border-l border-border-color", { className={classNames(
"lg:flex": show, "text-secondary flex-col hidden lg:w-1/3 sticky top-0 h-screen py-3 px-4 border-l border-border-color",
})}> {
"lg:flex": show,
},
)}>
<div> <div>
<SearchBox /> <SearchBox />
</div> </div>
<div className="overflow-y-auto hide-scrollbar"> <div className="font-bold text-lg mt-4 mb-2">{getTitleMessage()}</div>
<div className="rounded-lg mt-8 text-gray-light"> <div className="overflow-y-auto hide-scrollbar flex-grow rounded-lg">{getContent()}</div>
<div className="font-bold text-lg">
<FormattedMessage defaultMessage="Trending notes" id="6k7xfM" />
</div>
<TrendingNotes small={true} count={100} />
</div>
</div>
</div> </div>
); );
} }

View File

@ -386,6 +386,9 @@
"CYkOCI": { "CYkOCI": {
"defaultMessage": "and {count} others you follow" "defaultMessage": "and {count} others you follow"
}, },
"CbM2hK": {
"defaultMessage": "Trending hashtags"
},
"CmZ9ls": { "CmZ9ls": {
"defaultMessage": "{n} Muted" "defaultMessage": "{n} Muted"
}, },

View File

@ -127,6 +127,7 @@
"CHTbO3": "Failed to load invoice", "CHTbO3": "Failed to load invoice",
"CVWeJ6": "Trending People", "CVWeJ6": "Trending People",
"CYkOCI": "and {count} others you follow", "CYkOCI": "and {count} others you follow",
"CbM2hK": "Trending hashtags",
"CmZ9ls": "{n} Muted", "CmZ9ls": "{n} Muted",
"CsCUYo": "{n} sats", "CsCUYo": "{n} sats",
"Cu/K85": "Translated from {lang}", "Cu/K85": "Translated from {lang}",