shorten some files
This commit is contained in:
parent
95dc979b8d
commit
5796892e54
7
packages/app/src/Components/Text/DisableMedia.tsx
Normal file
7
packages/app/src/Components/Text/DisableMedia.tsx
Normal file
@ -0,0 +1,7 @@
|
||||
const DisableMedia = ({ content }: { content: string }) => (
|
||||
<a href={content} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext">
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
|
||||
export default DisableMedia;
|
@ -9,6 +9,7 @@ import Hashtag from "@/Components/Embed/Hashtag";
|
||||
import HyperText from "@/Components/Embed/HyperText";
|
||||
import Invoice from "@/Components/Embed/Invoice";
|
||||
import { baseImageWidth, GRID_GAP, gridConfigMap, ROW_HEIGHT } from "@/Components/Text/const";
|
||||
import DisableMedia from "@/Components/Text/DisableMedia";
|
||||
import { useTextTransformer } from "@/Hooks/useTextTransformCache";
|
||||
|
||||
import RevealMedia from "../Event/RevealMedia";
|
||||
@ -51,12 +52,6 @@ export default function Text({
|
||||
const elements = useTextTransformer(id, content, tags);
|
||||
const images = elements.filter(a => a.type === "media" && a.mimeType?.startsWith("image")).map(a => a.content);
|
||||
|
||||
const DisableMedia = ({ content }: { content: string }) => (
|
||||
<a href={content} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext">
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
|
||||
const RevealMediaInstance = ({ content, data, size }: { content: string; data?: object; size?: number }) => {
|
||||
const imeta = data as IMeta | undefined;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { HexKey } from "@snort/system";
|
||||
import { useEffect, useState, useSyncExternalStore } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
|
||||
@ -12,54 +12,10 @@ import Modal from "@/Components/Modal/Modal";
|
||||
import QrCode from "@/Components/QrCode";
|
||||
import ProfilePreview from "@/Components/User/ProfilePreview";
|
||||
import SnortApi, { RevenueSplit, RevenueToday } from "@/External/SnortApi";
|
||||
import { ZapPoolTarget } from "@/Pages/ZapPool/ZapPoolTarget";
|
||||
import { bech32ToHex, unwrap } from "@/Utils";
|
||||
import { Contributors, DonateLNURL, Translators } from "@/Pages/Donate/const";
|
||||
import { ZapPoolDonateSection } from "@/Pages/Donate/ZapPoolDonateSection";
|
||||
import { bech32ToHex } from "@/Utils";
|
||||
import { ApiHost, DeveloperAccounts, SnortPubKey } from "@/Utils/Const";
|
||||
import { ZapPoolController, ZapPoolRecipientType } from "@/Utils/ZapPoolController";
|
||||
|
||||
const Contributors = [
|
||||
bech32ToHex("npub10djxr5pvdu97rjkde7tgcsjxzpdzmdguwacfjwlchvj7t88dl7nsdl54nf"), // ivan
|
||||
bech32ToHex("npub148jmlutaa49y5wl5mcll003ftj59v79vf7wuv3apcwpf75hx22vs7kk9ay"), // liran cohen
|
||||
bech32ToHex("npub1xdtducdnjerex88gkg2qk2atsdlqsyxqaag4h05jmcpyspqt30wscmntxy"), // artur
|
||||
bech32ToHex("npub1vp8fdcyejd4pqjyrjk9sgz68vuhq7pyvnzk8j0ehlljvwgp8n6eqsrnpsw"), // samsamskies
|
||||
bech32ToHex("npub179rec9sw2a5ngkr2wsjpjhwp2ksygjxn6uw5py9daj2ezhw3aw5swv3s6q"), // h3y6e - JA + other stuff
|
||||
bech32ToHex("npub17q5n2z8naw0xl6vu9lvt560lg33pdpe29k0k09umlfxm3vc4tqrq466f2y"), // w3irdrobot
|
||||
bech32ToHex("npub1ltx67888tz7lqnxlrg06x234vjnq349tcfyp52r0lstclp548mcqnuz40t"), // Vivek
|
||||
bech32ToHex("npub1wh30wunfpkezx5s7edqu9g0s0raeetf5dgthzm0zw7sk8wqygmjqqfljgh"), // Fernando Porazzi
|
||||
bech32ToHex("npub1gm7tuvr9atc6u7q3gevjfeyfyvmrlul4y67k7u7hcxztz67ceexs078rf6"), // Giszmo - Master of bug reports
|
||||
bech32ToHex("npub1cz2ve34nk0ukn0ph4yq2qx3ud8rfy5e0ak4epx42dn8gha0sdgpsgra9kv"), // Kamal
|
||||
];
|
||||
|
||||
const Translators = [
|
||||
bech32ToHex("npub1s8zws5frm94esxnp9v6zf7vk60m3hum3305n78sr73t78kleus7q8zpwna"), // middlingphys - JA
|
||||
bech32ToHex("npub1z0ykz6lp3y8rjjntenns0ee02062g2f0n55u49w44xdemw35vcpsda5jhh"), // noraglyphs - JA
|
||||
bech32ToHex("npub13wa880se2h3l54k7x76edrkrt4p94sh4q090974mt0z6n09qtntqxp47uk"), // numpad0 - JA
|
||||
bech32ToHex("npub147ccm75um0zkn0lr9fg9wrag2g6yxfw234fpmhdwuvaqjyegrhgs46t2td"), // ROBO358 - JA
|
||||
bech32ToHex("npub1ppxgsqdv4ygvdnzznudahtwqc3vaqjz3824vawfgwchpegz0lsjqqys35r"), // Kisato - JA
|
||||
|
||||
bech32ToHex("npub1ww8kjxz2akn82qptdpl7glywnchhkx3x04hez3d3rye397turrhssenvtp"), // Zoltan - HU
|
||||
|
||||
bech32ToHex("npub1x8dzy9xegwmdk2vy30l8u08caspcqq2yzncxehdsa6kvnte9pr3qnt8pg4"), // solobalbo - FR
|
||||
|
||||
bech32ToHex("npub1xwm9svxrlymymph0hka40zw9frg98m6adxmzcq26jhtm5gwlhjrshhgzfd"), // meitsjustme - ZH
|
||||
bech32ToHex("npub1raspu6ag9kfcw9jz0rz4z693qwmqe5sx6jdhhuvkwz5zy8rygztqnwfhd7"), // ra5pvt1n - ZH
|
||||
|
||||
bech32ToHex("npub13tkge7eqeem5cz8gk7gdju76nytvvf064hm5mzmv3x26k2uvaxfqczet2j"), // Mendace - IT
|
||||
|
||||
bech32ToHex("npub10529hxckjm5t5mchss5lnpsqrmavulglxhrmu5quuu4hs6yuyh3qc9gxd5"), // aadbitcoin - ID
|
||||
|
||||
bech32ToHex("npub19jk45jz45gczwfm22y9z69xhaex3nwg47dz84zw096xl6z62amkqj99rv7"), // Pextar - SV
|
||||
|
||||
bech32ToHex("npub1z9n5ktfjrlpyywds9t7ljekr9cm9jjnzs27h702te5fy8p2c4dgs5zvycf"), // Felix - DE
|
||||
|
||||
bech32ToHex("npub1wh30wunfpkezx5s7edqu9g0s0raeetf5dgthzm0zw7sk8wqygmjqqfljgh"), // Fernando Porazzi - pt-BR
|
||||
|
||||
bech32ToHex("npub1ust7u0v3qffejwhqee45r49zgcyewrcn99vdwkednd356c9resyqtnn3mj"), // Petri - FI
|
||||
|
||||
bech32ToHex("npub1p94p6d4p04mhjt2hdpkhhvkl93v7j7ada4w9lztj0y0fzg2m959sux5h5k"), // Jeremy - SV
|
||||
];
|
||||
|
||||
const DonateLNURL = "donate@snort.social";
|
||||
|
||||
const DonatePage = () => {
|
||||
const [splits, setSplits] = useState<RevenueSplit[]>([]);
|
||||
@ -230,44 +186,4 @@ const DonatePage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
function ZapPoolDonateSection() {
|
||||
if (!CONFIG.features.zapPool) {
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const zapPool = useSyncExternalStore(
|
||||
c => unwrap(ZapPoolController).hook(c),
|
||||
() => unwrap(ZapPoolController).snapshot(),
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3>
|
||||
<FormattedMessage defaultMessage="ZapPool" id="pRess9" />
|
||||
</h3>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="Fund the services that you use by splitting a portion of all your zaps into a pool of funds!"
|
||||
id="x/Fx2P"
|
||||
/>
|
||||
</p>
|
||||
<p>
|
||||
<Link to="/zap-pool" className="underline">
|
||||
<FormattedMessage defaultMessage="Configure zap pool" id="kqPQJD" />
|
||||
</Link>
|
||||
</p>
|
||||
<ZapPoolTarget
|
||||
target={
|
||||
zapPool.find(b => b.pubkey === bech32ToHex(SnortPubKey) && b.type === ZapPoolRecipientType.Generic) ?? {
|
||||
type: ZapPoolRecipientType.Generic,
|
||||
pubkey: bech32ToHex(SnortPubKey),
|
||||
split: 0,
|
||||
sum: 0,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default DonatePage;
|
48
packages/app/src/Pages/Donate/ZapPoolDonateSection.tsx
Normal file
48
packages/app/src/Pages/Donate/ZapPoolDonateSection.tsx
Normal file
@ -0,0 +1,48 @@
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { ZapPoolTarget } from "@/Pages/ZapPool/ZapPoolTarget";
|
||||
import { bech32ToHex, unwrap } from "@/Utils";
|
||||
import { SnortPubKey } from "@/Utils/Const";
|
||||
import { ZapPoolController, ZapPoolRecipientType } from "@/Utils/ZapPoolController";
|
||||
|
||||
export function ZapPoolDonateSection() {
|
||||
if (!CONFIG.features.zapPool) {
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const zapPool = useSyncExternalStore(
|
||||
c => unwrap(ZapPoolController).hook(c),
|
||||
() => unwrap(ZapPoolController).snapshot(),
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3>
|
||||
<FormattedMessage defaultMessage="ZapPool" id="pRess9" />
|
||||
</h3>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="Fund the services that you use by splitting a portion of all your zaps into a pool of funds!"
|
||||
id="x/Fx2P"
|
||||
/>
|
||||
</p>
|
||||
<p>
|
||||
<Link to="/zap-pool" className="underline">
|
||||
<FormattedMessage defaultMessage="Configure zap pool" id="kqPQJD" />
|
||||
</Link>
|
||||
</p>
|
||||
<ZapPoolTarget
|
||||
target={
|
||||
zapPool.find(b => b.pubkey === bech32ToHex(SnortPubKey) && b.type === ZapPoolRecipientType.Generic) ?? {
|
||||
type: ZapPoolRecipientType.Generic,
|
||||
pubkey: bech32ToHex(SnortPubKey),
|
||||
split: 0,
|
||||
sum: 0,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
43
packages/app/src/Pages/Donate/const.ts
Normal file
43
packages/app/src/Pages/Donate/const.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { bech32ToHex } from "@/Utils";
|
||||
|
||||
export const Contributors = [
|
||||
bech32ToHex("npub10djxr5pvdu97rjkde7tgcsjxzpdzmdguwacfjwlchvj7t88dl7nsdl54nf"), // ivan
|
||||
bech32ToHex("npub148jmlutaa49y5wl5mcll003ftj59v79vf7wuv3apcwpf75hx22vs7kk9ay"), // liran cohen
|
||||
bech32ToHex("npub1xdtducdnjerex88gkg2qk2atsdlqsyxqaag4h05jmcpyspqt30wscmntxy"), // artur
|
||||
bech32ToHex("npub1vp8fdcyejd4pqjyrjk9sgz68vuhq7pyvnzk8j0ehlljvwgp8n6eqsrnpsw"), // samsamskies
|
||||
bech32ToHex("npub179rec9sw2a5ngkr2wsjpjhwp2ksygjxn6uw5py9daj2ezhw3aw5swv3s6q"), // h3y6e - JA + other stuff
|
||||
bech32ToHex("npub17q5n2z8naw0xl6vu9lvt560lg33pdpe29k0k09umlfxm3vc4tqrq466f2y"), // w3irdrobot
|
||||
bech32ToHex("npub1ltx67888tz7lqnxlrg06x234vjnq349tcfyp52r0lstclp548mcqnuz40t"), // Vivek
|
||||
bech32ToHex("npub1wh30wunfpkezx5s7edqu9g0s0raeetf5dgthzm0zw7sk8wqygmjqqfljgh"), // Fernando Porazzi
|
||||
bech32ToHex("npub1gm7tuvr9atc6u7q3gevjfeyfyvmrlul4y67k7u7hcxztz67ceexs078rf6"), // Giszmo - Master of bug reports
|
||||
bech32ToHex("npub1cz2ve34nk0ukn0ph4yq2qx3ud8rfy5e0ak4epx42dn8gha0sdgpsgra9kv"), // Kamal
|
||||
];
|
||||
export const Translators = [
|
||||
bech32ToHex("npub1s8zws5frm94esxnp9v6zf7vk60m3hum3305n78sr73t78kleus7q8zpwna"), // middlingphys - JA
|
||||
bech32ToHex("npub1z0ykz6lp3y8rjjntenns0ee02062g2f0n55u49w44xdemw35vcpsda5jhh"), // noraglyphs - JA
|
||||
bech32ToHex("npub13wa880se2h3l54k7x76edrkrt4p94sh4q090974mt0z6n09qtntqxp47uk"), // numpad0 - JA
|
||||
bech32ToHex("npub147ccm75um0zkn0lr9fg9wrag2g6yxfw234fpmhdwuvaqjyegrhgs46t2td"), // ROBO358 - JA
|
||||
bech32ToHex("npub1ppxgsqdv4ygvdnzznudahtwqc3vaqjz3824vawfgwchpegz0lsjqqys35r"), // Kisato - JA
|
||||
|
||||
bech32ToHex("npub1ww8kjxz2akn82qptdpl7glywnchhkx3x04hez3d3rye397turrhssenvtp"), // Zoltan - HU
|
||||
|
||||
bech32ToHex("npub1x8dzy9xegwmdk2vy30l8u08caspcqq2yzncxehdsa6kvnte9pr3qnt8pg4"), // solobalbo - FR
|
||||
|
||||
bech32ToHex("npub1xwm9svxrlymymph0hka40zw9frg98m6adxmzcq26jhtm5gwlhjrshhgzfd"), // meitsjustme - ZH
|
||||
bech32ToHex("npub1raspu6ag9kfcw9jz0rz4z693qwmqe5sx6jdhhuvkwz5zy8rygztqnwfhd7"), // ra5pvt1n - ZH
|
||||
|
||||
bech32ToHex("npub13tkge7eqeem5cz8gk7gdju76nytvvf064hm5mzmv3x26k2uvaxfqczet2j"), // Mendace - IT
|
||||
|
||||
bech32ToHex("npub10529hxckjm5t5mchss5lnpsqrmavulglxhrmu5quuu4hs6yuyh3qc9gxd5"), // aadbitcoin - ID
|
||||
|
||||
bech32ToHex("npub19jk45jz45gczwfm22y9z69xhaex3nwg47dz84zw096xl6z62amkqj99rv7"), // Pextar - SV
|
||||
|
||||
bech32ToHex("npub1z9n5ktfjrlpyywds9t7ljekr9cm9jjnzs27h702te5fy8p2c4dgs5zvycf"), // Felix - DE
|
||||
|
||||
bech32ToHex("npub1wh30wunfpkezx5s7edqu9g0s0raeetf5dgthzm0zw7sk8wqygmjqqfljgh"), // Fernando Porazzi - pt-BR
|
||||
|
||||
bech32ToHex("npub1ust7u0v3qffejwhqee45r49zgcyewrcn99vdwkednd356c9resyqtnn3mj"), // Petri - FI
|
||||
|
||||
bech32ToHex("npub1p94p6d4p04mhjt2hdpkhhvkl93v7j7ada4w9lztj0y0fzg2m959sux5h5k"), // Jeremy - SV
|
||||
];
|
||||
export const DonateLNURL = "donate@snort.social";
|
13
packages/app/src/Pages/NetworkGraph/Avatar.tsx
Normal file
13
packages/app/src/Pages/NetworkGraph/Avatar.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
import { NodeObject } from "react-force-graph-3d";
|
||||
|
||||
import { proxyImg } from "@/Hooks/useImgProxy";
|
||||
import { GraphNode } from "@/Pages/NetworkGraph/types";
|
||||
import { defaultAvatar } from "@/Utils";
|
||||
import { LoginStore } from "@/Utils/Login";
|
||||
|
||||
export const avatar = (node: NodeObject<NodeObject<GraphNode>>) => {
|
||||
const login = LoginStore.snapshot();
|
||||
return node.profile?.picture
|
||||
? proxyImg(node.profile?.picture, login.appData.item.preferences.imgProxyConfig)
|
||||
: defaultAvatar(node.address);
|
||||
};
|
@ -1,65 +1,12 @@
|
||||
import { CachedMetadata, socialGraphInstance, STR, UID } from "@snort/system";
|
||||
import { socialGraphInstance, STR, UID } from "@snort/system";
|
||||
import { SnortContext } from "@snort/system-react";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { NodeObject } from "react-force-graph-3d";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import Icon from "@/Components/Icons/Icon";
|
||||
import { proxyImg } from "@/Hooks/useImgProxy";
|
||||
import { LoginStore } from "@/Utils/Login";
|
||||
|
||||
import { defaultAvatar } from "../Utils";
|
||||
|
||||
interface GraphNode {
|
||||
id: UID;
|
||||
profile?: CachedMetadata;
|
||||
distance: number;
|
||||
val: number;
|
||||
inboundCount: number;
|
||||
outboundCount: number;
|
||||
color?: string;
|
||||
visible: boolean;
|
||||
// curvature?: number;
|
||||
}
|
||||
|
||||
interface GraphLink {
|
||||
source: UID;
|
||||
target: UID;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
interface GraphMetadata {
|
||||
// usersByFollowDistance?: Map<number, Set<UID>>;
|
||||
userCountByDistance: number[];
|
||||
nodes?: Map<number, GraphNode>;
|
||||
}
|
||||
|
||||
interface GraphData {
|
||||
nodes: GraphNode[];
|
||||
links: GraphLink[];
|
||||
meta?: GraphMetadata;
|
||||
}
|
||||
|
||||
enum Direction {
|
||||
INBOUND,
|
||||
OUTBOUND,
|
||||
BOTH,
|
||||
}
|
||||
|
||||
const avatar = (node: NodeObject<NodeObject<GraphNode>>) => {
|
||||
const login = LoginStore.snapshot();
|
||||
return node.profile?.picture
|
||||
? proxyImg(node.profile?.picture, login.appData.item.preferences.imgProxyConfig)
|
||||
: defaultAvatar(node.address);
|
||||
};
|
||||
|
||||
const NODE_LIMIT = 500;
|
||||
|
||||
interface GraphConfig {
|
||||
direction: Direction;
|
||||
renderLimit: number | null;
|
||||
showDistance: number;
|
||||
}
|
||||
import { avatar } from "@/Pages/NetworkGraph/Avatar";
|
||||
import { Direction, GraphConfig, GraphData, GraphLink, GraphNode, NODE_LIMIT } from "@/Pages/NetworkGraph/types";
|
||||
|
||||
const NetworkGraph = () => {
|
||||
const [graphData, setGraphData] = useState(null as GraphData | null);
|
45
packages/app/src/Pages/NetworkGraph/types.ts
Normal file
45
packages/app/src/Pages/NetworkGraph/types.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { CachedMetadata, UID } from "@snort/system";
|
||||
|
||||
export interface GraphNode {
|
||||
id: UID;
|
||||
profile?: CachedMetadata;
|
||||
distance: number;
|
||||
val: number;
|
||||
inboundCount: number;
|
||||
outboundCount: number;
|
||||
color?: string;
|
||||
visible: boolean;
|
||||
// curvature?: number;
|
||||
}
|
||||
|
||||
export interface GraphLink {
|
||||
source: UID;
|
||||
target: UID;
|
||||
distance: number;
|
||||
}
|
||||
|
||||
interface GraphMetadata {
|
||||
// usersByFollowDistance?: Map<number, Set<UID>>;
|
||||
userCountByDistance: number[];
|
||||
nodes?: Map<number, GraphNode>;
|
||||
}
|
||||
|
||||
export interface GraphData {
|
||||
nodes: GraphNode[];
|
||||
links: GraphLink[];
|
||||
meta?: GraphMetadata;
|
||||
}
|
||||
|
||||
export enum Direction {
|
||||
INBOUND,
|
||||
OUTBOUND,
|
||||
BOTH,
|
||||
}
|
||||
|
||||
export interface GraphConfig {
|
||||
direction: Direction;
|
||||
renderLimit: number | null;
|
||||
showDistance: number;
|
||||
}
|
||||
|
||||
export const NODE_LIMIT = 500;
|
@ -15,14 +15,14 @@ import { addCachedMetadataToFuzzySearch } from "@/Db/FuzzySearch";
|
||||
import { updateRelayConnections } from "@/Hooks/useLoginRelays";
|
||||
import { AboutPage } from "@/Pages/About";
|
||||
import { SnortDeckLayout } from "@/Pages/DeckLayout";
|
||||
import DonatePage from "@/Pages/DonatePage";
|
||||
import DonatePage from "@/Pages/Donate/DonatePage";
|
||||
import ErrorPage from "@/Pages/ErrorPage";
|
||||
import FreeNostrAddressPage from "@/Pages/FreeNostrAddressPage";
|
||||
import HelpPage from "@/Pages/HelpPage";
|
||||
import Layout from "@/Pages/Layout";
|
||||
import { ListFeedPage } from "@/Pages/ListFeedPage";
|
||||
import MessagesPage from "@/Pages/Messages/MessagesPage";
|
||||
import NetworkGraph from "@/Pages/NetworkGraph";
|
||||
import NetworkGraph from "@/Pages/NetworkGraph/NetworkGraph";
|
||||
import NostrAddressPage from "@/Pages/NostrAddressPage";
|
||||
import NostrLinkHandler from "@/Pages/NostrLinkHandler";
|
||||
import NotificationsPage from "@/Pages/Notifications/Notifications";
|
||||
|
Loading…
x
Reference in New Issue
Block a user