diff --git a/src/components/PostEditor/PostContent.tsx b/src/components/PostEditor/PostContent.tsx index 9720a13d..089061e4 100644 --- a/src/components/PostEditor/PostContent.tsx +++ b/src/components/PostEditor/PostContent.tsx @@ -27,11 +27,13 @@ import Uploader from './Uploader' export default function PostContent({ defaultContent = '', parentEvent, - close + close, + openFrom }: { defaultContent?: string parentEvent?: Event close: () => void + openFrom?: string[] }) { const { t } = useTranslation() const { pubkey, publish, checkLogin } = useNostr() @@ -233,6 +235,7 @@ export default function PostContent({ parentEvent={parentEvent} specifiedRelayUrls={specifiedRelayUrls} setSpecifiedRelayUrls={setSpecifiedRelayUrls} + openFrom={openFrom} /> )}
diff --git a/src/components/PostEditor/SendOnlyToSwitch.tsx b/src/components/PostEditor/SendOnlyToSwitch.tsx index 0377df00..ddad7d1d 100644 --- a/src/components/PostEditor/SendOnlyToSwitch.tsx +++ b/src/components/PostEditor/SendOnlyToSwitch.tsx @@ -13,17 +13,24 @@ import { useTranslation } from 'react-i18next' export default function SendOnlyToSwitch({ parentEvent, specifiedRelayUrls, - setSpecifiedRelayUrls + setSpecifiedRelayUrls, + openFrom }: { parentEvent?: Event specifiedRelayUrls?: string[] setSpecifiedRelayUrls: Dispatch> + openFrom?: string[] }) { const { t } = useTranslation() const { currentRelayUrls } = useCurrentRelays() const [urls, setUrls] = useState([]) useEffect(() => { + if (openFrom?.length) { + setUrls(openFrom) + setSpecifiedRelayUrls(openFrom) + return + } if (!parentEvent) { setUrls(currentRelayUrls) return @@ -36,7 +43,7 @@ export default function SendOnlyToSwitch({ } else { setUrls(currentRelayUrls) } - }, [parentEvent, currentRelayUrls]) + }, [parentEvent, currentRelayUrls, openFrom]) if (!urls.length) return null diff --git a/src/components/PostEditor/index.tsx b/src/components/PostEditor/index.tsx index ba792db3..ac12caef 100644 --- a/src/components/PostEditor/index.tsx +++ b/src/components/PostEditor/index.tsx @@ -24,12 +24,14 @@ export default function PostEditor({ defaultContent = '', parentEvent, open, - setOpen + setOpen, + openFrom }: { defaultContent?: string parentEvent?: Event open: boolean setOpen: Dispatch + openFrom?: string[] }) { const { isSmallScreen } = useScreenSize() @@ -39,6 +41,7 @@ export default function PostEditor({ defaultContent={defaultContent} parentEvent={parentEvent} close={() => setOpen(false)} + openFrom={openFrom} /> ) }, []) diff --git a/src/components/RelayInfo/index.tsx b/src/components/RelayInfo/index.tsx index ac9eccfa..9a03ce22 100644 --- a/src/components/RelayInfo/index.tsx +++ b/src/components/RelayInfo/index.tsx @@ -1,8 +1,11 @@ import { Badge } from '@/components/ui/badge' +import { Button } from '@/components/ui/button' import { useFetchRelayInfo } from '@/hooks' import { normalizeHttpUrl } from '@/lib/url' import { GitBranch, Mail, SquareCode } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' +import PostEditor from '../PostEditor' import RelayBadges from '../RelayBadges' import RelayIcon from '../RelayIcon' import UserAvatar from '../UserAvatar' @@ -11,6 +14,8 @@ import Username from '../Username' export default function RelayInfo({ url }: { url: string }) { const { t } = useTranslation() const { relayInfo, isFetching } = useFetchRelayInfo(url) + const [open, setOpen] = useState(false) + if (isFetching || !relayInfo) { return null } @@ -38,29 +43,7 @@ export default function RelayInfo({ url }: { url: string }) {
)} - {!!relayInfo.supported_nips?.length && ( -
-
{t('Supported NIPs')}
-
- {relayInfo.supported_nips - .sort((a, b) => a - b) - .map((nip) => ( - - window.open( - `https://github.com/nostr-protocol/nips/blob/master/${formatNip(nip)}.md` - ) - } - > - {formatNip(nip)} - - ))} -
-
- )} + {relayInfo.payments_url && (
{t('Payment page')}:
@@ -111,6 +94,10 @@ export default function RelayInfo({ url }: { url: string }) {
)} + + ) } @@ -119,10 +106,3 @@ function formatSoftware(software: string) { const parts = software.split('/') return parts[parts.length - 1] } - -function formatNip(nip: number) { - if (nip < 10) { - return `0${nip}` - } - return `${nip}` -} diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index c6f12479..ab6f71c6 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -365,6 +365,7 @@ export default { 'Clear All': 'مسح الكل', 'Remember my choice': 'تذكر اختياري', Apply: 'تطبيق', - Reset: 'إعادة تعيين' + Reset: 'إعادة تعيين', + 'Share something on this Relay': 'شارك شيئاً على هذا الريلاي' } } diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 8d25f73e..ff8658f2 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -372,6 +372,7 @@ export default { 'Clear All': 'Alle löschen', 'Remember my choice': 'Meine Auswahl merken', Apply: 'Anwenden', - Reset: 'Zurücksetzen' + Reset: 'Zurücksetzen', + 'Share something on this Relay': 'Teile etwas auf diesem Relay' } } diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index a68b33cc..c933ec46 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -366,6 +366,7 @@ export default { 'Clear All': 'Clear All', 'Remember my choice': 'Remember my choice', Apply: 'Apply', - Reset: 'Reset' + Reset: 'Reset', + 'Share something on this Relay': 'Share something on this Relay' } } diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index b4d51cbe..e6f1d104 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -371,6 +371,7 @@ export default { 'Clear All': 'Limpiar todo', 'Remember my choice': 'Recordar mi elección', Apply: 'Aplicar', - Reset: 'Restablecer' + Reset: 'Restablecer', + 'Share something on this Relay': 'Comparte algo en este relé' } } diff --git a/src/i18n/locales/fa.ts b/src/i18n/locales/fa.ts index ab74d7d0..4d1e26be 100644 --- a/src/i18n/locales/fa.ts +++ b/src/i18n/locales/fa.ts @@ -366,6 +366,7 @@ export default { 'Clear All': 'پاک کردن همه', 'Remember my choice': 'انتخاب من را به خاطر بسپار', Apply: 'اعمال', - Reset: 'بازنشانی' + Reset: 'بازنشانی', + 'Share something on this Relay': 'در این رله چیزی به اشتراک بگذارید' } } diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index adc66c7b..182e1d7a 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -371,6 +371,7 @@ export default { 'Clear All': 'Tout effacer', 'Remember my choice': 'Se souvenir de mon choix', Apply: 'Appliquer', - Reset: 'Réinitialiser' + Reset: 'Réinitialiser', + 'Share something on this Relay': 'Partager quelque chose sur ce relais' } } diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index e827cacf..95bffd06 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -370,6 +370,7 @@ export default { 'Clear All': 'Cancella tutto', 'Remember my choice': 'Ricorda la mia scelta', Apply: 'Applica', - Reset: 'Reimposta' + Reset: 'Reimposta', + 'Share something on this Relay': 'Condividi qualcosa su questo Relay' } } diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index e8269afb..9c175bfc 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -368,6 +368,7 @@ export default { 'Clear All': 'すべてクリア', 'Remember my choice': '選択を記憶', Apply: '適用', - Reset: 'リセット' + Reset: 'リセット', + 'Share something on this Relay': 'このリレーで何かを共有する' } } diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 1d52bb6b..364edfbf 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -367,6 +367,7 @@ export default { 'Clear All': '모두 지우기', 'Remember my choice': '내 선택 기억하기', Apply: '적용', - Reset: '초기화' + Reset: '초기화', + 'Share something on this Relay': '이 릴레이에서 무언가를 공유하세요' } } diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index 5627bc2e..ec0fb106 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -370,6 +370,7 @@ export default { 'Clear All': 'Wyczyść wszystko', 'Remember my choice': 'Zapamiętaj mój wybór', Apply: 'Zastosuj', - Reset: 'Resetuj' + Reset: 'Resetuj', + 'Share something on this Relay': 'Udostępnij coś na tym przekaźniku' } } diff --git a/src/i18n/locales/pt-BR.ts b/src/i18n/locales/pt-BR.ts index 363daf1f..9edd5e00 100644 --- a/src/i18n/locales/pt-BR.ts +++ b/src/i18n/locales/pt-BR.ts @@ -369,6 +369,7 @@ export default { 'Clear All': 'Limpar tudo', 'Remember my choice': 'Lembrar minha escolha', Apply: 'Aplicar', - Reset: 'Redefinir' + Reset: 'Redefinir', + 'Share something on this Relay': 'Compartilhe algo neste Relay' } } diff --git a/src/i18n/locales/pt-PT.ts b/src/i18n/locales/pt-PT.ts index fc651d93..4e2767b5 100644 --- a/src/i18n/locales/pt-PT.ts +++ b/src/i18n/locales/pt-PT.ts @@ -370,6 +370,7 @@ export default { 'Clear All': 'Limpar tudo', 'Remember my choice': 'Lembrar a minha escolha', Apply: 'Aplicar', - Reset: 'Repor' + Reset: 'Repor', + 'Share something on this Relay': 'Partilhe algo neste Relay' } } diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index ed1e6cab..188ba992 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -370,6 +370,7 @@ export default { 'Clear All': 'Очистить все', 'Remember my choice': 'Запомнить мой выбор', Apply: 'Применить', - Reset: 'Сбросить' + Reset: 'Сбросить', + 'Share something on this Relay': 'Поделиться чем-то на этом релее' } } diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index 0c903925..14f6c0c6 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -364,6 +364,7 @@ export default { 'Clear All': 'ล้างทั้งหมด', 'Remember my choice': 'จำการเลือกของฉัน', Apply: 'ใช้', - Reset: 'รีเซ็ต' + Reset: 'รีเซ็ต', + 'Share something on this Relay': 'แชร์บางอย่างบนรีเลย์นี้' } } diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index 9e861b47..3077a9f2 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -362,6 +362,7 @@ export default { 'Clear All': '清空', 'Remember my choice': '记住我的选择', Apply: '应用', - Reset: '重置' + Reset: '重置', + 'Share something on this Relay': '在此服务器上分享点什么' } }