fix(ui): fix hotkey key & untranslated string

This commit is contained in:
psychedelicious 2024-01-04 16:24:31 +11:00 committed by Kent Keirsey
parent 6930d8ba41
commit 8f9e9e639e
2 changed files with 7 additions and 5 deletions

View File

@ -86,6 +86,7 @@
"copyError": "$t(gallery.copy) Error", "copyError": "$t(gallery.copy) Error",
"close": "Close", "close": "Close",
"on": "On", "on": "On",
"or": "or",
"checkpoint": "Checkpoint", "checkpoint": "Checkpoint",
"communityLabel": "Community", "communityLabel": "Community",
"controlNet": "ControlNet", "controlNet": "ControlNet",

View File

@ -1,7 +1,7 @@
/* eslint-disable i18next/no-literal-string */
import { Flex, Kbd, Spacer } from '@chakra-ui/react'; import { Flex, Kbd, Spacer } from '@chakra-ui/react';
import { InvText } from 'common/components/InvText/wrapper'; import { InvText } from 'common/components/InvText/wrapper';
import { memo } from 'react'; import { Fragment, memo } from 'react';
import { useTranslation } from 'react-i18next';
interface HotkeysModalProps { interface HotkeysModalProps {
hotkeys: string[][]; hotkeys: string[][];
@ -10,6 +10,7 @@ interface HotkeysModalProps {
} }
const HotkeyListItem = (props: HotkeysModalProps) => { const HotkeyListItem = (props: HotkeysModalProps) => {
const { t } = useTranslation();
const { title, hotkeys, description } = props; const { title, hotkeys, description } = props;
return ( return (
<Flex flexDir="column" gap={2} px={2}> <Flex flexDir="column" gap={2} px={2}>
@ -18,7 +19,7 @@ const HotkeyListItem = (props: HotkeysModalProps) => {
<Spacer /> <Spacer />
{hotkeys.map((hotkey, index) => { {hotkeys.map((hotkey, index) => {
return ( return (
<> <Fragment key={`${hotkey}-${index}`}>
{hotkey.map((key, index) => ( {hotkey.map((key, index) => (
<> <>
<Kbd <Kbd
@ -41,10 +42,10 @@ const HotkeyListItem = (props: HotkeysModalProps) => {
variant="subtext" variant="subtext"
fontWeight="semibold" fontWeight="semibold"
> >
or {t('common.or')}
</InvText> </InvText>
)} )}
</> </Fragment>
); );
})} })}
</Flex> </Flex>