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 { Trans, useTranslation } from 'react-i18next';
import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils';
@@ -84,7 +84,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
i18nKey={'comment_edited_at_timestamp'}
values={{ timestamp: getFormattedDate(edit?.timestamp) }}
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 } })} </>}
{showOriginal ? (
+1 -1
View File
@@ -251,7 +251,7 @@ const PostMedia = ({ commentMediaInfo, hasThumbnail, isDescription, isRules, spo
const [showThumbnail, setShowThumbnail] = useState(true);
const mediaDimensions = getMediaDimensions(commentMediaInfo);
console.log('mediaDimensions', mediaDimensions);
return (
<div className={styles.file}>
<div className={styles.fileText}>
@@ -142,6 +142,7 @@ const AvatarSettings = () => {
components={{
1: (
<Link
key='token-address-link'
to='https://github.com/plebbit/plebbit-react-hooks/blob/557cc3f40b5933a00553ed9c0bc310d2cd7a3b52/src/hooks/authors/author-avatars.ts#L133'
target='_blank'
rel='noopener noreferrer'
@@ -177,9 +178,9 @@ const AvatarSettings = () => {
i18nKey='copy_message_etherscan'
values={{ copy: hasCopied ? t('copied') : t('copy') }}
components={{
1: <button onClick={copyMessageToSign} />,
1: <button key='copy-message-button' onClick={copyMessageToSign} />,
// 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>
@@ -52,13 +52,13 @@ const SubplebbitStats = () => {
<Trans
i18nKey='board_stats_hour'
values={{ userCount: stats.hourActiveUserCount ?? '?', postCount: stats.hourPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }}
components={{ 1: <span key='hour-stat-value' className={styles.statValue} /> }}
/>
{' / '}
<Trans
i18nKey='board_stats_day'
values={{ userCount: stats.dayActiveUserCount ?? '?', postCount: stats.dayPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }}
components={{ 1: <span key='day-stat-value' className={styles.statValue} /> }}
/>
</td>
</tr>
@@ -67,13 +67,13 @@ const SubplebbitStats = () => {
<Trans
i18nKey='board_stats_week'
values={{ userCount: stats.weekActiveUserCount ?? '?', postCount: stats.weekPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }}
components={{ 1: <span key='week-stat-value' className={styles.statValue} /> }}
/>
{' / '}
<Trans
i18nKey='board_stats_month'
values={{ userCount: stats.monthActiveUserCount ?? '?', postCount: stats.monthPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }}
components={{ 1: <span key='month-stat-value' className={styles.statValue} /> }}
/>
</td>
</tr>
@@ -84,7 +84,7 @@ const SubplebbitStats = () => {
<Trans
i18nKey='board_stats_all'
values={{ userCount: stats.allActiveUserCount ?? '?', postCount: stats.allPostCount ?? '?' }}
components={{ 1: <span className={styles.statValue} /> }}
components={{ 1: <span key='all-stat-value' className={styles.statValue} /> }}
/>
</td>
</tr>