feat: topics page

This commit is contained in:
Kieran 2023-11-14 10:51:58 +00:00
parent f2a41cb474
commit c530e4ba72
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
5 changed files with 40 additions and 9 deletions

View File

@ -89,6 +89,17 @@ export function RootTabs({ base }: { base?: string }) {
</>
),
},
{
tab: "tags",
path: `${base}/topics`,
show: tags.item.length > 0,
element: (
<>
<Icon name="hash" />
<FormattedMessage defaultMessage="Topics" />
</>
),
},
] as Array<{
tab: RootTab;
path: string;
@ -141,15 +152,6 @@ export function RootTabs({ base }: { base?: string }) {
{a.element}
</MenuItem>
))}
{tags.item.map(v => (
<MenuItem
onClick={() => {
navigate(`${base}/t/${v}`);
}}>
<Icon name="hash" />
{v}
</MenuItem>
))}
</Menu>
</div>
);

View File

@ -18,6 +18,7 @@ import { TaskList } from "Tasks/TaskList";
import TimelineFollows from "Element/Feed/TimelineFollows";
import { RootTabs } from "Element/RootTabs";
import { DeckContext } from "Pages/DeckLayout";
import { TopicsPage } from "./TopicsPage";
import messages from "./messages";
@ -239,6 +240,10 @@ export const RootTabRoutes = [
path: "t/:tag",
element: <HashTagsPage />,
},
{
path: "topics",
element: <TopicsPage />,
},
];
export const RootRoutes = [

View File

@ -0,0 +1,20 @@
import Timeline from "Element/Feed/Timeline";
import useLogin from "Hooks/useLogin";
export function TopicsPage() {
const { tags, pubKey } = useLogin(s => ({ tags: s.tags.item, pubKey: s.publicKey }));
return (
<Timeline
subject={{
type: "hashtag",
items: tags,
discriminator: pubKey ?? "",
}}
postsOnly={true}
method="TIME_RANGE"
loadMore={true}
window={60 * 60 * 6}
/>
);
}

View File

@ -1168,6 +1168,9 @@
"kaaf1E": {
"defaultMessage": "now"
},
"kc79d3": {
"defaultMessage": "Topics"
},
"kuPHYE": {
"defaultMessage": "{n,plural,=0{{name} liked} other{{name} & {n} others liked}}"
},

View File

@ -384,6 +384,7 @@
"kEZUR8": "Register an Iris username",
"kJYo0u": "{n,plural,=0{{name} reposted} other{{name} & {n} others reposted}}",
"kaaf1E": "now",
"kc79d3": "Topics",
"kuPHYE": "{n,plural,=0{{name} liked} other{{name} & {n} others liked}}",
"l+ikU1": "Everything in {plan}",
"lCILNz": "Buy Now",