diff --git a/.eslintrc.json b/.eslintrc.json index 84f6bb0b5..54e72c64f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -133,7 +133,7 @@ "no-irregular-whitespace": "error", "no-loop-func": "error", "no-mixed-spaces-and-tabs": "error", - "no-nested-ternary": "warn", + "no-nested-ternary": "error", "no-restricted-imports": [ "error", { diff --git a/src/actions/settings.ts b/src/actions/settings.ts index 257656b74..e05771fdc 100644 --- a/src/actions/settings.ts +++ b/src/actions/settings.ts @@ -241,7 +241,8 @@ const saveSettings = (opts?: SettingOpts) => const getLocale = (state: RootState, fallback = 'en') => { const localeWithVariant = (getSettings(state).get('locale') as string).replace('_', '-'); const locale = localeWithVariant.split('-')[0]; - return Object.keys(messages).includes(localeWithVariant) ? localeWithVariant : Object.keys(messages).includes(locale) ? locale : fallback; + const fallbackLocale = Object.keys(messages).includes(locale) ? locale : fallback; + return Object.keys(messages).includes(localeWithVariant) ? localeWithVariant : fallbackLocale; }; type SettingsAction = diff --git a/src/features/admin/domains.tsx b/src/features/admin/domains.tsx index e2455f3f8..60a89d43f 100644 --- a/src/features/admin/domains.tsx +++ b/src/features/admin/domains.tsx @@ -51,7 +51,9 @@ const Domain: React.FC = ({ domain }) => { })); }; - const domainState = domain.last_checked_at ? (domain.resolves ? 'active' : 'error') : 'pending'; + const resolveState = domain.resolves ? 'active' : 'error'; + const domainState = domain.last_checked_at ? resolveState : 'pending'; + const domainStateLabel = { active: , error: , diff --git a/src/features/auth-login/components/registration-form.tsx b/src/features/auth-login/components/registration-form.tsx index 19259ff52..ea5c9c94b 100644 --- a/src/features/auth-login/components/registration-form.tsx +++ b/src/features/auth-login/components/registration-form.tsx @@ -141,13 +141,19 @@ const RegistrationForm: React.FC = ({ inviteToken }) => { />

} ); + const confirmationHeading = needsConfirmation + ? intl.formatMessage(messages.needsConfirmationHeader) + : undefined; + + const approvalHeading = needsApproval + ? intl.formatMessage(messages.needsApprovalHeader) + : undefined; + + const heading = confirmationHeading || approvalHeading; + dispatch(openModal('CONFIRM', { icon: require('@tabler/icons/outline/check.svg'), - heading: needsConfirmation - ? intl.formatMessage(messages.needsConfirmationHeader) - : needsApproval - ? intl.formatMessage(messages.needsApprovalHeader) - : undefined, + heading: heading, message, confirm: intl.formatMessage(messages.close), })); diff --git a/src/features/backups/index.tsx b/src/features/backups/index.tsx index 9cac7cb13..6c9d97f92 100644 --- a/src/features/backups/index.tsx +++ b/src/features/backups/index.tsx @@ -88,12 +88,14 @@ const Backups = () => { ); - const body = showLoading ? : backups.isEmpty() ? emptyMessage : ( + const backupsContent = backups.isEmpty() ? emptyMessage : (
{backups.map((backup) => )}
); + const body = showLoading ? : backupsContent; + return ( {body} diff --git a/src/features/filters/index.tsx b/src/features/filters/index.tsx index 41001c396..99e46039b 100644 --- a/src/features/filters/index.tsx +++ b/src/features/filters/index.tsx @@ -70,50 +70,56 @@ const Filters = () => { emptyMessage={emptyMessage} itemClassName='pb-4 last:pb-0' > - {filters.map((filter) => ( -
- - - - - {' '} - {filter.keywords.map(keyword => keyword.keyword).join(', ')} - - - - {' '} - {filter.context.map(context => contexts[context] ? intl.formatMessage(contexts[context]) : context).join(', ')} - - + {filters.map((filter) => { + + const truthMessageFilter = filter.filter_action === 'hide' ? + : + ; + + const falseMessageFilter = (filter.filter_action === 'hide' ? + : + ); + + return ( +
+ + - {filtersV2 ? ( - filter.filter_action === 'hide' ? - : - - ) : (filter.filter_action === 'hide' ? - : - )} + + {' '} + {filter.keywords.map(keyword => keyword.keyword).join(', ')} - {filter.expires_at && ( + + + {' '} + {filter.context.map(context => contexts[context] ? intl.formatMessage(contexts[context]) : context).join(', ')} + + - {new Date(filter.expires_at).getTime() <= Date.now() - ? - : } + {filtersV2 ? truthMessageFilter : falseMessageFilter} - )} + {filter.expires_at && ( + + {new Date(filter.expires_at).getTime() <= Date.now() + ? + : } + + )} + + + + + - - - - - -
- ))} +
+ ); + }, + )}
); diff --git a/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx b/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx index 5dac02d2d..3818819b7 100644 --- a/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx +++ b/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx @@ -22,6 +22,8 @@ const CaptchaModal: React.FC = ({ onClose }) => { xPosition, } = useCaptcha(); + const messageButton = tryAgain ? : ; + return ( } width='sm' @@ -46,10 +48,7 @@ const CaptchaModal: React.FC = ({ onClose }) => { > {isSubmitting ? ( - ) : (tryAgain ? - : - - )} + ) : messageButton}