chore: Update translations

This commit is contained in:
Martti Malmi 2024-01-13 18:54:14 +00:00
parent 7935d3d86a
commit 736c2577db
6 changed files with 51 additions and 70 deletions

View File

@ -24,12 +24,7 @@ const HashTagsPage = () => {
<div className="bb p"> <div className="bb p">
<HashTagHeader tag={tag} /> <HashTagHeader tag={tag} />
</div> </div>
<Timeline <Timeline key={tag} subject={subject} postsOnly={false} method={"TIME_RANGE"} />
key={tag}
subject={subject}
postsOnly={false}
method={"TIME_RANGE"}
/>
</> </>
); );
}; };

View File

@ -7,17 +7,20 @@ import { useParams } from "react-router-dom";
import Timeline from "@/Components/Feed/Timeline"; import Timeline from "@/Components/Feed/Timeline";
import PageSpinner from "@/Components/PageSpinner"; import PageSpinner from "@/Components/PageSpinner";
import { Hour } from "@/Utils/Const"; import { Hour } from "@/Utils/Const";
import {useMemo} from "react"; import { useMemo } from "react";
export function ListFeedPage() { export function ListFeedPage() {
const { id } = useParams(); const { id } = useParams();
const link = parseNostrLink(unwrap(id)); const link = parseNostrLink(unwrap(id));
const { data } = useEventFeed(link); const { data } = useEventFeed(link);
const subject = useMemo(() => ({ const subject = useMemo(
type: "pubkey", () => ({
items: pubkeys, type: "pubkey",
discriminator: "list-feed", items: pubkeys,
}), [pubkeys]); discriminator: "list-feed",
}),
[pubkeys],
);
if (!data) return <PageSpinner />; if (!data) return <PageSpinner />;
if (data.kind !== EventKind.ContactList && data.kind !== EventKind.FollowSet) { if (data.kind !== EventKind.ContactList && data.kind !== EventKind.FollowSet) {
@ -28,12 +31,5 @@ export function ListFeedPage() {
); );
} }
const pubkeys = dedupe(data.tags.filter(a => a[0] === "p").map(a => a[1])); const pubkeys = dedupe(data.tags.filter(a => a[0] === "p").map(a => a[1]));
return ( return <Timeline subject={subject} postsOnly={true} method="TIME_RANGE" window={Hour * 12} />;
<Timeline
subject={subject}
postsOnly={true}
method="TIME_RANGE"
window={Hour * 12}
/>
);
} }

View File

@ -1,6 +1,6 @@
import { unixNow } from "@snort/shared"; import { unixNow } from "@snort/shared";
import { SnortContext } from "@snort/system-react"; import { SnortContext } from "@snort/system-react";
import {useContext, useEffect, useMemo, useState} from "react"; import { useContext, useEffect, useMemo, useState } from "react";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import Timeline from "@/Components/Feed/Timeline"; import Timeline from "@/Components/Feed/Timeline";
@ -79,25 +79,20 @@ export const GlobalTab = () => {
}); });
}, [relays, relay]); }, [relays, relay]);
const subject = useMemo(() => ({ const subject = useMemo(
type: "global", () => ({
items: [], type: "global",
relay: [relay.url], items: [],
discriminator: `all-${sha256(relay.url)}`, relay: [relay.url],
}), [relay.url]); discriminator: `all-${sha256(relay.url)}`,
}),
[relay.url],
);
return ( return (
<> <>
{globalRelaySelector()} {globalRelaySelector()}
{relay && ( {relay && <Timeline subject={subject} postsOnly={false} method={"TIME_RANGE"} window={600} now={now} />}
<Timeline
subject={subject}
postsOnly={false}
method={"TIME_RANGE"}
window={600}
now={now}
/>
)}
</> </>
); );
}; };

View File

@ -2,17 +2,20 @@ import { useParams } from "react-router-dom";
import Timeline from "@/Components/Feed/Timeline"; import Timeline from "@/Components/Feed/Timeline";
import { TimelineSubject } from "@/Feed/TimelineFeed"; import { TimelineSubject } from "@/Feed/TimelineFeed";
import {useMemo} from "react"; import { useMemo } from "react";
export const TagsTab = (params: { tag?: string }) => { export const TagsTab = (params: { tag?: string }) => {
const { tag } = useParams(); const { tag } = useParams();
const t = params.tag ?? tag ?? ""; const t = params.tag ?? tag ?? "";
const subject: TimelineSubject = useMemo(() => ({ const subject: TimelineSubject = useMemo(
type: "hashtag", () => ({
items: [t], type: "hashtag",
discriminator: `tags-${t}`, items: [t],
streams: true, discriminator: `tags-${t}`,
}), [t]); streams: true,
}),
[t],
);
return <Timeline subject={subject} postsOnly={false} method={"TIME_RANGE"} />; return <Timeline subject={subject} postsOnly={false} method={"TIME_RANGE"} />;
}; };

View File

@ -53,11 +53,14 @@ const SearchPage = () => {
return debounce(500, () => setKeyword(search)); return debounce(500, () => setKeyword(search));
}, [search]); }, [search]);
const subject = useMemo(() => ({ const subject = useMemo(
type: "post_keyword", () => ({
items: [keyword + (sortPopular ? " sort:popular" : "")], type: "post_keyword",
discriminator: keyword, items: [keyword + (sortPopular ? " sort:popular" : "")],
}), [keyword, sortPopular]); discriminator: keyword,
}),
[keyword, sortPopular],
);
function tabContent() { function tabContent() {
if (tab.value === PROFILES) { if (tab.value === PROFILES) {
@ -71,13 +74,7 @@ const SearchPage = () => {
return ( return (
<> <>
{sortOptions()} {sortOptions()}
<Timeline <Timeline key={keyword} subject={subject} postsOnly={false} method={"LIMIT_UNTIL"} loadMore={false} />
key={keyword}
subject={subject}
postsOnly={false}
method={"LIMIT_UNTIL"}
loadMore={false}
/>
</> </>
); );
} }

View File

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