From 199d1dcb471942ad225fe370757e0bacf407ecf0 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 16 Feb 2024 12:37:51 +0100 Subject: [PATCH 01/11] chore(translations): copy full address, node stats, version --- public/translations/ar/default.json | 5 ++++- public/translations/bn/default.json | 5 ++++- public/translations/cs/default.json | 5 ++++- public/translations/da/default.json | 5 ++++- public/translations/de/default.json | 5 ++++- public/translations/el/default.json | 5 ++++- public/translations/en/default.json | 5 ++++- public/translations/es/default.json | 5 ++++- public/translations/fa/default.json | 5 ++++- public/translations/fi/default.json | 5 ++++- public/translations/fil/default.json | 5 ++++- public/translations/fr/default.json | 5 ++++- public/translations/he/default.json | 5 ++++- public/translations/hi/default.json | 5 ++++- public/translations/hu/default.json | 5 ++++- public/translations/id/default.json | 5 ++++- public/translations/it/default.json | 5 ++++- public/translations/ja/default.json | 5 ++++- public/translations/ko/default.json | 5 ++++- public/translations/mr/default.json | 5 ++++- public/translations/nl/default.json | 5 ++++- public/translations/no/default.json | 5 ++++- public/translations/pl/default.json | 5 ++++- public/translations/pt/default.json | 5 ++++- public/translations/ro/default.json | 5 ++++- public/translations/ru/default.json | 5 ++++- public/translations/sq/default.json | 5 ++++- public/translations/sv/default.json | 5 ++++- public/translations/te/default.json | 5 ++++- public/translations/th/default.json | 5 ++++- public/translations/tr/default.json | 5 ++++- public/translations/uk/default.json | 5 ++++- public/translations/ur/default.json | 5 ++++- public/translations/vi/default.json | 5 ++++- public/translations/zh/default.json | 5 ++++- src/views/settings/address-settings/address-settings.tsx | 4 ++-- src/views/settings/settings.tsx | 2 +- 37 files changed, 143 insertions(+), 38 deletions(-) diff --git a/public/translations/ar/default.json b/public/translations/ar/default.json index 5aa22f41..8bd34974 100644 --- a/public/translations/ar/default.json +++ b/public/translations/ar/default.json @@ -270,5 +270,8 @@ "default_communities": "المجتمعات الافتراضية", "avatar": "الصورة الرمزية", "pending_edit": "تحرير معلق", - "failed_edit": "فشل التعديل" + "failed_edit": "فشل التعديل", + "copy_full_address": "<1>نسخ العنوان الكامل", + "node_stats": "إحصائيات العقدة", + "version": "الإصدار" } \ No newline at end of file diff --git a/public/translations/bn/default.json b/public/translations/bn/default.json index 21da93d9..a9f716e9 100644 --- a/public/translations/bn/default.json +++ b/public/translations/bn/default.json @@ -270,5 +270,8 @@ "default_communities": "ডিফল্ট কমিউনিটিস", "avatar": "অবতার", "pending_edit": "মুলতুবি সম্পাদনা", - "failed_edit": "ব্যর্থ সম্পাদনা" + "failed_edit": "ব্যর্থ সম্পাদনা", + "copy_full_address": "<1>অনুলিপি সম্পূর্ণ ঠিকানা", + "node_stats": "নোড পরিসংখ্যান", + "version": "সংস্করণ" } \ No newline at end of file diff --git a/public/translations/cs/default.json b/public/translations/cs/default.json index 92d237a0..3c938365 100644 --- a/public/translations/cs/default.json +++ b/public/translations/cs/default.json @@ -270,5 +270,8 @@ "default_communities": "výchozí komunity", "avatar": "avatar", "pending_edit": "čekající úprava", - "failed_edit": "neúspěšná úprava" + "failed_edit": "neúspěšná úprava", + "copy_full_address": "<1>kopírovat plnou adresu", + "node_stats": "statistiky uzlu", + "version": "verze" } \ No newline at end of file diff --git a/public/translations/da/default.json b/public/translations/da/default.json index 14f43bdb..34aa503f 100644 --- a/public/translations/da/default.json +++ b/public/translations/da/default.json @@ -270,5 +270,8 @@ "default_communities": "standardfællesskaber", "avatar": "avatar", "pending_edit": "ventende redigering", - "failed_edit": "mislykket redigering" + "failed_edit": "mislykket redigering", + "copy_full_address": "<1>kopiér fuld adresse", + "node_stats": "nodestatistikker", + "version": "version" } \ No newline at end of file diff --git a/public/translations/de/default.json b/public/translations/de/default.json index 18162b2c..51bbe974 100644 --- a/public/translations/de/default.json +++ b/public/translations/de/default.json @@ -270,5 +270,8 @@ "default_communities": "Standard-Communities", "avatar": "Avatar", "pending_edit": "ausstehende Bearbeitung", - "failed_edit": "fehlgeschlagene Bearbeitung" + "failed_edit": "fehlgeschlagene Bearbeitung", + "copy_full_address": "<1>Kopieren Sie die vollständige Adresse", + "node_stats": "Knotenstatistiken", + "version": "Version" } \ No newline at end of file diff --git a/public/translations/el/default.json b/public/translations/el/default.json index 1368526a..66dc8ff1 100644 --- a/public/translations/el/default.json +++ b/public/translations/el/default.json @@ -270,5 +270,8 @@ "default_communities": "προεπιλεγμένες κοινότητες", "avatar": "εικόνα προφίλ", "pending_edit": "εκκρεμής επεξεργασία", - "failed_edit": "αποτυχημένη επεξεργασία" + "failed_edit": "αποτυχημένη επεξεργασία", + "copy_full_address": "<1>αντιγραφή πλήρους διεύθυνσης", + "node_stats": "στατιστικές κόμβων", + "version": "έκδοση" } \ No newline at end of file diff --git a/public/translations/en/default.json b/public/translations/en/default.json index 9ea755fa..d42c2fb5 100644 --- a/public/translations/en/default.json +++ b/public/translations/en/default.json @@ -270,5 +270,8 @@ "default_communities": "default communities", "avatar": "avatar", "pending_edit": "pending edit", - "failed_edit": "failed edit" + "failed_edit": "failed edit", + "copy_full_address": "<1>copy full address", + "node_stats": "node stats", + "version": "version" } \ No newline at end of file diff --git a/public/translations/es/default.json b/public/translations/es/default.json index 2143483e..26ba779d 100644 --- a/public/translations/es/default.json +++ b/public/translations/es/default.json @@ -270,5 +270,8 @@ "default_communities": "comunidades predeterminadas", "avatar": "avatar", "pending_edit": "edición pendiente", - "failed_edit": "edición fallida" + "failed_edit": "edición fallida", + "copy_full_address": "<1>copiar la dirección completa", + "node_stats": "estadísticas del nodo", + "version": "versión" } \ No newline at end of file diff --git a/public/translations/fa/default.json b/public/translations/fa/default.json index 3223eae0..83903a45 100644 --- a/public/translations/fa/default.json +++ b/public/translations/fa/default.json @@ -270,5 +270,8 @@ "default_communities": "جوامع پیش‌فرض", "avatar": "آواتار", "pending_edit": "ویرایش در انتظار", - "failed_edit": "ویرایش ناموفق" + "failed_edit": "ویرایش ناموفق", + "copy_full_address": "<1>کپی آدرس کامل", + "node_stats": "آمار گره", + "version": "نسخه" } \ No newline at end of file diff --git a/public/translations/fi/default.json b/public/translations/fi/default.json index 027b3952..5c23154a 100644 --- a/public/translations/fi/default.json +++ b/public/translations/fi/default.json @@ -270,5 +270,8 @@ "default_communities": "oletusyhteisöt", "avatar": "avatar", "pending_edit": "odottava muokkaus", - "failed_edit": "epäonnistunut muokkaus" + "failed_edit": "epäonnistunut muokkaus", + "copy_full_address": "<1>kopioi koko osoite", + "node_stats": "solmustatistiikka", + "version": "versio" } \ No newline at end of file diff --git a/public/translations/fil/default.json b/public/translations/fil/default.json index 6b8402fe..3be8e87f 100644 --- a/public/translations/fil/default.json +++ b/public/translations/fil/default.json @@ -270,5 +270,8 @@ "default_communities": "default na mga komunidad", "avatar": "avatar", "pending_edit": "naka-pending na edit", - "failed_edit": "nakabigong edit" + "failed_edit": "nakabigong edit", + "copy_full_address": "<1>kopyahin ang buong address", + "node_stats": "stats ng node", + "version": "bersyon" } \ No newline at end of file diff --git a/public/translations/fr/default.json b/public/translations/fr/default.json index e95c0082..54be0dde 100644 --- a/public/translations/fr/default.json +++ b/public/translations/fr/default.json @@ -270,5 +270,8 @@ "default_communities": "communautés par défaut", "avatar": "avatar", "pending_edit": "modification en attente", - "failed_edit": "modification échouée" + "failed_edit": "modification échouée", + "copy_full_address": "<1>copier l'adresse complète", + "node_stats": "statistiques du nœud", + "version": "version" } \ No newline at end of file diff --git a/public/translations/he/default.json b/public/translations/he/default.json index d86250f7..725d9d19 100644 --- a/public/translations/he/default.json +++ b/public/translations/he/default.json @@ -270,5 +270,8 @@ "default_communities": "קהילות ברירת מחדל", "avatar": "אוואטר", "pending_edit": "עריכה ממתינה", - "failed_edit": "עריכה נכשלה" + "failed_edit": "עריכה נכשלה", + "copy_full_address": "<1>העתק כתובת מלאה", + "node_stats": "סטטיסטיקות הצומת", + "version": "גרסה" } \ No newline at end of file diff --git a/public/translations/hi/default.json b/public/translations/hi/default.json index 0333fbde..254e8d0d 100644 --- a/public/translations/hi/default.json +++ b/public/translations/hi/default.json @@ -270,5 +270,8 @@ "default_communities": "डिफ़ॉल्ट समुदाय", "avatar": "अवतार", "pending_edit": "अपूर्ण संपादन", - "failed_edit": "विफल संपादन" + "failed_edit": "विफल संपादन", + "copy_full_address": "<1>कॉपी पूरा पता", + "node_stats": "नोड आंकड़े", + "version": "संस्करण" } \ No newline at end of file diff --git a/public/translations/hu/default.json b/public/translations/hu/default.json index ba78e9cd..1a91efab 100644 --- a/public/translations/hu/default.json +++ b/public/translations/hu/default.json @@ -270,5 +270,8 @@ "default_communities": "alapértelmezett közösségek", "avatar": "avatár", "pending_edit": "folyamatban lévő szerkesztés", - "failed_edit": "sikertelen szerkesztés" + "failed_edit": "sikertelen szerkesztés", + "copy_full_address": "<1>másol teljes cím", + "node_stats": "csomópont statisztikák", + "version": "verzió" } \ No newline at end of file diff --git a/public/translations/id/default.json b/public/translations/id/default.json index 4df3d2ba..f53d6389 100644 --- a/public/translations/id/default.json +++ b/public/translations/id/default.json @@ -270,5 +270,8 @@ "default_communities": "komunitas default", "avatar": "avatar", "pending_edit": "pengeditan tertunda", - "failed_edit": "edit gagal" + "failed_edit": "edit gagal", + "copy_full_address": "<1>salin alamat lengkap", + "node_stats": "statistik node", + "version": "versi" } \ No newline at end of file diff --git a/public/translations/it/default.json b/public/translations/it/default.json index 06a9dc1c..8dc19a4a 100644 --- a/public/translations/it/default.json +++ b/public/translations/it/default.json @@ -270,5 +270,8 @@ "default_communities": "comunità predefinite", "avatar": "avatar", "pending_edit": "modifica in attesa", - "failed_edit": "modifica fallita" + "failed_edit": "modifica fallita", + "copy_full_address": "<1>copia l'indirizzo completo", + "node_stats": "statistiche del nodo", + "version": "versione" } \ No newline at end of file diff --git a/public/translations/ja/default.json b/public/translations/ja/default.json index 1967ecaa..ae4772c5 100644 --- a/public/translations/ja/default.json +++ b/public/translations/ja/default.json @@ -270,5 +270,8 @@ "default_communities": "デフォルトコミュニティ", "avatar": "アバター", "pending_edit": "保留中の編集", - "failed_edit": "失敗した編集" + "failed_edit": "失敗した編集", + "copy_full_address": "<1>コピー完全な住所", + "node_stats": "ノードの統計", + "version": "バージョン" } \ No newline at end of file diff --git a/public/translations/ko/default.json b/public/translations/ko/default.json index f32f732a..e28db937 100644 --- a/public/translations/ko/default.json +++ b/public/translations/ko/default.json @@ -270,5 +270,8 @@ "default_communities": "기본 커뮤니티", "avatar": "아바타", "pending_edit": "대기 중인 편집", - "failed_edit": "실패한 편집" + "failed_edit": "실패한 편집", + "copy_full_address": "<1>복사 전체 주소", + "node_stats": "노드 통계", + "version": "버전" } \ No newline at end of file diff --git a/public/translations/mr/default.json b/public/translations/mr/default.json index 0acc5a59..493df105 100644 --- a/public/translations/mr/default.json +++ b/public/translations/mr/default.json @@ -270,5 +270,8 @@ "default_communities": "डिफॉल्ट समुदाय", "avatar": "अवतार", "pending_edit": "प्रलंबित संपादन", - "failed_edit": "अयशस्वी संपादन" + "failed_edit": "अयशस्वी संपादन", + "copy_full_address": "<1>कॉपी पूर्ण पत्ता", + "node_stats": "नोड स्टॅट्स", + "version": "आवृत्ती" } \ No newline at end of file diff --git a/public/translations/nl/default.json b/public/translations/nl/default.json index d94816f6..ea54c3de 100644 --- a/public/translations/nl/default.json +++ b/public/translations/nl/default.json @@ -270,5 +270,8 @@ "default_communities": "standaardgemeenschappen", "avatar": "avatar", "pending_edit": "in afwachting van bewerking", - "failed_edit": "mislukte bewerking" + "failed_edit": "mislukte bewerking", + "copy_full_address": "<1>kopieer het volledige adres", + "node_stats": "knoopstatistieken", + "version": "versie" } \ No newline at end of file diff --git a/public/translations/no/default.json b/public/translations/no/default.json index 8c4768db..2ad5b966 100644 --- a/public/translations/no/default.json +++ b/public/translations/no/default.json @@ -270,5 +270,8 @@ "default_communities": "standardfellesskap", "avatar": "avatar", "pending_edit": "ventende redigering", - "failed_edit": "mislykket redigering" + "failed_edit": "mislykket redigering", + "copy_full_address": "<1>kopier full adresse", + "node_stats": "nodestatistikk", + "version": "versjon" } \ No newline at end of file diff --git a/public/translations/pl/default.json b/public/translations/pl/default.json index 08cd41cf..3eae77b4 100644 --- a/public/translations/pl/default.json +++ b/public/translations/pl/default.json @@ -270,5 +270,8 @@ "default_communities": "domyślne społeczności", "avatar": "avatar", "pending_edit": "edycja oczekująca", - "failed_edit": "nieudana edycja" + "failed_edit": "nieudana edycja", + "copy_full_address": "<1>skopiuj pełny adres", + "node_stats": "statystyki węzła", + "version": "wersja" } \ No newline at end of file diff --git a/public/translations/pt/default.json b/public/translations/pt/default.json index f9fb089f..cb7e5bc4 100644 --- a/public/translations/pt/default.json +++ b/public/translations/pt/default.json @@ -270,5 +270,8 @@ "default_communities": "comunidades padrão", "avatar": "avatar", "pending_edit": "edição pendente", - "failed_edit": "edição falhada" + "failed_edit": "edição falhada", + "copy_full_address": "<1>copiar endereço completo", + "node_stats": "estatísticas do nó", + "version": "versão" } \ No newline at end of file diff --git a/public/translations/ro/default.json b/public/translations/ro/default.json index d00795a5..cad68b21 100644 --- a/public/translations/ro/default.json +++ b/public/translations/ro/default.json @@ -270,5 +270,8 @@ "default_communities": "comunități implicite", "avatar": "avatar", "pending_edit": "editare în așteptare", - "failed_edit": "editare eșuată" + "failed_edit": "editare eșuată", + "copy_full_address": "<1>copiază adresa completă", + "node_stats": "statistici de nod", + "version": "versiune" } \ No newline at end of file diff --git a/public/translations/ru/default.json b/public/translations/ru/default.json index 5f8c94fd..8e4d5ea2 100644 --- a/public/translations/ru/default.json +++ b/public/translations/ru/default.json @@ -270,5 +270,8 @@ "default_communities": "стандартные сообщества", "avatar": "аватар", "pending_edit": "редактирование ожидается", - "failed_edit": "не удалось отредактировать" + "failed_edit": "не удалось отредактировать", + "copy_full_address": "<1>скопировать полный адрес", + "node_stats": "статистика узла", + "version": "версия" } \ No newline at end of file diff --git a/public/translations/sq/default.json b/public/translations/sq/default.json index 8def8e8a..243e7dbc 100644 --- a/public/translations/sq/default.json +++ b/public/translations/sq/default.json @@ -270,5 +270,8 @@ "default_communities": "komunitete parazgjedhur", "avatar": "avatar", "pending_edit": "ndryshimi në pritje", - "failed_edit": "ndryshimi i dështuar" + "failed_edit": "ndryshimi i dështuar", + "copy_full_address": "<1>kopjo adresën e plotë", + "node_stats": "statistikat e nyjes", + "version": "versioni" } \ No newline at end of file diff --git a/public/translations/sv/default.json b/public/translations/sv/default.json index 19262709..74bdcb7f 100644 --- a/public/translations/sv/default.json +++ b/public/translations/sv/default.json @@ -270,5 +270,8 @@ "default_communities": "standardgemenskaper", "avatar": "avatar", "pending_edit": "avvaktande redigering", - "failed_edit": "misslyckad redigering" + "failed_edit": "misslyckad redigering", + "copy_full_address": "<1>kopiera fullständig adress", + "node_stats": "nodstatistik", + "version": "version" } \ No newline at end of file diff --git a/public/translations/te/default.json b/public/translations/te/default.json index 59774c22..6212fa73 100644 --- a/public/translations/te/default.json +++ b/public/translations/te/default.json @@ -270,5 +270,8 @@ "default_communities": "డిఫాల్ట్ సముదాయాలు", "avatar": "అవతార్", "pending_edit": "పెండింగ్ సవరించడం", - "failed_edit": "విఫలమైన సవరించడం" + "failed_edit": "విఫలమైన సవరించడం", + "copy_full_address": "<1>నకలు పూర్తి చిరునామా", + "node_stats": "నోడ్ స్టాటిస్టిక్స్", + "version": "వెర్షన్" } \ No newline at end of file diff --git a/public/translations/th/default.json b/public/translations/th/default.json index 1787c82a..bc728494 100644 --- a/public/translations/th/default.json +++ b/public/translations/th/default.json @@ -270,5 +270,8 @@ "default_communities": "ชุมชนเริ่มต้น", "avatar": "อวตาร์", "pending_edit": "การแก้ไขที่รอดำเนินการ", - "failed_edit": "การแก้ไขล้มเหลว" + "failed_edit": "การแก้ไขล้มเหลว", + "copy_full_address": "<1>คัดลอก ที่อยู่เต็ม", + "node_stats": "สถิติของโหนด", + "version": "เวอร์ชัน" } \ No newline at end of file diff --git a/public/translations/tr/default.json b/public/translations/tr/default.json index ba659df6..1d12a7a0 100644 --- a/public/translations/tr/default.json +++ b/public/translations/tr/default.json @@ -270,5 +270,8 @@ "default_communities": "varsayılan topluluklar", "avatar": "avatar", "pending_edit": "bekleyen düzenleme", - "failed_edit": "başarısız düzenleme" + "failed_edit": "başarısız düzenleme", + "copy_full_address": "<1>kopyala tam adres", + "node_stats": "düğüm istatistikleri", + "version": "sürüm" } \ No newline at end of file diff --git a/public/translations/uk/default.json b/public/translations/uk/default.json index 1b16c68d..ba064395 100644 --- a/public/translations/uk/default.json +++ b/public/translations/uk/default.json @@ -270,5 +270,8 @@ "default_communities": "типові спільноти", "avatar": "аватар", "pending_edit": "очікуване редагування", - "failed_edit": "невдале редагування" + "failed_edit": "невдале редагування", + "copy_full_address": "<1>скопіювати повну адресу", + "node_stats": "статистика вузла", + "version": "версія" } \ No newline at end of file diff --git a/public/translations/ur/default.json b/public/translations/ur/default.json index 2e29bbd1..7308383b 100644 --- a/public/translations/ur/default.json +++ b/public/translations/ur/default.json @@ -270,5 +270,8 @@ "default_communities": "ڈیفالٹ کمیونٹیز", "avatar": "اوتار", "pending_edit": "زیر التواء ترتیبات", - "failed_edit": "ناکام ترتیبات" + "failed_edit": "ناکام ترتیبات", + "copy_full_address": "<1>کاپی مکمل پتہ", + "node_stats": "نوڈ اشاریہ", + "version": "ورژن" } \ No newline at end of file diff --git a/public/translations/vi/default.json b/public/translations/vi/default.json index acb1c24d..333aee94 100644 --- a/public/translations/vi/default.json +++ b/public/translations/vi/default.json @@ -270,5 +270,8 @@ "default_communities": "các cộng đồng mặc định", "avatar": "avatar", "pending_edit": "chỉnh sửa đang chờ", - "failed_edit": "chỉnh sửa thất bại" + "failed_edit": "chỉnh sửa thất bại", + "copy_full_address": "<1>sao chép địa chỉ đầy đủ", + "node_stats": "thống kê nút", + "version": "phiên bản" } \ No newline at end of file diff --git a/public/translations/zh/default.json b/public/translations/zh/default.json index db0689dc..17cb1fa9 100644 --- a/public/translations/zh/default.json +++ b/public/translations/zh/default.json @@ -270,5 +270,8 @@ "default_communities": "默认社区", "avatar": "头像", "pending_edit": "待处理的编辑", - "failed_edit": "编辑失败" + "failed_edit": "编辑失败", + "copy_full_address": "<1>复制完整地址", + "node_stats": "节点统计", + "version": "版本" } \ No newline at end of file diff --git a/src/views/settings/address-settings/address-settings.tsx b/src/views/settings/address-settings/address-settings.tsx index f2fec941..4a1c5506 100644 --- a/src/views/settings/address-settings/address-settings.tsx +++ b/src/views/settings/address-settings/address-settings.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import { setAccount, useAccount, useResolvedAuthorAddress } from '@plebbit/plebbit-react-hooks'; -import { useTranslation } from 'react-i18next'; +import { Trans, useTranslation } from 'react-i18next'; import styles from './address-settings.module.css'; const AddressSettings = () => { @@ -132,7 +132,7 @@ const AddressSettings = () => { return (
- full address + navigator.clipboard.writeText(account?.signer?.address)} /> }} />
{t('crypto_address')} diff --git a/src/views/settings/settings.tsx b/src/views/settings/settings.tsx index 8d18aaa5..ace91782 100644 --- a/src/views/settings/settings.tsx +++ b/src/views/settings/settings.tsx @@ -189,7 +189,7 @@ const Settings = () => { {isElectron && ( - node stats + {t('node_stats')} )} {commitRef && ( From ce32277f97f44eb3ac6a77c3521f7d9eac5baaf8 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 16 Feb 2024 15:21:15 +0100 Subject: [PATCH 02/11] Update topbar.tsx --- src/components/topbar/topbar.tsx | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/components/topbar/topbar.tsx b/src/components/topbar/topbar.tsx index 40e0445a..3a006770 100644 --- a/src/components/topbar/topbar.tsx +++ b/src/components/topbar/topbar.tsx @@ -47,7 +47,7 @@ const TopBar = () => { const filterDropdownClass = isFilterDropdownOpen ? styles.visible : styles.hidden; const sortLabels = [t('hot'), t('new'), t('active'), t('controversial'), t('top')]; - const [selectedSortType, setSelectedSortType] = useState(params.sortType || '/hot'); + const selectedSortType = params.sortType || 'hot'; const getTimeFilterLink = (timeFilterName: string) => { return isInSubplebbitView @@ -62,14 +62,6 @@ const TopBar = () => { return index >= 0 ? sortLabels[index] : ''; }; - useEffect(() => { - if (params.sortType) { - setSelectedSortType(params.sortType); - } else { - setSelectedSortType('hot'); - } - }, [params.sortType, location.pathname]); - const handleClickOutside = useCallback( (event: MouseEvent) => { const target = event.target as Node; @@ -103,14 +95,13 @@ const TopBar = () => { }; }, [handleClickOutside]); - const [homeLink, setHomeLink] = useState('/'); - const [allLink, setAllLink] = useState('/p/all'); - useEffect(() => { - if (timeFilterName && !isInSubplebbitView) { - setHomeLink(`/${selectedSortType}/${timeFilterName}`); - setAllLink(`/p/all/${selectedSortType}/${timeFilterName}`); - } - }, [timeFilterName, isInSubplebbitView, selectedSortType]); + let homeLink = '/'; + let allLink = '/p/all'; + + if (timeFilterName && !isInSubplebbitView) { + homeLink += `${selectedSortType}/${timeFilterName}`; + allLink += `/${selectedSortType}/${timeFilterName}`; + } return (
@@ -134,8 +125,8 @@ const TopBar = () => {
{getSelectedSortLabel()}
- {sortTypes.map((choice, index) => { - let dropdownLink = isInSubplebbitView ? `/p/${params.subplebbitAddress}/${choice}` : choice; + {sortTypes.map((sortType, index) => { + let dropdownLink = isInSubplebbitView ? `/p/${params.subplebbitAddress}/${sortType}` : isinAllView ? `/p/all/${sortType}` : sortType; if (timeFilterName) { dropdownLink += `/${timeFilterName}`; } From 51f7dbadae5f385216d97b60d65c6ceb5ea0f765 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 16 Feb 2024 15:50:57 +0100 Subject: [PATCH 03/11] fix(account settings): removed unnecessary reload when switching account, allow to delete last account (refreshing creates a new one) --- src/views/settings/account-settings/account-settings.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/views/settings/account-settings/account-settings.tsx b/src/views/settings/account-settings/account-settings.tsx index 4176e9ee..e29eadfc 100644 --- a/src/views/settings/account-settings/account-settings.tsx +++ b/src/views/settings/account-settings/account-settings.tsx @@ -31,7 +31,6 @@ const AccountSettings = () => { const lastAccount = accounts[accounts.length - 1]; setActiveAccount(lastAccount.name); setSwitchToLastAccount(false); - window.location.reload(); } }, [accounts, switchToLastAccount]); @@ -50,10 +49,7 @@ const AccountSettings = () => { }; const _deleteAccount = (accountName: string) => { - if (accounts.length === 1) { - alert(t('last_account_notice')); - return; - } else if (!accountName) { + if (!accountName) { return; } else if (window.confirm(t('delete_confirm', { value: accountName, interpolation: { escapeValue: false } }))) { if (window.confirm(t('double_confirm'))) { From 6273029a1c803756d1f9502366bb18da5c507db4 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 16 Feb 2024 16:07:27 +0100 Subject: [PATCH 04/11] feat(header): add 'all' title to p/all header --- src/components/header/header.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 65bfd256..b51f6ccf 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -280,6 +280,7 @@ const HeaderTitle = ({ title, shortAddress }: { title: string; shortAddress: str const { t } = useTranslation(); const params = useParams(); const location = useLocation(); + const isInAllView = isAllView(location.pathname); const isInAuthorView = isAuthorView(location.pathname); const isInInboxView = isInboxView(location.pathname); const isInPostView = isPostView(location.pathname, params); @@ -328,6 +329,8 @@ const HeaderTitle = ({ title, shortAddress }: { title: string; shortAddress: str return t('communities'); } else if (isInNotFoundView) { return {t('page_not_found')}; + } else if (isInAllView) { + return t('all'); } return null; }; @@ -385,7 +388,7 @@ const Header = () => { )}
- {!isInHomeView && !isInAllView && ( + {!isInHomeView && ( From f5ffd5592da4703892fd090dd861a76e2da56168 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 16 Feb 2024 16:23:41 +0100 Subject: [PATCH 05/11] fix resource not found --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index f0d1766b..00a8a3f7 100644 --- a/public/index.html +++ b/public/index.html @@ -9,7 +9,7 @@ name="description" content="serverless, adminless, decentralized reddit alternative" /> - +