🌐 Missing strings reported on discord
This commit is contained in:
@@ -7,5 +7,6 @@
|
|||||||
"popover": {
|
"popover": {
|
||||||
"title": "Edit mode is enabled for <1>{{size}}</1> size",
|
"title": "Edit mode is enabled for <1>{{size}}</1> size",
|
||||||
"text": "You can adjust and configure your apps now. Changes are <strong>not saved</strong> until you exit edit mode"
|
"text": "You can adjust and configure your apps now. Changes are <strong>not saved</strong> until you exit edit mode"
|
||||||
}
|
},
|
||||||
|
"unloadEvent": "Exit the edit mode to save your changes"
|
||||||
}
|
}
|
||||||
|
|||||||
22
public/locales/en/settings/general/edit-mode-toggle.json
Normal file
22
public/locales/en/settings/general/edit-mode-toggle.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"menu": {
|
||||||
|
"toggle": "Toggle edit mode",
|
||||||
|
"enable": "Enable edit mode",
|
||||||
|
"disable": "Disable edit mode"
|
||||||
|
},
|
||||||
|
"form": {
|
||||||
|
"label": "Edit password",
|
||||||
|
"message": "In order to toggle edit mode, you need to enter the password you entered in the environment variable named <Code>EDIT_MODE_PASSWORD</Code> . If it is not set, you are not able to toggle edit mode on and off.",
|
||||||
|
"submit": "Submit"
|
||||||
|
},
|
||||||
|
"notification": {
|
||||||
|
"success": {
|
||||||
|
"title": "Success",
|
||||||
|
"message": "Successfully toggled edit mode, reloading the page..."
|
||||||
|
},
|
||||||
|
"error": {
|
||||||
|
"title": "Error",
|
||||||
|
"message": "Failed to toggle edit mode, please try again."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,8 +14,6 @@ import { useNamedWrapperColumnCount } from '../../../../Dashboard/Wrappers/grids
|
|||||||
import { useCardStyles } from '../../../useCardStyles';
|
import { useCardStyles } from '../../../useCardStyles';
|
||||||
import { AddElementAction } from '../AddElementAction/AddElementAction';
|
import { AddElementAction } from '../AddElementAction/AddElementAction';
|
||||||
|
|
||||||
const beforeUnloadEventText = 'Exit the edit mode to save your changes';
|
|
||||||
|
|
||||||
export const ToggleEditModeAction = () => {
|
export const ToggleEditModeAction = () => {
|
||||||
const { enabled, toggleEditMode } = useEditModeStore();
|
const { enabled, toggleEditMode } = useEditModeStore();
|
||||||
const namedWrapperColumnCount = useNamedWrapperColumnCount();
|
const namedWrapperColumnCount = useNamedWrapperColumnCount();
|
||||||
@@ -24,7 +22,7 @@ export const ToggleEditModeAction = () => {
|
|||||||
namedWrapperColumnCount !== null
|
namedWrapperColumnCount !== null
|
||||||
? t(`common:breakPoints.${namedWrapperColumnCount}`)
|
? t(`common:breakPoints.${namedWrapperColumnCount}`)
|
||||||
: t('common:loading');
|
: t('common:loading');
|
||||||
|
const beforeUnloadEventText = t('unloadEvent');
|
||||||
const smallerThanSm = useScreenSmallerThan('sm');
|
const smallerThanSm = useScreenSmallerThan('sm');
|
||||||
const { config } = useConfigContext();
|
const { config } = useConfigContext();
|
||||||
const { classes } = useCardStyles(true);
|
const { classes } = useCardStyles(true);
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ import { openModal } from '@mantine/modals';
|
|||||||
import { showNotification } from '@mantine/notifications';
|
import { showNotification } from '@mantine/notifications';
|
||||||
import { IconEdit, IconEditOff } from '@tabler/icons-react';
|
import { IconEdit, IconEditOff } from '@tabler/icons-react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { Trans, useTranslation } from 'next-i18next';
|
||||||
|
|
||||||
import { useEditModeInformationStore } from '../../../../hooks/useEditModeInformation';
|
import { useEditModeInformationStore } from '../../../../hooks/useEditModeInformation';
|
||||||
|
|
||||||
function ModalContent() {
|
function ModalContent() {
|
||||||
|
const { t } = useTranslation('settings/general/edit-mode-toggle');
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
triedPassword: '',
|
triedPassword: '',
|
||||||
@@ -20,8 +22,8 @@ function ModalContent() {
|
|||||||
.post('/api/configs/tryPassword', { tried: values.triedPassword, type: 'edit' })
|
.post('/api/configs/tryPassword', { tried: values.triedPassword, type: 'edit' })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: 'Success',
|
title: t('notification.success.title'),
|
||||||
message: 'Successfully toggled edit mode, reloading the page...',
|
message: t('notification.success.message'),
|
||||||
color: 'green',
|
color: 'green',
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -30,8 +32,8 @@ function ModalContent() {
|
|||||||
})
|
})
|
||||||
.catch((_) => {
|
.catch((_) => {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: 'Error',
|
title: t('notification.error.title'),
|
||||||
message: 'Failed to toggle edit mode, please try again.',
|
message: t('notification.error.message'),
|
||||||
color: 'red',
|
color: 'red',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -39,18 +41,19 @@ function ModalContent() {
|
|||||||
>
|
>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Text size="sm">
|
<Text size="sm">
|
||||||
In order to toggle edit mode, you need to enter the password you entered in the
|
<Trans
|
||||||
environment variable named <Code>EDIT_MODE_PASSWORD</Code> . If it is not set, you are not
|
i18nKey={'settings/general/edit-mode-toggle:form.message'}
|
||||||
able to toggle edit mode on and off.
|
components={{ Code: <Code children/> }}
|
||||||
|
/>
|
||||||
</Text>
|
</Text>
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
id="triedPassword"
|
id="triedPassword"
|
||||||
label="Edit password"
|
label={t('form.label')}
|
||||||
autoFocus
|
autoFocus
|
||||||
required
|
required
|
||||||
{...form.getInputProps('triedPassword')}
|
{...form.getInputProps('triedPassword')}
|
||||||
/>
|
/>
|
||||||
<Button type="submit">Submit</Button>
|
<Button type="submit">{t('form.submit')}</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
@@ -59,6 +62,7 @@ function ModalContent() {
|
|||||||
export function EditModeToggle() {
|
export function EditModeToggle() {
|
||||||
const { editModeEnabled } = useEditModeInformationStore();
|
const { editModeEnabled } = useEditModeInformationStore();
|
||||||
const Icon = editModeEnabled ? IconEdit : IconEditOff;
|
const Icon = editModeEnabled ? IconEdit : IconEditOff;
|
||||||
|
const { t } = useTranslation('settings/general/edit-mode-toggle');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
@@ -66,14 +70,14 @@ export function EditModeToggle() {
|
|||||||
icon={<Icon strokeWidth={1.2} size={18} />}
|
icon={<Icon strokeWidth={1.2} size={18} />}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
openModal({
|
openModal({
|
||||||
title: 'Toggle edit mode',
|
title: t('menu.toggle'),
|
||||||
centered: true,
|
centered: true,
|
||||||
size: 'lg',
|
size: 'lg',
|
||||||
children: <ModalContent />,
|
children: <ModalContent />,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{editModeEnabled ? 'Enable edit mode' : 'Disable edit mode'}
|
{editModeEnabled ? t('menu.enable') : t('menu.disable')}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export const dashboardNamespaces = [
|
|||||||
'settings/common',
|
'settings/common',
|
||||||
'settings/general/theme-selector',
|
'settings/general/theme-selector',
|
||||||
'settings/general/config-changer',
|
'settings/general/config-changer',
|
||||||
|
'settings/general/edit-mode-toggle',
|
||||||
'settings/general/internationalization',
|
'settings/general/internationalization',
|
||||||
'settings/general/search-engine',
|
'settings/general/search-engine',
|
||||||
'settings/general/widget-positions',
|
'settings/general/widget-positions',
|
||||||
|
|||||||
Reference in New Issue
Block a user