Update copy for import/export

This commit is contained in:
Lim Chee Aun 2023-08-15 22:40:58 +08:00
parent b922c2f096
commit 932e66f330

View file

@ -725,8 +725,7 @@ function ImportExport({ shortcuts, onClose }) {
)} )}
<header> <header>
<h2> <h2>
Import/Export{' '} Import/Export <small class="ib insignificant">Shortcuts</small>
<small class="ib insignificant">Shortcuts settings</small>
</h2> </h2>
</header> </header>
<main tabindex="-1"> <main tabindex="-1">
@ -739,7 +738,7 @@ function ImportExport({ shortcuts, onClose }) {
<input <input
type="text" type="text"
name="import" name="import"
placeholder="Paste settings here" placeholder="Paste shortcuts here"
class="block" class="block"
onInput={(e) => { onInput={(e) => {
setImportShortcutStr(e.target.value); setImportShortcutStr(e.target.value);
@ -796,7 +795,7 @@ function ImportExport({ shortcuts, onClose }) {
))} ))}
</ol> </ol>
<p> <p>
<small>* Exists in current settings</small> <small>* Exists in current shortcuts</small>
<br /> <br />
<small> <small>
List may not work if it's from a different account. List may not work if it's from a different account.
@ -813,10 +812,10 @@ function ImportExport({ shortcuts, onClose }) {
{hasCurrentSettings && ( {hasCurrentSettings && (
<> <>
<MenuConfirm <MenuConfirm
confirmLabel="Append these shortcuts to current settings?" confirmLabel="Append to current shortcuts?"
menuFooter={ menuFooter={
<div class="footer"> <div class="footer">
Only shortcuts that dont exist in current settings will Only shortcuts that dont exist in current shortcuts will
be appended. be appended.
</div> </div>
} }
@ -851,8 +850,8 @@ function ImportExport({ shortcuts, onClose }) {
states.shortcuts = newShortcuts; states.shortcuts = newShortcuts;
showToast( showToast(
exceededLimit exceededLimit
? `Shortcuts settings imported. Exceeded max ${SHORTCUTS_LIMIT}, so the rest are not imported.` ? `Shortcuts imported. Exceeded max ${SHORTCUTS_LIMIT}, so the rest are not imported.`
: 'Shortcuts settings imported', : 'Shortcuts imported',
); );
onClose?.(); onClose?.();
}} }}
@ -870,13 +869,13 @@ function ImportExport({ shortcuts, onClose }) {
<MenuConfirm <MenuConfirm
confirmLabel={ confirmLabel={
hasCurrentSettings hasCurrentSettings
? 'Override current settings?' ? 'Override current shortcuts?'
: 'Import settings?' : 'Import shortcuts?'
} }
menuItemClassName={hasCurrentSettings ? 'danger' : undefined} menuItemClassName={hasCurrentSettings ? 'danger' : undefined}
onClick={() => { onClick={() => {
states.shortcuts = parsedImportShortcutStr; states.shortcuts = parsedImportShortcutStr;
showToast('Shortcuts settings imported'); showToast('Shortcuts imported');
onClose?.(); onClose?.();
}} }}
> >
@ -906,10 +905,10 @@ function ImportExport({ shortcuts, onClose }) {
// Copy url to clipboard // Copy url to clipboard
try { try {
navigator.clipboard.writeText(e.target.value); navigator.clipboard.writeText(e.target.value);
showToast('Shortcuts settings copied'); showToast('Shortcuts copied');
} catch (e) { } catch (e) {
console.error(e); console.error(e);
showToast('Unable to copy shortcuts settings'); showToast('Unable to copy shortcuts');
} }
}} }}
/> />
@ -959,7 +958,7 @@ function ImportExport({ shortcuts, onClose }) {
</p> </p>
<details> <details>
<summary class="insignificant"> <summary class="insignificant">
<small>Raw Shortcuts settings JSON</small> <small>Raw Shortcuts JSON</small>
</summary> </summary>
<textarea style={{ width: '100%' }} rows={10} readOnly> <textarea style={{ width: '100%' }} rows={10} readOnly>
{JSON.stringify(shortcuts.filter(Boolean), null, 2)} {JSON.stringify(shortcuts.filter(Boolean), null, 2)}