explorer: implement duplicate file feature

This commit is contained in:
David Lechner
2022-04-08 18:11:09 -05:00
parent 30741b13ef
commit e0a6926d01
25 changed files with 693 additions and 37 deletions
-13
View File
@@ -24,19 +24,6 @@ describe('showDocs setting switch', () => {
userEvent.click(showDocs);
expect(showDocs).not.toBeChecked();
});
it('should have global keyboard shortcut', async () => {
const [settings] = testRender(
<SettingsDrawer isOpen={true} onClose={() => undefined} />,
);
const showDocs = settings.getByLabelText('Documentation');
expect(showDocs).toBeChecked();
userEvent.keyboard('{ctrl}d{/ctrl}');
await waitFor(() => expect(showDocs).not.toBeChecked());
});
});
describe('darkMode setting switch', () => {
+3 -22
View File
@@ -15,11 +15,10 @@ import {
Intent,
Label,
Switch,
useHotkeys,
} from '@blueprintjs/core';
import { Tooltip2 } from '@blueprintjs/popover2';
import { useI18n } from '@shopify/react-i18n';
import React, { useCallback, useMemo, useState } from 'react';
import React, { useCallback, useState } from 'react';
import { useDispatch } from 'react-redux';
import { useTernaryDarkMode } from 'usehooks-ts';
import AboutDialog from '../about/AboutDialog';
@@ -52,11 +51,8 @@ const SettingsDrawer: React.VoidFunctionComponent<SettingsProps> = ({
isOpen,
onClose,
}) => {
const {
isSettingShowDocsEnabled,
setIsSettingShowDocsEnabled,
toggleIsSettingShowDocsEnabled,
} = useSettingIsShowDocsEnabled();
const { isSettingShowDocsEnabled, setIsSettingShowDocsEnabled } =
useSettingIsShowDocsEnabled();
const [isAboutDialogOpen, setIsAboutDialogOpen] = useState(false);
const { isDarkMode, setTernaryDarkMode } = useTernaryDarkMode();
@@ -79,21 +75,6 @@ const SettingsDrawer: React.VoidFunctionComponent<SettingsProps> = ({
// istanbul ignore next: babel-loader rewrites this line
const [i18n] = useI18n();
const hotkeys = useMemo(
() => [
{
combo: 'mod+d',
label: i18n.translate(I18nId.AppearanceDocumentationTooltip),
global: true,
preventDefault: true,
onKeyDown: toggleIsSettingShowDocsEnabled,
},
],
[i18n, toggleIsSettingShowDocsEnabled],
);
useHotkeys(hotkeys);
// HACK: set additional attributes that are not supported via Drawer props
const handleDrawerOpening = useCallback<(node: HTMLElement) => void>((n) => {
n.setAttribute('role', 'dialog');