fix key warnings

This commit is contained in:
Tom (plebeius.eth)
2025-03-04 16:45:34 +01:00
parent d0a5e90907
commit 0748673bad
5 changed files with 18 additions and 11 deletions
@@ -1,4 +1,4 @@
import { useState } from 'react'; import { Fragment, useState } from 'react';
import { useLocation, useParams } from 'react-router-dom'; import { useLocation, useParams } from 'react-router-dom';
import { Trans, useTranslation } from 'react-i18next'; import { Trans, useTranslation } from 'react-i18next';
import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils'; import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils';
@@ -84,7 +84,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
i18nKey={'comment_edited_at_timestamp'} i18nKey={'comment_edited_at_timestamp'}
values={{ timestamp: getFormattedDate(edit?.timestamp) }} values={{ timestamp: getFormattedDate(edit?.timestamp) }}
shouldUnescape={true} shouldUnescape={true}
components={{ 1: <Tooltip content={getFormattedTimeAgo(edit?.timestamp)} children={<></>} /> }} components={{ 1: <Tooltip content={getFormattedTimeAgo(edit?.timestamp)} children={<Fragment key={edit?.timestamp}></Fragment>} /> }}
/>{' '} />{' '}
{reason && <>{t('reason_reason', { reason: reason, interpolation: { escapeValue: false } })} </>} {reason && <>{t('reason_reason', { reason: reason, interpolation: { escapeValue: false } })} </>}
{showOriginal ? ( {showOriginal ? (
+1 -1
View File
@@ -251,7 +251,7 @@ const PostMedia = ({ commentMediaInfo, hasThumbnail, isDescription, isRules, spo
const [showThumbnail, setShowThumbnail] = useState(true); const [showThumbnail, setShowThumbnail] = useState(true);
const mediaDimensions = getMediaDimensions(commentMediaInfo); const mediaDimensions = getMediaDimensions(commentMediaInfo);
console.log('mediaDimensions', mediaDimensions);
return ( return (
<div className={styles.file}> <div className={styles.file}>
<div className={styles.fileText}> <div className={styles.fileText}>
@@ -142,6 +142,7 @@ const AvatarSettings = () => {
components={{ components={{
1: ( 1: (
<Link <Link
key='token-address-link'
to='https://github.com/plebbit/plebbit-react-hooks/blob/557cc3f40b5933a00553ed9c0bc310d2cd7a3b52/src/hooks/authors/author-avatars.ts#L133' to='https://github.com/plebbit/plebbit-react-hooks/blob/557cc3f40b5933a00553ed9c0bc310d2cd7a3b52/src/hooks/authors/author-avatars.ts#L133'
target='_blank' target='_blank'
rel='noopener noreferrer' rel='noopener noreferrer'
@@ -177,9 +178,9 @@ const AvatarSettings = () => {
i18nKey='copy_message_etherscan' i18nKey='copy_message_etherscan'
values={{ copy: hasCopied ? t('copied') : t('copy') }} values={{ copy: hasCopied ? t('copied') : t('copy') }}
components={{ components={{
1: <button onClick={copyMessageToSign} />, 1: <button key='copy-message-button' onClick={copyMessageToSign} />,
// eslint-disable-next-line // eslint-disable-next-line
2: <a href='https://etherscan.io/verifiedSignatures' target='_blank' rel='noopener noreferrer' />, 2: <a key='etherscan-link' href='https://etherscan.io/verifiedSignatures' target='_blank' rel='noopener noreferrer' />,
}} }}
/> />
</div> </div>
@@ -52,13 +52,13 @@ const SubplebbitStats = () => {
<Trans <Trans
i18nKey='board_stats_hour' i18nKey='board_stats_hour'
values={{ userCount: stats.hourActiveUserCount ?? '?', postCount: stats.hourPostCount ?? '?' }} values={{ userCount: stats.hourActiveUserCount ?? '?', postCount: stats.hourPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }} components={{ 1: <span key='hour-stat-value' className={styles.statValue} /> }}
/> />
{' / '} {' / '}
<Trans <Trans
i18nKey='board_stats_day' i18nKey='board_stats_day'
values={{ userCount: stats.dayActiveUserCount ?? '?', postCount: stats.dayPostCount ?? '?' }} values={{ userCount: stats.dayActiveUserCount ?? '?', postCount: stats.dayPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }} components={{ 1: <span key='day-stat-value' className={styles.statValue} /> }}
/> />
</td> </td>
</tr> </tr>
@@ -67,13 +67,13 @@ const SubplebbitStats = () => {
<Trans <Trans
i18nKey='board_stats_week' i18nKey='board_stats_week'
values={{ userCount: stats.weekActiveUserCount ?? '?', postCount: stats.weekPostCount ?? '?' }} values={{ userCount: stats.weekActiveUserCount ?? '?', postCount: stats.weekPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }} components={{ 1: <span key='week-stat-value' className={styles.statValue} /> }}
/> />
{' / '} {' / '}
<Trans <Trans
i18nKey='board_stats_month' i18nKey='board_stats_month'
values={{ userCount: stats.monthActiveUserCount ?? '?', postCount: stats.monthPostCount ?? '?' }} values={{ userCount: stats.monthActiveUserCount ?? '?', postCount: stats.monthPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }} components={{ 1: <span key='month-stat-value' className={styles.statValue} /> }}
/> />
</td> </td>
</tr> </tr>
@@ -84,7 +84,7 @@ const SubplebbitStats = () => {
<Trans <Trans
i18nKey='board_stats_all' i18nKey='board_stats_all'
values={{ userCount: stats.allActiveUserCount ?? '?', postCount: stats.allPostCount ?? '?' }} values={{ userCount: stats.allActiveUserCount ?? '?', postCount: stats.allPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }} components={{ 1: <span key='all-stat-value' className={styles.statValue} /> }}
/> />
</td> </td>
</tr> </tr>
+7 -1
View File
@@ -52,7 +52,13 @@ const InfoBox = () => {
<h2>{t('what_is_plebchan')}</h2> <h2>{t('what_is_plebchan')}</h2>
</div> </div>
<div className={styles.boxContent}> <div className={styles.boxContent}>
<Trans i18nKey='plebchan_description' shouldUnescape={true} components={{ 1: <Link to='https://plebbit.com' target='_blank' rel='noopener noreferrer' /> }} /> <Trans
i18nKey='plebchan_description'
shouldUnescape={true}
components={{
1: <Link key='plebbit-link' to='https://plebbit.com' target='_blank' rel='noopener noreferrer' />,
}}
/>
<br /> <br />
<br /> <br />
{t('no_global_rules_info')} {t('no_global_rules_info')}