Skip to content

Commit

Permalink
Merge pull request #357 from plebbit/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
plebeius-eth authored Jun 2, 2024
2 parents 314eebe + ad7a893 commit 8c788cc
Show file tree
Hide file tree
Showing 59 changed files with 489 additions and 354 deletions.
Binary file added public/assets/buttons/close-x-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion public/translations/ar/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "اظهر",
"plebbit_options": "خيارات plebbit",
"general": "عام",
"own_communities": "المجتمعات الخاصة بي"
"own_communities": "المجتمعات الخاصة بي",
"invalid_community_address": "عنوان المجتمع غير صالح"
}
3 changes: 2 additions & 1 deletion public/translations/bn/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "দেখান",
"plebbit_options": "প্লেবিট বিকল্প",
"general": "সাধারণ",
"own_communities": "নিজস্ব সম্প্রদায়"
"own_communities": "নিজস্ব সম্প্রদায়",
"invalid_community_address": "অবৈধ সম্প্রদায় ঠিকানা"
}
3 changes: 2 additions & 1 deletion public/translations/cs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "ukázat",
"plebbit_options": "plebbit možnosti",
"general": "obecné",
"own_communities": "vlastní komunity"
"own_communities": "vlastní komunity",
"invalid_community_address": "Neplatná adresa komunity"
}
3 changes: 2 additions & 1 deletion public/translations/da/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "vise",
"plebbit_options": "plebbit indstillinger",
"general": "almindelig",
"own_communities": "egne fællesskaber"
"own_communities": "egne fællesskaber",
"invalid_community_address": "Ugyldig fællesskabsadresse"
}
3 changes: 2 additions & 1 deletion public/translations/de/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "zeigen",
"plebbit_options": "plebbit optionen",
"general": "allgemein",
"own_communities": "eigene Gemeinschaften"
"own_communities": "eigene Gemeinschaften",
"invalid_community_address": "Ungültige Gemeindeadresse"
}
3 changes: 2 additions & 1 deletion public/translations/el/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "εμφάνιση",
"plebbit_options": "επιλογές plebbit",
"general": "γενικός",
"own_communities": "δικές μου κοινότητες"
"own_communities": "δικές μου κοινότητες",
"invalid_community_address": "Μη έγκυρη διεύθυνση κοινότητας"
}
3 changes: 2 additions & 1 deletion public/translations/en/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "show",
"plebbit_options": "plebbit options",
"general": "general",
"own_communities": "own communities"
"own_communities": "own communities",
"invalid_community_address": "Invalid community address"
}
3 changes: 2 additions & 1 deletion public/translations/es/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "mostrar",
"plebbit_options": "opciones plebbit",
"general": "general",
"own_communities": "comunidades propias"
"own_communities": "comunidades propias",
"invalid_community_address": "Dirección de comunidad no válida"
}
3 changes: 2 additions & 1 deletion public/translations/fa/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "نمایش",
"plebbit_options": "گزینه های plebbit",
"general": "عمومی",
"own_communities": "انجمن‌های خودم"
"own_communities": "انجمن‌های خودم",
"invalid_community_address": "آدرس انجمن نامعتبر است"
}
3 changes: 2 additions & 1 deletion public/translations/fi/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "näyttää",
"plebbit_options": "plebbit-vaihtoehdot",
"general": "yleinen",
"own_communities": "omat yhteisöt"
"own_communities": "omat yhteisöt",
"invalid_community_address": "Virheellinen yhteisön osoite"
}
3 changes: 2 additions & 1 deletion public/translations/fil/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "ipakita",
"plebbit_options": "mga pagpipilian ng plebbit",
"general": "pangkalahatan",
"own_communities": "sariling mga pamayanan"
"own_communities": "sariling mga pamayanan",
"invalid_community_address": "Hindi wastong address ng pamayanan"
}
3 changes: 2 additions & 1 deletion public/translations/fr/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "montrer",
"plebbit_options": "options plebbit",
"general": "général",
"own_communities": "communautés propres"
"own_communities": "communautés propres",
"invalid_community_address": "Adresse de la communauté non valide"
}
3 changes: 2 additions & 1 deletion public/translations/he/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "תצוגה",
"plebbit_options": "אפשרויות plebbit",
"general": "כללי",
"own_communities": "הקהילות שלי"
"own_communities": "הקהילות שלי",
"invalid_community_address": "כתובת הקהילה אינה חוקית"
}
3 changes: 2 additions & 1 deletion public/translations/hi/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "दिखाएँ",
"plebbit_options": "plebbit विकल्प",
"general": "सामान्य",
"own_communities": "खुद की समुदायें"
"own_communities": "खुद की समुदायें",
"invalid_community_address": "अमान्य समुदाय पता"
}
3 changes: 2 additions & 1 deletion public/translations/hu/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "mutat",
"plebbit_options": "plebbit lehetőségek",
"general": "általános",
"own_communities": "saját közösségek"
"own_communities": "saját közösségek",
"invalid_community_address": "Érvénytelen közösségi cím"
}
3 changes: 2 additions & 1 deletion public/translations/id/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "menunjukkan",
"plebbit_options": "opsi plebbit",
"general": "umum",
"own_communities": "komunitas sendiri"
"own_communities": "komunitas sendiri",
"invalid_community_address": "Alamat komunitas tidak valid"
}
3 changes: 2 additions & 1 deletion public/translations/it/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "mostra",
"plebbit_options": "opzioni plebbit",
"general": "generali",
"own_communities": "comunità che possiedo"
"own_communities": "comunità che possiedo",
"invalid_community_address": "Indirizzo comunità non valido"
}
3 changes: 2 additions & 1 deletion public/translations/ja/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "表示",
"plebbit_options": "plebbitのオプション",
"general": "一般的な",
"own_communities": "自分のコミュニティ"
"own_communities": "自分のコミュニティ",
"invalid_community_address": "無効なコミュニティアドレス"
}
3 changes: 2 additions & 1 deletion public/translations/ko/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "보여주다",
"plebbit_options": "plebbit 옵션",
"general": "일반",
"own_communities": "나의 커뮤니티"
"own_communities": "나의 커뮤니티",
"invalid_community_address": "잘못된 커뮤니티 주소"
}
3 changes: 2 additions & 1 deletion public/translations/mr/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "दाखवा",
"plebbit_options": "प्लेबिट पर्याय",
"general": "सामान्य",
"own_communities": "स्वत: समुदाये"
"own_communities": "स्वत: समुदाये",
"invalid_community_address": "अवैध समुदाय पत्ता"
}
3 changes: 2 additions & 1 deletion public/translations/nl/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "tonen",
"plebbit_options": "plebbit-opties",
"general": "algemeen",
"own_communities": "eigen gemeenschappen"
"own_communities": "eigen gemeenschappen",
"invalid_community_address": "Ongeldig gemeenschapsadres"
}
3 changes: 2 additions & 1 deletion public/translations/no/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "vise",
"plebbit_options": "plebbit alternativer",
"general": "generell",
"own_communities": "egne fellesskap"
"own_communities": "egne fellesskap",
"invalid_community_address": "Ugyldig fellesskapsadresse"
}
3 changes: 2 additions & 1 deletion public/translations/pl/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "pokazać",
"plebbit_options": "opcje plebbit",
"general": "ogólny",
"own_communities": "własne społeczności"
"own_communities": "własne społeczności",
"invalid_community_address": "Nieprawidłowy adres społeczności"
}
3 changes: 2 additions & 1 deletion public/translations/pt/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "mostrar",
"plebbit_options": "opções plebbit",
"general": "geral",
"own_communities": "comunidades próprias"
"own_communities": "comunidades próprias",
"invalid_community_address": "Endereço da comunidade inválido"
}
3 changes: 2 additions & 1 deletion public/translations/ro/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "arată",
"plebbit_options": "opțiuni plebbit",
"general": "general",
"own_communities": "comunități proprii"
"own_communities": "comunități proprii",
"invalid_community_address": "Adresă comunitară nevalidă"
}
3 changes: 2 additions & 1 deletion public/translations/ru/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "показать",
"plebbit_options": "опции plebbit",
"general": "общий",
"own_communities": "собственные сообщества"
"own_communities": "собственные сообщества",
"invalid_community_address": "Недействительный адрес сообщества"
}
3 changes: 2 additions & 1 deletion public/translations/sq/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "shfaq",
"plebbit_options": "opsione plebbit",
"general": "i përgjithshëm",
"own_communities": "komunitete të mia"
"own_communities": "komunitete të mia",
"invalid_community_address": "Adresa e komunitetit e pavlefshme"
}
3 changes: 2 additions & 1 deletion public/translations/sv/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "visa",
"plebbit_options": "plebbit-alternativ",
"general": "allmän",
"own_communities": "egna samhällen"
"own_communities": "egna samhällen",
"invalid_community_address": "Ogiltig samhällsadress"
}
3 changes: 2 additions & 1 deletion public/translations/te/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "చూపించు",
"plebbit_options": "plebbit ఎంపికలు",
"general": "సాధారణ",
"own_communities": "నా సముదాయాలు"
"own_communities": "నా సముదాయాలు",
"invalid_community_address": "అమాన్యమైన సముదాయ చిరునామా"
}
3 changes: 2 additions & 1 deletion public/translations/th/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "แสดง",
"plebbit_options": "ตัวเลือก plebbit",
"general": "ทั่วไป",
"own_communities": "ชุมชนของฉัน"
"own_communities": "ชุมชนของฉัน",
"invalid_community_address": "ที่อยู่ชุมชนไม่ถูกต้อง"
}
3 changes: 2 additions & 1 deletion public/translations/tr/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "göstermek",
"plebbit_options": "plebbit seçenekleri",
"general": "genel",
"own_communities": "kendi topluluklarım"
"own_communities": "kendi topluluklarım",
"invalid_community_address": "Geçersiz topluluk adresi"
}
3 changes: 2 additions & 1 deletion public/translations/uk/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "показати",
"plebbit_options": "плебіт варіанти",
"general": "загальний",
"own_communities": "власні спільноти"
"own_communities": "власні спільноти",
"invalid_community_address": "Недійсна адреса спільноти"
}
3 changes: 2 additions & 1 deletion public/translations/ur/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "دکھائیں",
"plebbit_options": "پلیبٹ اختیارات",
"general": "عام",
"own_communities": "اپنی کمیونٹیاں"
"own_communities": "اپنی کمیونٹیاں",
"invalid_community_address": "غیر درست مجتمع کا پتہ"
}
3 changes: 2 additions & 1 deletion public/translations/vi/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "hiển thị",
"plebbit_options": "tùy chọn plebbit",
"general": "chung",
"own_communities": "cộng đồng của riêng tôi"
"own_communities": "cộng đồng của riêng tôi",
"invalid_community_address": "Địa chỉ cộng đồng không hợp lệ"
}
3 changes: 2 additions & 1 deletion public/translations/zh/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,6 @@
"show": "显示",
"plebbit_options": "plebbit选项",
"general": "一般",
"own_communities": "自己的社区"
"own_communities": "自己的社区",
"invalid_community_address": "无效的社区地址"
}
8 changes: 3 additions & 5 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ import TopBar from './components/topbar';
export const sortTypes = ['hot', 'new', 'active', 'controversialAll', 'topAll'];

const CheckRouteParams = () => {
const { accountCommentIndex, commentCid, sortType, subplebbitAddress, timeFilterName } = useParams();

const { accountCommentIndex, sortType, timeFilterName } = useParams();
const isValidAccountCommentIndex = !accountCommentIndex || (!isNaN(parseInt(accountCommentIndex)) && parseInt(accountCommentIndex) >= 0);
const isValidCommentCid = !commentCid || /^Qm[a-zA-Z0-9]{44}$/.test(commentCid);
const isValidSubplebbitAddress = !subplebbitAddress || subplebbitAddress.includes('.') || /^12D3K[a-zA-Z0-9]{44}$/.test(subplebbitAddress);
const isSortTypeValid = !sortType || sortTypes.includes(sortType);
const isTimeFilterNameValid = !timeFilterName || timeFilterNames.includes(timeFilterName as any);
const isAccountCommentIndexValid = !accountCommentIndex || !isNaN(parseInt(accountCommentIndex));

if (!isValidAccountCommentIndex || !isValidCommentCid || !isValidSubplebbitAddress || !isSortTypeValid || !isTimeFilterNameValid || !isAccountCommentIndexValid) {
if (!isValidAccountCommentIndex || !isSortTypeValid || !isTimeFilterNameValid || !isAccountCommentIndexValid) {
return <NotFound />;
}

Expand Down Expand Up @@ -95,6 +92,7 @@ const App = () => {
<Route path='/profile/downvoted/:sortType?/:timeFilterName?' element={<Profile />} />
<Route path='/profile/comments/:sortType?/:timeFilterName?' element={<Profile />} />
<Route path='/profile/submitted/:sortType?/:timeFilterName?' element={<Profile />} />
<Route path='/profile/hidden/:sortType?/:timeFilterName?' element={<Profile />} />

<Route path='/u/:authorAddress/c/:commentCid?/:sortType?/:timeFilterName?' element={<Author />} />
<Route path='/u/:authorAddress/c/:commentCid?/comments/:sortType?/:timeFilterName?' element={<Author />} />
Expand Down
12 changes: 6 additions & 6 deletions src/components/account-bar/account-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const AccountBar = () => {
const location = useLocation();
const params = useParams();
const subplebbitAddress = params.subplebbitAddress;
const isSubplebbit = isSubplebbitView(location.pathname, params);
const isSubmit = isSubmitView(location.pathname);
const isSettings = isSettingsView(location.pathname);
const isInSubplebbitView = isSubplebbitView(location.pathname, params);
const isInSubmitView = isSubmitView(location.pathname);
const isInSettingsView = isSettingsView(location.pathname);

const [searchVisible, setSearchVisible] = useState(false);
const toggleSearchVisible = () => setSearchVisible(!searchVisible);
Expand All @@ -33,7 +33,7 @@ const AccountBar = () => {
const mailClass = unreadNotificationCount ? styles.mailIconUnread : styles.mailIconRead;

let submitLink = '/submit';
if (isSubplebbit) {
if (isInSubplebbitView) {
submitLink = `/p/${subplebbitAddress}/submit`;
}

Expand Down Expand Up @@ -102,7 +102,7 @@ const AccountBar = () => {
</span>
<span className={styles.submitButton}>
<span className={styles.separator}>|</span>
<Link to={submitLink} className={`${styles.textButton} ${isSubmit && styles.selectedTextButton}`}>
<Link to={submitLink} className={`${styles.textButton} ${isInSubmitView && styles.selectedTextButton}`}>
{t('submit')}
</Link>
</span>
Expand All @@ -123,7 +123,7 @@ const AccountBar = () => {
)}
</span>
<span className={styles.separator}>|</span>
<Link to='/settings' className={`${styles.textButton} ${isSettings && styles.selectedTextButton}`}>
<Link to='/settings' className={`${styles.textButton} ${isInSettingsView && styles.selectedTextButton}`}>
{t('preferences')}
</Link>
</div>
Expand Down
Loading

0 comments on commit 8c788cc

Please sign in to comment.