mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 18:46:17 +00:00
explorer: implement duplicate file feature
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user