1
0
forked from Kieran/snort

chore: formatting

This commit is contained in:
Kieran 2024-01-17 15:48:30 +00:00
parent aa58ec4185
commit adb9fe5c2e
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
11 changed files with 56 additions and 54 deletions

View File

@ -4,7 +4,7 @@
"packages/*" "packages/*"
], ],
"scripts": { "scripts": {
"build": "yarn workspace @snort/shared build && yarn workspace @snort/system build && yarn workspace @snort/system-web build && yarn workspace @snort/system-react build && yarn workspace @snort/app build", "build": "yarn workspace @snort/shared build && yarn workspace @snort/worker-relay build && yarn workspace @snort/system build && yarn workspace @snort/system-web build && yarn workspace @snort/system-react build && yarn workspace @snort/app build",
"start": "yarn build && yarn workspace @snort/app start", "start": "yarn build && yarn workspace @snort/app start",
"test": "yarn build && yarn workspace @snort/app test && yarn workspace @snort/system test", "test": "yarn build && yarn workspace @snort/app test && yarn workspace @snort/system test",
"pre:commit": "yarn workspace @snort/app intl-extract && yarn workspace @snort/app intl-compile && yarn prettier --write .", "pre:commit": "yarn workspace @snort/app intl-extract && yarn workspace @snort/app intl-compile && yarn prettier --write .",

View File

@ -140,7 +140,7 @@ export const FooterZapButton = ({ ev, zaps, onClickZappers }: ZapIconProps) => {
value={zapTotal} value={zapTotal}
onClick={fastZap} onClick={fastZap}
/> />
<ZapsSummary zaps={zaps} onClick={onClickZappers ?? (() => { })} /> <ZapsSummary zaps={zaps} onClick={onClickZappers ?? (() => {})} />
</div> </div>
{showZapModal && ( {showZapModal && (
<ZapModal <ZapModal

View File

@ -19,8 +19,8 @@ export const LikeButton = ({
const { publisher, system } = useEventPublisher(); const { publisher, system } = useEventPublisher();
const hasReacted = (emoji: string) => { const hasReacted = (emoji: string) => {
return ( return positiveReactions?.some(
positiveReactions?.some(({ pubkey, content }) => normalizeReaction(content) === emoji && pubkey === publicKey) ({ pubkey, content }) => normalizeReaction(content) === emoji && pubkey === publicKey,
); );
}; };

View File

@ -121,9 +121,11 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
displayAs={displayAs} displayAs={displayAs}
/> />
{sortedFeed.length > 0 && ( {sortedFeed.length > 0 && (
<ShowMoreInView onClick={() => { <ShowMoreInView
setLimit(s => s + 20); onClick={() => {
}} /> setLimit(s => s + 20);
}}
/>
)} )}
</> </>
); );

View File

@ -14,7 +14,13 @@ import { formatShort } from "@/Utils/Number";
import { notificationContext } from "./notificationContext"; import { notificationContext } from "./notificationContext";
import { NotificationContext } from "./Notifications"; import { NotificationContext } from "./Notifications";
export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEvent>; onClick?: (link: NostrLink) => void; }) { export function NotificationGroup({
evs,
onClick,
}: {
evs: Array<TaggedNostrEvent>;
onClick?: (link: NostrLink) => void;
}) {
const { ref, inView } = useInView({ triggerOnce: true }); const { ref, inView } = useInView({ triggerOnce: true });
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const kind = evs[0].kind; const kind = evs[0].kind;
@ -30,7 +36,7 @@ export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEven
return zap.anonZap ? "anon" : zap.sender ?? a.pubkey; return zap.anonZap ? "anon" : zap.sender ?? a.pubkey;
} }
return a.pubkey; return a.pubkey;
}) }),
); );
const firstPubkey = pubkeys[0]; const firstPubkey = pubkeys[0];
const firstPubkeyProfile = useUserProfile(inView ? (firstPubkey === "anon" ? "" : firstPubkey) : ""); const firstPubkeyProfile = useUserProfile(inView ? (firstPubkey === "anon" ? "" : firstPubkey) : "");
@ -64,7 +70,8 @@ export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEven
values={{ values={{
n, n,
name, name,
}} /> }}
/>
); );
} }
case EventKind.Repost: { case EventKind.Repost: {
@ -75,7 +82,8 @@ export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEven
values={{ values={{
n, n,
name, name,
}} /> }}
/>
); );
} }
case EventKind.ZapReceipt: { case EventKind.ZapReceipt: {
@ -86,7 +94,8 @@ export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEven
values={{ values={{
n, n,
name, name,
}} /> }}
/>
); );
} }
} }
@ -114,7 +123,8 @@ export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEven
showUsername={kind === EventKind.TextNote} showUsername={kind === EventKind.TextNote}
pubkey={v} pubkey={v}
size={40} size={40}
overrideUsername={v === "" ? formatMessage({ defaultMessage: "Anon", id: "bfvyfs" }) : undefined} /> overrideUsername={v === "" ? formatMessage({ defaultMessage: "Anon", id: "bfvyfs" }) : undefined}
/>
))} ))}
</div> </div>
{kind !== EventKind.TextNote && ( {kind !== EventKind.TextNote && (
@ -123,7 +133,7 @@ export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEven
pubkeys.length - 1, pubkeys.length - 1,
firstPubkey === "anon" firstPubkey === "anon"
? formatMessage({ defaultMessage: "Anon", id: "bfvyfs" }) ? formatMessage({ defaultMessage: "Anon", id: "bfvyfs" })
: getDisplayName(firstPubkeyProfile, firstPubkey) : getDisplayName(firstPubkeyProfile, firstPubkey),
)} )}
</div> </div>
)} )}
@ -136,7 +146,8 @@ export function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEven
} else { } else {
navigate(`/${context.encode(CONFIG.eventLinkPrefix)}`); navigate(`/${context.encode(CONFIG.eventLinkPrefix)}`);
} }
}} /> }}
/>
)} )}
</div> </div>
</> </>

View File

@ -44,8 +44,9 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
const timeGrouped = useMemo(() => { const timeGrouped = useMemo(() => {
return myNotifications.reduce((acc, v) => { return myNotifications.reduce((acc, v) => {
const key = `${timeKey(v)}:${notificationContext(v as TaggedNostrEvent)?.encode(CONFIG.eventLinkPrefix)}:${v.kind const key = `${timeKey(v)}:${notificationContext(v as TaggedNostrEvent)?.encode(CONFIG.eventLinkPrefix)}:${
}`; v.kind
}`;
if (acc.has(key)) { if (acc.has(key)) {
unwrap(acc.get(key)).push(v as TaggedNostrEvent); unwrap(acc.get(key)).push(v as TaggedNostrEvent);
} else { } else {
@ -64,8 +65,7 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
</Suspense> </Suspense>
)} )}
{login.publicKey && {login.publicKey &&
[...timeGrouped.entries()] [...timeGrouped.entries()].map(([k, g]) => <NotificationGroup key={k} evs={g} onClick={onClick} />)}
.map(([k, g]) => <NotificationGroup key={k} evs={g} onClick={onClick} />)}
<ShowMoreInView onClick={() => {}} /> <ShowMoreInView onClick={() => {}} />
</div> </div>

View File

@ -2,13 +2,7 @@ import { FeedCache } from "@snort/shared";
import { ReactNode, useEffect, useState, useSyncExternalStore } from "react"; import { ReactNode, useEffect, useState, useSyncExternalStore } from "react";
import { FormattedMessage, FormattedNumber } from "react-intl"; import { FormattedMessage, FormattedNumber } from "react-intl";
import { import { Chats, GiftsCache, PaymentsCache, RelayMetrics, UserCache } from "@/Cache";
Chats,
GiftsCache,
PaymentsCache,
RelayMetrics,
UserCache,
} from "@/Cache";
import AsyncButton from "@/Components/Button/AsyncButton"; import AsyncButton from "@/Components/Button/AsyncButton";
import { Relay } from "@/system"; import { Relay } from "@/system";
@ -70,23 +64,22 @@ function RelayCacheStats() {
<div className="flex flex-col g4"> <div className="flex flex-col g4">
<FormattedMessage defaultMessage="Worker Relay" id="xSoIUU" /> <FormattedMessage defaultMessage="Worker Relay" id="xSoIUU" />
{Object.entries(counts).map(([k, v]) => { {Object.entries(counts).map(([k, v]) => {
return <small key={k}> return (
<FormattedMessage <small key={k}>
defaultMessage="{n} kind {k} events" <FormattedMessage
id="I97cCX" defaultMessage="{n} kind {k} events"
values={{ id="I97cCX"
n: <FormattedNumber value={v} />, values={{
k: k n: <FormattedNumber value={v} />,
}} k: k,
/> }}
</small> />
</small>
);
})} })}
</div> </div>
<div> <div>
<AsyncButton onClick={() => { <AsyncButton onClick={() => {}}>
}}>
<FormattedMessage defaultMessage="Clear" id="/GCoTA" /> <FormattedMessage defaultMessage="Clear" id="/GCoTA" />
</AsyncButton> </AsyncButton>
</div> </div>

View File

@ -597,6 +597,9 @@
"I1AoOu": { "I1AoOu": {
"defaultMessage": "Last post {time}" "defaultMessage": "Last post {time}"
}, },
"I97cCX": {
"defaultMessage": "{n} kind {k} events"
},
"IEwZvs": { "IEwZvs": {
"defaultMessage": "Are you sure you want to unpin this note?" "defaultMessage": "Are you sure you want to unpin this note?"
}, },
@ -1588,9 +1591,6 @@
"sfL/O+": { "sfL/O+": {
"defaultMessage": "Muted notes will not be shown" "defaultMessage": "Muted notes will not be shown"
}, },
"tGXF0Q": {
"defaultMessage": "Relay Lists"
},
"tOdNiY": { "tOdNiY": {
"defaultMessage": "Dark" "defaultMessage": "Dark"
}, },
@ -1609,9 +1609,6 @@
"ttxS0b": { "ttxS0b": {
"defaultMessage": "Supporter Badge" "defaultMessage": "Supporter Badge"
}, },
"u+LyXc": {
"defaultMessage": "Interactions"
},
"u/vOPu": { "u/vOPu": {
"defaultMessage": "Paid" "defaultMessage": "Paid"
}, },
@ -1624,9 +1621,6 @@
"uCk8r+": { "uCk8r+": {
"defaultMessage": "Already have an account?" "defaultMessage": "Already have an account?"
}, },
"uKqSN+": {
"defaultMessage": "Follows Feed"
},
"uSV4Ti": { "uSV4Ti": {
"defaultMessage": "Reposts need to be manually confirmed" "defaultMessage": "Reposts need to be manually confirmed"
}, },
@ -1710,6 +1704,9 @@
"defaultMessage": "Unlock", "defaultMessage": "Unlock",
"description": "Unlock wallet" "description": "Unlock wallet"
}, },
"xSoIUU": {
"defaultMessage": "Worker Relay"
},
"xaj9Ba": { "xaj9Ba": {
"defaultMessage": "Provider" "defaultMessage": "Provider"
}, },

View File

@ -197,6 +197,7 @@
"HhcAVH": "You don't follow this person, click here to load media from <i>{link}</i>, or update <a><i>your preferences</i></a> to always load media from everybody.", "HhcAVH": "You don't follow this person, click here to load media from <i>{link}</i>, or update <a><i>your preferences</i></a> to always load media from everybody.",
"HqRNN8": "Support", "HqRNN8": "Support",
"I1AoOu": "Last post {time}", "I1AoOu": "Last post {time}",
"I97cCX": "{n} kind {k} events",
"IEwZvs": "Are you sure you want to unpin this note?", "IEwZvs": "Are you sure you want to unpin this note?",
"IKKHqV": "Follows", "IKKHqV": "Follows",
"IOu4Xh": "You must be a {tier} subscriber to access {app} deck", "IOu4Xh": "You must be a {tier} subscriber to access {app} deck",
@ -524,19 +525,16 @@
"sUNhQE": "user", "sUNhQE": "user",
"sZQzjQ": "Failed to parse zap split: {input}", "sZQzjQ": "Failed to parse zap split: {input}",
"sfL/O+": "Muted notes will not be shown", "sfL/O+": "Muted notes will not be shown",
"tGXF0Q": "Relay Lists",
"tOdNiY": "Dark", "tOdNiY": "Dark",
"th5lxp": "Send note to a subset of your write relays", "th5lxp": "Send note to a subset of your write relays",
"thnRpU": "Getting NIP-05 verified can help:", "thnRpU": "Getting NIP-05 verified can help:",
"tj6kdX": "{sign} {amount} sats", "tj6kdX": "{sign} {amount} sats",
"tjpYlr": "Relay Metrics", "tjpYlr": "Relay Metrics",
"ttxS0b": "Supporter Badge", "ttxS0b": "Supporter Badge",
"u+LyXc": "Interactions",
"u/vOPu": "Paid", "u/vOPu": "Paid",
"u4bHcR": "Check out the code here: {link}", "u4bHcR": "Check out the code here: {link}",
"u9NoC1": "Name must be less than {limit} characters", "u9NoC1": "Name must be less than {limit} characters",
"uCk8r+": "Already have an account?", "uCk8r+": "Already have an account?",
"uKqSN+": "Follows Feed",
"uSV4Ti": "Reposts need to be manually confirmed", "uSV4Ti": "Reposts need to be manually confirmed",
"uc0din": "Send sats splits to", "uc0din": "Send sats splits to",
"un1nGw": "{n} notes", "un1nGw": "{n} notes",
@ -564,6 +562,7 @@
"xIcAOU": "Votes by {type}", "xIcAOU": "Votes by {type}",
"xIoGG9": "Go to", "xIoGG9": "Go to",
"xQtL3v": "Unlock", "xQtL3v": "Unlock",
"xSoIUU": "Worker Relay",
"xaj9Ba": "Provider", "xaj9Ba": "Provider",
"xbVgIm": "Automatically load media", "xbVgIm": "Automatically load media",
"xhQMeQ": "Expires", "xhQMeQ": "Expires",

View File

@ -47,7 +47,7 @@ export class WorkerRelayInterface {
async summary() { async summary() {
return await this.#workerRpc<void, Record<string, number>>("summary"); return await this.#workerRpc<void, Record<string, number>>("summary");
} }
#workerRpc<T, R>(cmd: string, args?: T, timeout = 30_000) { #workerRpc<T, R>(cmd: string, args?: T, timeout = 30_000) {
const id = uuid(); const id = uuid();
const msg = { const msg = {

View File

@ -30,4 +30,4 @@ export interface ReqFilter {
export function unixNowMs() { export function unixNowMs() {
return new Date().getTime(); return new Date().getTime();
} }