refactor: more config options for generic config
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
import { HexKey } from "@snort/system";
|
||||
import { useEffect, useState, useSyncExternalStore } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
|
||||
import Telegram from "@/assets/img/telegram.svg";
|
||||
import { Nip28ChatSystem } from "@/chat/nip28";
|
||||
import AsyncButton from "@/Components/Button/AsyncButton";
|
||||
import Copy from "@/Components/Copy/Copy";
|
||||
import ZapButton from "@/Components/Event/ZapButton";
|
||||
@ -64,6 +66,7 @@ const DonatePage = () => {
|
||||
const [today, setSumToday] = useState<RevenueToday>();
|
||||
const [onChain, setOnChain] = useState("");
|
||||
const api = new SnortApi(ApiHost);
|
||||
const navigate = useNavigate();
|
||||
|
||||
async function getOnChainAddress() {
|
||||
const { address } = await api.onChainDonation();
|
||||
@ -91,28 +94,24 @@ const DonatePage = () => {
|
||||
|
||||
return (
|
||||
<div className="main-content p">
|
||||
<h2>
|
||||
<FormattedMessage
|
||||
defaultMessage="Help fund the development of {site}"
|
||||
id="yNBPJp"
|
||||
values={{ site: CONFIG.appNameCapitalized }}
|
||||
/>
|
||||
</h2>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="{site} is an open source project built by passionate people in their free time, your donations are greatly appreciated"
|
||||
id="XhpBfA"
|
||||
values={{ site: CONFIG.appNameCapitalized }}
|
||||
defaultMessage="Snort is an open source project built by passionate people in their free time, your donations are greatly appreciated"
|
||||
id="fLIvbC"
|
||||
/>
|
||||
</p>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="Check out the code here: {link}"
|
||||
id="u4bHcR"
|
||||
defaultMessage="Check out the code {link}"
|
||||
id="LKw/ue"
|
||||
values={{
|
||||
link: (
|
||||
<a className="highlight" href="https://git.v0l.io/Kieran/snort" rel="noreferrer" target="_blank">
|
||||
https://git.v0l.io/Kieran/snort
|
||||
<a
|
||||
className="highlight underline"
|
||||
href="https://git.v0l.io/Kieran/snort"
|
||||
rel="noreferrer"
|
||||
target="_blank">
|
||||
here
|
||||
</a>
|
||||
),
|
||||
}}
|
||||
@ -124,18 +123,51 @@ const DonatePage = () => {
|
||||
id="VfhYxG"
|
||||
values={{
|
||||
here: (
|
||||
<Link to="/about" className="underline">
|
||||
<Link to="/about" className="highlight underline">
|
||||
<FormattedMessage defaultMessage="here" id="hniz8Z" />
|
||||
</Link>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://t.me/irismessenger" target="_blank" rel="noreferrer" className="underline">
|
||||
Telegram
|
||||
</a>
|
||||
</p>
|
||||
{CONFIG.chatChannels && (
|
||||
<>
|
||||
<h4>
|
||||
<FormattedMessage defaultMessage="Public Chat Channels" id="rn52n9" />
|
||||
</h4>
|
||||
<div className="flex gap-2">
|
||||
{CONFIG.chatChannels.map(a => {
|
||||
switch (a.type) {
|
||||
case "telegram": {
|
||||
return (
|
||||
<AsyncButton
|
||||
onClick={() => {
|
||||
window.open(a.value, "_blank", "noreferrer");
|
||||
}}>
|
||||
<img src={Telegram} width={24} height={24} />
|
||||
<FormattedMessage defaultMessage="Telegram" id="TH1fFo" />
|
||||
</AsyncButton>
|
||||
);
|
||||
}
|
||||
case "nip28": {
|
||||
return (
|
||||
<AsyncButton
|
||||
onClick={() => {
|
||||
navigate(`/messages/${Nip28ChatSystem.chatId(a.value)}`);
|
||||
}}>
|
||||
<img src={CONFIG.appleTouchIconUrl} width={24} height={24} className="rounded-full" />
|
||||
<FormattedMessage defaultMessage="Nostr Public Chat" id="whSrs+" />
|
||||
</AsyncButton>
|
||||
);
|
||||
}
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<h3>
|
||||
<FormattedMessage defaultMessage="Donate" id="2IFGap" />
|
||||
</h3>
|
||||
<div className="flex flex-col g12">
|
||||
<div className="b br p">
|
||||
<div className="flex items-center justify-between">
|
||||
|
@ -45,12 +45,16 @@ const SettingsIndex = () => {
|
||||
message: <FormattedMessage id="08zn6O" defaultMessage="Export Keys" />,
|
||||
path: "keys",
|
||||
},
|
||||
{
|
||||
icon: "badge",
|
||||
iconBg: "bg-pink-500",
|
||||
message: <FormattedMessage id="9pMqYs" defaultMessage="Nostr Address" />,
|
||||
path: "handle",
|
||||
},
|
||||
...(CONFIG.features.nostrAddress
|
||||
? [
|
||||
{
|
||||
icon: "badge",
|
||||
iconBg: "bg-pink-500",
|
||||
message: <FormattedMessage id="9pMqYs" defaultMessage="Nostr Address" />,
|
||||
path: "handle",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: "gear",
|
||||
iconBg: "bg-slate-500",
|
||||
@ -96,18 +100,26 @@ const SettingsIndex = () => {
|
||||
message: <FormattedMessage id="wofVHy" defaultMessage="Moderation" />,
|
||||
path: "moderation",
|
||||
},
|
||||
{
|
||||
icon: "bell-outline",
|
||||
iconBg: "bg-red-500",
|
||||
message: <FormattedMessage id="NAidKb" defaultMessage="Notifications" />,
|
||||
path: "notifications",
|
||||
},
|
||||
{
|
||||
icon: "link",
|
||||
iconBg: "bg-blue-500",
|
||||
message: <FormattedMessage id="hYOE+U" defaultMessage="Invite" />,
|
||||
path: "invite",
|
||||
},
|
||||
...(CONFIG.features.pushNotifications
|
||||
? [
|
||||
{
|
||||
icon: "bell-outline",
|
||||
iconBg: "bg-red-500",
|
||||
message: <FormattedMessage id="NAidKb" defaultMessage="Notifications" />,
|
||||
path: "notifications",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(CONFIG.features.communityLeaders
|
||||
? [
|
||||
{
|
||||
icon: "link",
|
||||
iconBg: "bg-blue-500",
|
||||
message: <FormattedMessage id="hYOE+U" defaultMessage="Invite" />,
|
||||
path: "invite",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: "hard-drive",
|
||||
iconBg: "bg-cyan-500",
|
||||
|
Reference in New Issue
Block a user