mirror of
https://github.com/plebbit/seedit.git
synced 2026-02-14 16:01:04 -05:00
@@ -44,7 +44,7 @@
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "cross-env PUBLIC_URL=./ GENERATE_SOURCEMAP=false react-scripts build",
|
||||
"build-netlify": "cross-env PUBLIC_URL=./ GENERATE_SOURCEMAP=true REACT_APP_COMMIT_REF=$COMMIT_REF react-scripts build",
|
||||
"build-netlify": "cross-env PUBLIC_URL=./ GENERATE_SOURCEMAP=true REACT_APP_COMMIT_REF=$COMMIT_REF CI='' react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"electron": "yarn electron:before && electron .",
|
||||
|
||||
@@ -25,17 +25,6 @@
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>seedit</title>
|
||||
<script>
|
||||
(function() {
|
||||
// This checks if the URL does not contain a hash
|
||||
if (!window.location.hash) {
|
||||
// Calculate the base URL (protocol + host)
|
||||
const baseURL = window.location.protocol + '//' + window.location.host + '/';
|
||||
// Redirect to the base URL with `#/`
|
||||
window.location.replace(baseURL + '#/');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "ناقص الرمز المتسلسل",
|
||||
"missing_token_address": "عنوان الرمز المفقود",
|
||||
"missing_token_id": "معرف الرمز المفقود",
|
||||
"missing_signature": "التوقيع المفقود"
|
||||
"missing_signature": "التوقيع المفقود",
|
||||
"edited_timestamp": "تم التحرير {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "নিখোঁজ শৃঙ্খলা টিকার",
|
||||
"missing_token_address": "নিখোঁজ টোকেন ঠিকানা",
|
||||
"missing_token_id": "নিখোঁজ টোকেন আইডি",
|
||||
"missing_signature": "নিখোঁজ স্বাক্ষর"
|
||||
"missing_signature": "নিখোঁজ স্বাক্ষর",
|
||||
"edited_timestamp": "সম্পাদনা করা হয়েছে {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Chybějící řetězový ticker",
|
||||
"missing_token_address": "Chybějící tokenová adresa",
|
||||
"missing_token_id": "Chybějící ID tokenu",
|
||||
"missing_signature": "Chybějící podpis"
|
||||
"missing_signature": "Chybějící podpis",
|
||||
"edited_timestamp": "Upraveno {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Manglende kæde ticker",
|
||||
"missing_token_address": "Manglende tokensadresse",
|
||||
"missing_token_id": "Manglende token-id",
|
||||
"missing_signature": "Manglende signatur"
|
||||
"missing_signature": "Manglende signatur",
|
||||
"edited_timestamp": "Redigeret {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Fehlender Blockchain-Ticker",
|
||||
"missing_token_address": "Fehlende Tokenadresse",
|
||||
"missing_token_id": "Fehlende Token-ID",
|
||||
"missing_signature": "Fehlende Signatur"
|
||||
"missing_signature": "Fehlende Signatur",
|
||||
"edited_timestamp": "Bearbeitet {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Ελλειπτικός αλυσιδωτός ticker",
|
||||
"missing_token_address": "Ελλειπτική διεύθυνση του token",
|
||||
"missing_token_id": "Ελλειπτικό αναγνωριστικό token",
|
||||
"missing_signature": "Ελλειπτική υπογραφή"
|
||||
"missing_signature": "Ελλειπτική υπογραφή",
|
||||
"edited_timestamp": "Επεξεργάστηκε {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Missing chain ticker",
|
||||
"missing_token_address": "Missing token address",
|
||||
"missing_token_id": "Missing token ID",
|
||||
"missing_signature": "Missing signature"
|
||||
"missing_signature": "Missing signature",
|
||||
"edited_timestamp": "Edited {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Falta de ticker de blockchain",
|
||||
"missing_token_address": "Falta de dirección de token",
|
||||
"missing_token_id": "Falta de ID de token",
|
||||
"missing_signature": "Falta de firma"
|
||||
"missing_signature": "Falta de firma",
|
||||
"edited_timestamp": "Editado {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "تیکر زنجیره ای گم شده",
|
||||
"missing_token_address": "آدرس توکن گم شده",
|
||||
"missing_token_id": "شناسه توکن گم شده",
|
||||
"missing_signature": "امضای گم شده"
|
||||
"missing_signature": "امضای گم شده",
|
||||
"edited_timestamp": "ویرایش شده {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Puuttuva ketjuticker",
|
||||
"missing_token_address": "Puuttuva token-osoite",
|
||||
"missing_token_id": "Puuttuva token-id",
|
||||
"missing_signature": "Puuttuva allekirjoitus"
|
||||
"missing_signature": "Puuttuva allekirjoitus",
|
||||
"edited_timestamp": "Muokattu {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Kulang na ticker ng chain",
|
||||
"missing_token_address": "Kulang na address ng token",
|
||||
"missing_token_id": "Kulang na ID ng token",
|
||||
"missing_signature": "Kulang na lagda"
|
||||
"missing_signature": "Kulang na lagda",
|
||||
"edited_timestamp": "Na-edit na ang {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Ticker de blockchain manquant",
|
||||
"missing_token_address": "Adresse de token manquante",
|
||||
"missing_token_id": "ID de token manquant",
|
||||
"missing_signature": "Signature manquante"
|
||||
"missing_signature": "Signature manquante",
|
||||
"edited_timestamp": "Édité {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "ציון בלוקצ'יין חסר",
|
||||
"missing_token_address": "כתובת הטוקן חסרה",
|
||||
"missing_token_id": "מזהה הטוקן חסר",
|
||||
"missing_signature": "חתימה חסרה"
|
||||
"missing_signature": "חתימה חסרה",
|
||||
"edited_timestamp": "נערך {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "गायब श्रृंखला टिकर",
|
||||
"missing_token_address": "गायब टोकन पता",
|
||||
"missing_token_id": "गायब टोकन आईडी",
|
||||
"missing_signature": "गायब हस्ताक्षर"
|
||||
"missing_signature": "गायब हस्ताक्षर",
|
||||
"edited_timestamp": "संपादित {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Hiányzó lánc ticker",
|
||||
"missing_token_address": "Hiányzó token cím",
|
||||
"missing_token_id": "Hiányzó token azonosító",
|
||||
"missing_signature": "Hiányzó aláírás"
|
||||
"missing_signature": "Hiányzó aláírás",
|
||||
"edited_timestamp": "Szerkesztve {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Ticker blockchain yang hilang",
|
||||
"missing_token_address": "Alamat token yang hilang",
|
||||
"missing_token_id": "ID token yang hilang",
|
||||
"missing_signature": "Tanda tangan yang hilang"
|
||||
"missing_signature": "Tanda tangan yang hilang",
|
||||
"edited_timestamp": "Diedit {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Ticker blockchain mancante",
|
||||
"missing_token_address": "Indirizzo del token mancante",
|
||||
"missing_token_id": "ID del token mancante",
|
||||
"missing_signature": "Firma mancante"
|
||||
"missing_signature": "Firma mancante",
|
||||
"edited_timestamp": "Modificato {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "不足しているチェーンティッカー",
|
||||
"missing_token_address": "不足しているトークンアドレス",
|
||||
"missing_token_id": "不足しているトークンID",
|
||||
"missing_signature": "不足している署名"
|
||||
"missing_signature": "不足している署名",
|
||||
"edited_timestamp": "編集済み {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "부재중인 블록체인 티커",
|
||||
"missing_token_address": "부재중인 토큰 주소",
|
||||
"missing_token_id": "부재중인 토큰 ID",
|
||||
"missing_signature": "부재중인 서명"
|
||||
"missing_signature": "부재중인 서명",
|
||||
"edited_timestamp": "편집됨 {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "गुमलेला श्रृंखला टिकर",
|
||||
"missing_token_address": "गुमलेला टोकन पत्ता",
|
||||
"missing_token_id": "गुमलेला टोकन आयडी",
|
||||
"missing_signature": "गुमलेली स्वाक्षरे"
|
||||
"missing_signature": "गुमलेली स्वाक्षरे",
|
||||
"edited_timestamp": "{{timestamp}} संपादित"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Ontbrekende blockchain ticker",
|
||||
"missing_token_address": "Ontbrekend tokenadres",
|
||||
"missing_token_id": "Ontbrekend token-ID",
|
||||
"missing_signature": "Ontbrekende handtekening"
|
||||
"missing_signature": "Ontbrekende handtekening",
|
||||
"edited_timestamp": "Bewerkt {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Manglende Blockchain-ticker",
|
||||
"missing_token_address": "Manglende tokenadresse",
|
||||
"missing_token_id": "Manglende token-ID",
|
||||
"missing_signature": "Manglende signatur"
|
||||
"missing_signature": "Manglende signatur",
|
||||
"edited_timestamp": "Redigert {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Brakujący ticker blockchain",
|
||||
"missing_token_address": "Brakujący adres tokena",
|
||||
"missing_token_id": "Brakujące ID tokenu",
|
||||
"missing_signature": "Brakujący podpis"
|
||||
"missing_signature": "Brakujący podpis",
|
||||
"edited_timestamp": "Edytowane {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Faltando ticker de blockchain",
|
||||
"missing_token_address": "Endereço do token em falta",
|
||||
"missing_token_id": "ID de token em falta",
|
||||
"missing_signature": "Assinatura em falta"
|
||||
"missing_signature": "Assinatura em falta",
|
||||
"edited_timestamp": "Editado {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Lipsește ticker blockchain",
|
||||
"missing_token_address": "Lipsește adresa tokenului",
|
||||
"missing_token_id": "Lipsește ID-ul tokenului",
|
||||
"missing_signature": "Lipsește semnătura"
|
||||
"missing_signature": "Lipsește semnătura",
|
||||
"edited_timestamp": "Editat {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Отсутствующий тикер блокчейна",
|
||||
"missing_token_address": "Отсутствующий адрес токена",
|
||||
"missing_token_id": "Отсутствующий идентификатор токена",
|
||||
"missing_signature": "Отсутствующая подпись"
|
||||
"missing_signature": "Отсутствующая подпись",
|
||||
"edited_timestamp": "Отредактировано {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Mungon ticker blockchain",
|
||||
"missing_token_address": "Adresa e munguar e tokenit",
|
||||
"missing_token_id": "ID e munguar e tokenit",
|
||||
"missing_signature": "Nënshkrimi i munguar"
|
||||
"missing_signature": "Nënshkrimi i munguar",
|
||||
"edited_timestamp": "Redaktuar {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Saknad blockchain ticker",
|
||||
"missing_token_address": "Saknad tokenadress",
|
||||
"missing_token_id": "Saknad token-ID",
|
||||
"missing_signature": "Saknad signatur"
|
||||
"missing_signature": "Saknad signatur",
|
||||
"edited_timestamp": "Redigerat {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "తప్పిన బ్లాక్ చేన్ టిక్కర్",
|
||||
"missing_token_address": "తప్పని టోకెన్ చిరునామా",
|
||||
"missing_token_id": "తప్పని టోకెన్ ఐడి",
|
||||
"missing_signature": "తప్పని సంతకం"
|
||||
"missing_signature": "తప్పని సంతకం",
|
||||
"edited_timestamp": "{{timestamp}} ముందు సవరించబడింది"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "เครื่องหมายเหตุที่หายไป",
|
||||
"missing_token_address": "เหตุที่หายไปของที่อยู่โทเค็น",
|
||||
"missing_token_id": "เหตุที่หายไปของรหัสของโทเค็น",
|
||||
"missing_signature": "เหตุที่หายไปของลายเซ็น"
|
||||
"missing_signature": "เหตุที่หายไปของลายเซ็น",
|
||||
"edited_timestamp": "แก้ไขเมื่อ {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Eksik Blockchain ticker",
|
||||
"missing_token_address": "Eksik token adresi",
|
||||
"missing_token_id": "Eksik token kimliği",
|
||||
"missing_signature": "Eksik imza"
|
||||
"missing_signature": "Eksik imza",
|
||||
"edited_timestamp": "{{timestamp}} önce düzenlendi"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Відсутній тікер блокчейну",
|
||||
"missing_token_address": "Відсутня адреса токена",
|
||||
"missing_token_id": "Відсутній ідентифікатор токена",
|
||||
"missing_signature": "Відсутній підпис"
|
||||
"missing_signature": "Відсутній підпис",
|
||||
"edited_timestamp": "Відредаговано {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "گمشدہ بلاک چین ٹکر",
|
||||
"missing_token_address": "گمشدہ ٹوکن ایڈریس",
|
||||
"missing_token_id": "گمشدہ ٹوکن شناختی نمبر",
|
||||
"missing_signature": "گمشدہ دستخط"
|
||||
"missing_signature": "گمشدہ دستخط",
|
||||
"edited_timestamp": "{{timestamp}} پہلے ترمیم شدہ"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "Ticker chuỗi khối bị thiếu",
|
||||
"missing_token_address": "Địa chỉ token bị thiếu",
|
||||
"missing_token_id": "Thiếu ID của token",
|
||||
"missing_signature": "Thiếu chữ ký"
|
||||
"missing_signature": "Thiếu chữ ký",
|
||||
"edited_timestamp": "Đã chỉnh sửa {{timestamp}}"
|
||||
}
|
||||
@@ -286,5 +286,6 @@
|
||||
"missing_chain_ticker": "缺失的区块链标记",
|
||||
"missing_token_address": "缺失的代币地址",
|
||||
"missing_token_id": "缺失的代币ID",
|
||||
"missing_signature": "缺失的签名"
|
||||
"missing_signature": "缺失的签名",
|
||||
"edited_timestamp": "编辑于{{timestamp}}"
|
||||
}
|
||||
12
src/app.tsx
12
src/app.tsx
@@ -24,6 +24,7 @@ import StickyHeader from './components/sticky-header';
|
||||
import TopBar from './components/topbar';
|
||||
|
||||
export const sortTypes = ['hot', 'new', 'active', 'controversialAll', 'topAll'];
|
||||
const isElectron = window.isElectron === true;
|
||||
|
||||
const CheckRouteParams = () => {
|
||||
let { sortType, timeFilterName, accountCommentIndex } = useParams<{ sortType?: string; timeFilterName?: string; accountCommentIndex?: string }>();
|
||||
@@ -71,6 +72,15 @@ const App = () => {
|
||||
</>
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!window.location.hash && !isElectron) {
|
||||
// Calculate the base URL (protocol + host)
|
||||
const baseURL = window.location.protocol + '//' + window.location.host + '/';
|
||||
// Redirect to the base URL with `#/`
|
||||
window.location.replace(baseURL + '#/');
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={`${styles.app} ${theme}`}>
|
||||
<Routes>
|
||||
@@ -105,7 +115,7 @@ const App = () => {
|
||||
<Route path='/p/all/about' element={<About />} />
|
||||
|
||||
<Route path='/p/:subplebbitAddress/c/:commentCid' element={<PostPage />} />
|
||||
<Route path='/p/:subplebbitAddress/c/:commentCid/context' element={<PostPage />} />
|
||||
<Route path='/p/:subplebbitAddress/c/:commentCid?context=1' element={<PostPage />} />
|
||||
<Route path='/p/:subplebbitAddress/c/:commentCid/about' element={<About />} />
|
||||
|
||||
<Route path='/p/:subplebbitAddress/submit' element={<Submit />} />
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Author, useAccount, useComment, useSubplebbit } from '@plebbit/plebbit-
|
||||
import styles from './comment-tools.module.css';
|
||||
import EditMenu from './edit-menu';
|
||||
import HideMenu from './hide-menu';
|
||||
import Label from '../label';
|
||||
import ModMenu from './mod-menu';
|
||||
import ShareMenu from './share-menu';
|
||||
import Label from '../label';
|
||||
import { isInboxView } from '../../../lib/utils/view-utils';
|
||||
|
||||
interface CommentToolsProps {
|
||||
@@ -51,7 +51,19 @@ const ModOrReportButton = ({ cid, isAuthor, isMod }: ModOrReportButtonProps) =>
|
||||
);
|
||||
};
|
||||
|
||||
const PostTools = ({ author, cid, hasLabel, index, isAuthor, isMod, subplebbitAddress, replyCount = 0, showCommentEditForm, spoiler = false }: CommentToolsProps) => {
|
||||
const PostTools = ({
|
||||
author,
|
||||
cid,
|
||||
failed,
|
||||
hasLabel,
|
||||
index,
|
||||
isAuthor,
|
||||
isMod,
|
||||
subplebbitAddress,
|
||||
replyCount = 0,
|
||||
showCommentEditForm,
|
||||
spoiler = false,
|
||||
}: CommentToolsProps) => {
|
||||
const { t } = useTranslation();
|
||||
const validReplyCount = isNaN(replyCount) ? 0 : replyCount;
|
||||
const commentCount = validReplyCount === 0 ? t('post_no_comments') : `${validReplyCount} ${validReplyCount === 1 ? t('post_comment') : t('post_comments')}`;
|
||||
@@ -67,10 +79,12 @@ const PostTools = ({ author, cid, hasLabel, index, isAuthor, isMod, subplebbitAd
|
||||
}
|
||||
};
|
||||
|
||||
const commentCountButton = failed ? <span>{commentCount}</span> : <Link to={cid ? `/p/${subplebbitAddress}/c/${cid}` : `/profile/${index}`}>{commentCount}</Link>;
|
||||
|
||||
return (
|
||||
<>
|
||||
<li className={`${styles.button} ${!hasLabel ? styles.firstButton : ''}`} onClick={() => cid && handlePostClick?.()}>
|
||||
<Link to={cid ? `/p/${subplebbitAddress}/c/${cid}` : `/profile/${index}`}>{commentCount}</Link>
|
||||
{commentCountButton}
|
||||
</li>
|
||||
<ShareMenu cid={cid} subplebbitAddress={subplebbitAddress} />
|
||||
{/* TODO: Implement save functionality
|
||||
@@ -90,14 +104,26 @@ const PostTools = ({ author, cid, hasLabel, index, isAuthor, isMod, subplebbitAd
|
||||
);
|
||||
};
|
||||
|
||||
const ReplyTools = ({ author, cid, hasLabel, index, isAuthor, isMod, showReplyForm, subplebbitAddress, showCommentEditForm, spoiler = false }: CommentToolsProps) => {
|
||||
const ReplyTools = ({
|
||||
author,
|
||||
cid,
|
||||
failed,
|
||||
hasLabel,
|
||||
index,
|
||||
isAuthor,
|
||||
isMod,
|
||||
showReplyForm,
|
||||
subplebbitAddress,
|
||||
showCommentEditForm,
|
||||
spoiler = false,
|
||||
}: CommentToolsProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const permalink = failed ? <span>permalink</span> : <Link to={cid ? `/p/${subplebbitAddress}/c/${cid}` : `/profile/${index}`}>permalink</Link>;
|
||||
|
||||
return (
|
||||
<>
|
||||
<li className={`${styles.button} ${!hasLabel ? styles.firstButton : ''}`}>
|
||||
<Link to={cid ? `/p/${subplebbitAddress}/c/${cid}` : `/profile/${index}`}>permalink</Link>
|
||||
</li>
|
||||
<li className={`${styles.button} ${!hasLabel ? styles.firstButton : ''}`}>{permalink}</li>
|
||||
<ShareMenu cid={cid} subplebbitAddress={subplebbitAddress} />
|
||||
{/* TODO: Implement save functionality
|
||||
<li className={styles.button}>
|
||||
@@ -133,25 +159,35 @@ const SingleReplyTools = ({
|
||||
|
||||
const hasContext = parentCid !== postCid;
|
||||
|
||||
const permalinkButton = cid ? <Link to={cid ? `/p/${subplebbitAddress}/c/${cid}` : `/profile/${index}`}>permalink</Link> : <span>permalink</span>;
|
||||
|
||||
const contextButton = cid ? (
|
||||
<Link to={cid ? (hasContext ? `/p/${subplebbitAddress}/c/${cid}?context=1` : `/p/${subplebbitAddress}/c/${cid}`) : `/profile/${index}`}>{t('context')}</Link>
|
||||
) : (
|
||||
<span>{t('context')}</span>
|
||||
);
|
||||
|
||||
const fullCommentsButton = cid ? (
|
||||
<Link to={cid ? `/p/${subplebbitAddress}/c/${postCid}` : `/profile/${index}`}>
|
||||
{t('full_comments')} ({comment?.replyCount || 0})
|
||||
</Link>
|
||||
) : (
|
||||
<span>
|
||||
{t('full_comments')} ({comment?.replyCount || 0})
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<li className={`${styles.button} ${!hasLabel ? styles.firstButton : ''}`}>
|
||||
<Link to={cid ? `/p/${subplebbitAddress}/c/${cid}` : `/profile/${index}`}>permalink</Link>
|
||||
</li>
|
||||
<li className={`${styles.button} ${!hasLabel ? styles.firstButton : ''}`}>{permalinkButton}</li>
|
||||
{/* TODO: Implement save functionality
|
||||
<li className={styles.button}>
|
||||
<span>{t('save')}</span>
|
||||
</li>
|
||||
*/}
|
||||
{isAuthor && <EditMenu cid={cid} spoiler={spoiler} showCommentEditForm={showCommentEditForm} />}
|
||||
<li className={styles.button}>
|
||||
<Link to={cid ? (hasContext ? `/p/${subplebbitAddress}/c/${cid}/context` : `/p/${subplebbitAddress}/c/${cid}`) : `/profile/${index}`}>{t('context')}</Link>
|
||||
</li>
|
||||
<li className={styles.button}>
|
||||
<Link to={cid ? `/p/${subplebbitAddress}/c/${postCid}` : `/profile/${index}`}>
|
||||
{t('full_comments')} ({comment?.replyCount || 0})
|
||||
</Link>
|
||||
</li>
|
||||
<li className={styles.button}>{contextButton}</li>
|
||||
<li className={styles.button}>{fullCommentsButton}</li>
|
||||
<HideMenu author={author} cid={cid} isMod={isMod} subplebbitAddress={subplebbitAddress} />
|
||||
<li className={!cid ? styles.hideReply : styles.button}>
|
||||
<span onClick={() => cid && showReplyForm?.()}>{t('reply_reply')}</span>
|
||||
@@ -207,21 +243,12 @@ const CommentTools = ({
|
||||
|
||||
return (
|
||||
<ul className={`${styles.buttons} ${isReply && !isInInboxView ? styles.buttonsReply : ''} ${hasLabel ? styles.buttonsLabel : ''}`}>
|
||||
<CommentToolsLabel
|
||||
cid={cid}
|
||||
deleted={deleted}
|
||||
failed={failed}
|
||||
editState={editState}
|
||||
isReply={isReply}
|
||||
removed={removed}
|
||||
spoiler={spoiler}
|
||||
subplebbitAddress={subplebbitAddress}
|
||||
/>
|
||||
{isReply ? (
|
||||
isSingleReply ? (
|
||||
<SingleReplyTools
|
||||
author={author}
|
||||
cid={cid}
|
||||
failed={failed}
|
||||
hasLabel={hasLabel}
|
||||
index={index}
|
||||
isAuthor={isAuthor}
|
||||
@@ -237,6 +264,7 @@ const CommentTools = ({
|
||||
<ReplyTools
|
||||
author={author}
|
||||
cid={cid}
|
||||
failed={failed}
|
||||
hasLabel={hasLabel}
|
||||
index={index}
|
||||
isAuthor={isAuthor}
|
||||
@@ -248,18 +276,31 @@ const CommentTools = ({
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<PostTools
|
||||
author={author}
|
||||
cid={cid}
|
||||
hasLabel={hasLabel}
|
||||
index={index}
|
||||
isAuthor={isAuthor}
|
||||
isMod={isMod}
|
||||
replyCount={replyCount}
|
||||
showCommentEditForm={showCommentEditForm}
|
||||
spoiler={spoiler}
|
||||
subplebbitAddress={subplebbitAddress}
|
||||
/>
|
||||
<>
|
||||
<CommentToolsLabel
|
||||
cid={cid}
|
||||
deleted={deleted}
|
||||
failed={failed}
|
||||
editState={editState}
|
||||
isReply={isReply}
|
||||
removed={removed}
|
||||
spoiler={spoiler}
|
||||
subplebbitAddress={subplebbitAddress}
|
||||
/>
|
||||
<PostTools
|
||||
author={author}
|
||||
cid={cid}
|
||||
failed={failed}
|
||||
hasLabel={hasLabel}
|
||||
index={index}
|
||||
isAuthor={isAuthor}
|
||||
isMod={isMod}
|
||||
replyCount={replyCount}
|
||||
showCommentEditForm={showCommentEditForm}
|
||||
spoiler={spoiler}
|
||||
subplebbitAddress={subplebbitAddress}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</ul>
|
||||
);
|
||||
|
||||
@@ -66,14 +66,14 @@ const EditMenu = ({ cid, showCommentEditForm }: EditMenuProps) => {
|
||||
<li className={styles.button}>
|
||||
<span
|
||||
onClick={() => {
|
||||
showCommentEditForm && showCommentEditForm();
|
||||
showCommentEditForm && cid && showCommentEditForm();
|
||||
}}
|
||||
>
|
||||
{t('edit')}
|
||||
</span>
|
||||
</li>
|
||||
<li className={styles.button}>
|
||||
<span onClick={deleteComment}>{t('delete')}</span>
|
||||
<span onClick={() => cid && deleteComment()}>{t('delete')}</span>
|
||||
</li>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -75,8 +75,8 @@ const HideMenu = ({ author, cid, isMod, subplebbitAddress }: HideMenuProps) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<li className={styles.button} ref={refs.setReference} {...getReferenceProps()}>
|
||||
<span onClick={() => setIsHideMenuOpen(!isHideMenuOpen)}>{t('hide')}</span>
|
||||
<li className={styles.button} ref={refs.setReference} {...(cid && getReferenceProps())}>
|
||||
<span onClick={() => cid && setIsHideMenuOpen(!isHideMenuOpen)}>{t('hide')}</span>
|
||||
</li>
|
||||
{isHideMenuOpen && (
|
||||
<FloatingFocusManager context={context} modal={false}>
|
||||
|
||||
@@ -72,8 +72,8 @@ const ModMenu = ({ cid }: ModMenuProps) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<li className={styles.button} ref={refs.setReference} {...getReferenceProps()}>
|
||||
<span onClick={() => setIsModMenuOpen(!isModMenuOpen)}>{t('moderation')}</span>
|
||||
<li className={styles.button} ref={refs.setReference} {...(cid && getReferenceProps())}>
|
||||
<span onClick={() => cid && setIsModMenuOpen(!isModMenuOpen)}>{t('moderation')}</span>
|
||||
</li>
|
||||
{isModMenuOpen && (
|
||||
<FloatingFocusManager context={context} modal={false}>
|
||||
@@ -102,7 +102,7 @@ const ModMenu = ({ cid }: ModMenuProps) => {
|
||||
<div className={styles.menuItem}>
|
||||
<label>
|
||||
<input onChange={onCheckbox} checked={publishCommentEditOptions.pinned} type='checkbox' id='pinned' />
|
||||
{t('announcement')}
|
||||
{isReply ? t('stickied_comment') : t('announcement')}
|
||||
</label>
|
||||
</div>
|
||||
<div className={`${styles.menuItem} ${styles.menuReason}`}>
|
||||
|
||||
@@ -137,6 +137,11 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.timeEdit {
|
||||
text-transform: lowercase;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.subplebbit:hover, .author:hover span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@@ -245,8 +245,8 @@ const Post = ({ index, post = {} }: PostProps) => {
|
||||
/>
|
||||
)}
|
||||
<div className={styles.tagline}>
|
||||
{t('submitted')} {getFormattedTimeAgo(timestamp)} {edit && <span title={t('last_edited', { timestamp: getFormattedTimeAgo(edit.timestamp) })}>*</span>}{' '}
|
||||
{t('post_by')}
|
||||
{t('submitted')} {getFormattedTimeAgo(timestamp)}{' '}
|
||||
{edit && <span className={styles.timeEdit}>{t('last_edited', { timestamp: getFormattedTimeAgo(edit.timestamp) })}</span>} {t('post_by')}
|
||||
<PostAuthor
|
||||
authorAddress={author?.address}
|
||||
authorRole={authorRole}
|
||||
|
||||
@@ -95,6 +95,11 @@
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
.timeEdited {
|
||||
font-style: italic;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
.stateString {
|
||||
font-size: x-small;
|
||||
color: var(--text-info);
|
||||
|
||||
@@ -321,7 +321,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl
|
||||
const location = useLocation();
|
||||
const params = useParams();
|
||||
const isInInboxView = isInboxView(location.pathname);
|
||||
const isInPostContextView = isPostContextView(location.pathname, params);
|
||||
const isInPostContextView = isPostContextView(location.pathname, params, location.search);
|
||||
|
||||
return (
|
||||
<div className={styles.reply}>
|
||||
@@ -353,7 +353,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl
|
||||
<span className={styles.score}>{scoreString}</span>{' '}
|
||||
<span className={styles.time}>
|
||||
{getFormattedTimeAgo(timestamp)}
|
||||
{edit && <span title={t('last_edited', { timestamp: getFormattedTimeAgo(edit.timestamp) })}>*</span>}
|
||||
{edit && <span className={styles.timeEdited}> {t('edited_timestamp', { timestamp: getFormattedTimeAgo(edit.timestamp) })}</span>}
|
||||
</span>{' '}
|
||||
{pinned && <span className={styles.pinned}>- {t('stickied_comment')}</span>}
|
||||
{collapsed && <span className={styles.children}> ({childrenString})</span>}
|
||||
@@ -428,6 +428,7 @@ const Reply = ({ cidOfReplyWithContext, depth = 0, isSingleComment, isSingleRepl
|
||||
<CommentTools
|
||||
author={author}
|
||||
cid={cid}
|
||||
failed={state === 'failed'}
|
||||
isReply={true}
|
||||
isSingleReply={isSingleReply}
|
||||
index={reply?.index}
|
||||
|
||||
@@ -88,8 +88,8 @@ export const isPostView = (pathname: string, params: ParamsType): boolean => {
|
||||
return params.subplebbitAddress && params.commentCid ? pathname.startsWith(`/p/${params.subplebbitAddress}/c/${params.commentCid}`) : false;
|
||||
};
|
||||
|
||||
export const isPostContextView = (pathname: string, params: ParamsType): boolean => {
|
||||
return params.subplebbitAddress && params.commentCid ? pathname.startsWith(`/p/${params.subplebbitAddress}/c/${params.commentCid}/context`) : false;
|
||||
export const isPostContextView = (pathname: string, params: ParamsType, search: string): boolean => {
|
||||
return params.subplebbitAddress && params.commentCid ? `${pathname}${search}` === `/p/${params.subplebbitAddress}/c/${params.commentCid}?context=1` : false;
|
||||
};
|
||||
|
||||
export const isProfileView = (pathname: string): boolean => {
|
||||
|
||||
@@ -41,7 +41,7 @@ const Post = ({ post }: { post: Comment }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{post?.locked && (
|
||||
{(post?.locked || post?.removed) && (
|
||||
<div className={styles.lockedInfobar}>
|
||||
<div className={styles.lockedInfobarText}>{t('post_locked_info')}</div>
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@ const PostWithContext = ({ post }: { post: Comment }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{post?.locked && (
|
||||
{(post?.locked || post?.removed) && (
|
||||
<div className={styles.lockedInfobar}>
|
||||
<div className={styles.lockedInfobarText}>{t('post_locked_info')}</div>
|
||||
</div>
|
||||
@@ -133,7 +133,7 @@ const PostPage = () => {
|
||||
const location = useLocation();
|
||||
|
||||
const isInPendingView = isPendingView(location.pathname, params);
|
||||
const isInPostContextView = isPostContextView(location.pathname, params);
|
||||
const isInPostContextView = isPostContextView(location.pathname, params, location.search);
|
||||
|
||||
const post = useComment({ commentCid: params?.commentCid });
|
||||
const { cid, downvoteCount, timestamp, upvoteCount } = post || {};
|
||||
|
||||
Reference in New Issue
Block a user