forked from Kieran/snort
1
0
Fork 0

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/*"
],
"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",
"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 .",

View File

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

View File

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

View File

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

View File

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

View File

@ -44,8 +44,9 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
const timeGrouped = useMemo(() => {
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)) {
unwrap(acc.get(key)).push(v as TaggedNostrEvent);
} else {
@ -64,8 +65,7 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
</Suspense>
)}
{login.publicKey &&
[...timeGrouped.entries()]
.map(([k, g]) => <NotificationGroup key={k} evs={g} onClick={onClick} />)}
[...timeGrouped.entries()].map(([k, g]) => <NotificationGroup key={k} evs={g} onClick={onClick} />)}
<ShowMoreInView onClick={() => {}} />
</div>

View File

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

View File

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

View File

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

View File

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