@nordicsemiconductor/pc-nrfconnect-shared 60.0.0-pre1 → 60.0.0-pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/bootstrap.css +8951 -0
  2. package/dist/index.css +1451 -0
  3. package/dist/index.js +122119 -0
  4. package/{src/Logo/nordic-logo-blue-icon-only.png → dist/nordic-logo-blue-icon-only-H7BABN6D.png} +0 -0
  5. package/{src/Logo/nordic-logo-gray-icon-only.png → dist/nordic-logo-gray-icon-only-GATOTR3L.png} +0 -0
  6. package/package.json +12 -3
  7. package/typings/generated/src/Device/deviceInfo/deviceInfo.d.ts +1 -2
  8. package/.github/ISSUE_TEMPLATE/custom.md +0 -10
  9. package/.husky/pre-push +0 -3
  10. package/.renovaterc.json +0 -10
  11. package/Changelog.md +0 -2973
  12. package/azure-pipelines.yml +0 -34
  13. package/config/eslintrc.js +0 -190
  14. package/config/jest.config.js +0 -41
  15. package/config/prettier.config.js +0 -13
  16. package/config/tsconfig.json +0 -15
  17. package/fw/bootloader/graviton_bootloader_v1.0.1-[nRF5_SDK_15.0.1-1.alpha_f76d012].zip +0 -0
  18. package/jest.config.js +0 -7
  19. package/main/index.ts +0 -32
  20. package/mocks/deviceLibMock.ts +0 -21
  21. package/mocks/electronMock.ts +0 -15
  22. package/mocks/electronStoreMock.ts +0 -19
  23. package/mocks/emptyMock.ts +0 -7
  24. package/mocks/fileMock.ts +0 -13
  25. package/mocks/gaMock.ts +0 -9
  26. package/mocks/mockTests.test.ts +0 -15
  27. package/mocks/packageJsonMock.ts +0 -10
  28. package/mocks/remoteMock.ts +0 -17
  29. package/scripts/esbuild-bootstrap.js +0 -15
  30. package/scripts/esbuild-renderer.js +0 -131
  31. package/scripts/installHusky.ts +0 -17
  32. package/scripts/prepare-shared-release.ts +0 -122
  33. package/scripts/release-shared.test.ts +0 -132
  34. package/scripts/release-shared.ts +0 -207
  35. package/src/About/About.tsx +0 -25
  36. package/src/About/AboutButton.tsx +0 -28
  37. package/src/About/ApplicationCard.tsx +0 -83
  38. package/src/About/DeviceCard.tsx +0 -74
  39. package/src/About/DocumentationCard.tsx +0 -18
  40. package/src/About/DocumentationSection.tsx +0 -24
  41. package/src/About/Section.tsx +0 -21
  42. package/src/About/ShortcutButton.tsx +0 -41
  43. package/src/About/SupportCard.tsx +0 -97
  44. package/src/About/about.scss +0 -40
  45. package/src/About/documentationSlice.ts +0 -41
  46. package/src/About/section.scss +0 -15
  47. package/src/About/shortcutSlice.ts +0 -52
  48. package/src/Alert/Alert.module.scss +0 -29
  49. package/src/Alert/Alert.tsx +0 -37
  50. package/src/App/App.test.tsx +0 -47
  51. package/src/App/App.tsx +0 -227
  52. package/src/App/ConnectedToStore.tsx +0 -19
  53. package/src/App/VisibilityBar.tsx +0 -103
  54. package/src/App/app.scss +0 -83
  55. package/src/App/appLayout.ts +0 -95
  56. package/src/App/shared.scss +0 -49
  57. package/src/App/visibility-bar.scss +0 -55
  58. package/src/Button/Button.tsx +0 -66
  59. package/src/Button/button.module.scss +0 -154
  60. package/src/Card/Card.tsx +0 -26
  61. package/src/Card/card.module.scss +0 -28
  62. package/src/Device/BrokenDeviceDialog/BrokenDeviceDialog.tsx +0 -58
  63. package/src/Device/BrokenDeviceDialog/broken-device-dialog.scss +0 -18
  64. package/src/Device/BrokenDeviceDialog/brokenDeviceDialogSlice.tsx +0 -48
  65. package/src/Device/DeviceSelector/BasicDeviceInfo.tsx +0 -115
  66. package/src/Device/DeviceSelector/DeviceIcon.tsx +0 -27
  67. package/src/Device/DeviceSelector/DeviceList/AnimatedList.tsx +0 -62
  68. package/src/Device/DeviceSelector/DeviceList/BrokenDevice.tsx +0 -34
  69. package/src/Device/DeviceSelector/DeviceList/Device.tsx +0 -84
  70. package/src/Device/DeviceSelector/DeviceList/DeviceList.tsx +0 -113
  71. package/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.tsx +0 -28
  72. package/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.tsx +0 -65
  73. package/src/Device/DeviceSelector/DeviceList/RenameDevice.tsx +0 -22
  74. package/src/Device/DeviceSelector/DeviceList/broken-device.scss +0 -32
  75. package/src/Device/DeviceSelector/DeviceList/device-list.scss +0 -64
  76. package/src/Device/DeviceSelector/DeviceList/device.scss +0 -28
  77. package/src/Device/DeviceSelector/DeviceList/edit-device-buttons.scss +0 -31
  78. package/src/Device/DeviceSelector/DeviceList/more-device-info.scss +0 -33
  79. package/src/Device/DeviceSelector/DeviceList/rename-device.scss +0 -13
  80. package/src/Device/DeviceSelector/DeviceSelector.test.tsx +0 -342
  81. package/src/Device/DeviceSelector/DeviceSelector.tsx +0 -173
  82. package/src/Device/DeviceSelector/Favorite.tsx +0 -49
  83. package/src/Device/DeviceSelector/SelectDevice.tsx +0 -36
  84. package/src/Device/DeviceSelector/SelectedDevice.tsx +0 -65
  85. package/src/Device/DeviceSelector/arrow-down.svg +0 -1
  86. package/src/Device/DeviceSelector/basic-device-info.scss +0 -62
  87. package/src/Device/DeviceSelector/device-icon.scss +0 -27
  88. package/src/Device/DeviceSelector/favorite.scss +0 -17
  89. package/src/Device/DeviceSelector/select-device.scss +0 -38
  90. package/src/Device/DeviceSelector/selected-device.scss +0 -57
  91. package/src/Device/DeviceSetup/DeviceSetupView.tsx +0 -102
  92. package/src/Device/deviceAutoSelectSlice.ts +0 -144
  93. package/src/Device/deviceInfo/deviceInfo.ts +0 -254
  94. package/src/Device/deviceInfo/nRF51-Series-logo.svg +0 -1
  95. package/src/Device/deviceInfo/nRF52-Series-logo.svg +0 -1
  96. package/src/Device/deviceInfo/nRF53-Series-logo.svg +0 -1
  97. package/src/Device/deviceInfo/nRF70-Series_no-background_RGB.svg +0 -36
  98. package/src/Device/deviceInfo/nRF91-Series-logo.svg +0 -1
  99. package/src/Device/deviceInfo/ppk-logo.svg +0 -1
  100. package/src/Device/deviceInfo/unknown-logo.svg +0 -30
  101. package/src/Device/deviceInfo/unknown-nordic-logo.svg +0 -25
  102. package/src/Device/deviceLibWrapper.test.ts +0 -97
  103. package/src/Device/deviceLibWrapper.ts +0 -133
  104. package/src/Device/deviceLister.test.ts +0 -89
  105. package/src/Device/deviceLister.ts +0 -396
  106. package/src/Device/deviceSetup.ts +0 -264
  107. package/src/Device/deviceSetupSlice.ts +0 -94
  108. package/src/Device/deviceSlice.ts +0 -248
  109. package/src/Device/dfu-cc.ts +0 -162
  110. package/src/Device/initPacket.ts +0 -402
  111. package/src/Device/jprogOperations.ts +0 -206
  112. package/src/Device/sdfuOperations.ts +0 -601
  113. package/src/Dialog/Dialog.test.tsx +0 -134
  114. package/src/Dialog/Dialog.tsx +0 -236
  115. package/src/Dialog/dialog.scss +0 -60
  116. package/src/Dropdown/Dropdown.module.scss +0 -83
  117. package/src/Dropdown/Dropdown.test.tsx +0 -62
  118. package/src/Dropdown/Dropdown.tsx +0 -106
  119. package/src/ErrorBoundary/ErrorBoundary.test.tsx +0 -105
  120. package/src/ErrorBoundary/ErrorBoundary.tsx +0 -186
  121. package/src/ErrorBoundary/bug.svg +0 -1
  122. package/src/ErrorBoundary/error-boundary.scss +0 -102
  123. package/src/ErrorDialog/ErrorDialog.test.tsx +0 -70
  124. package/src/ErrorDialog/ErrorDialog.tsx +0 -94
  125. package/src/ErrorDialog/error.scss +0 -14
  126. package/src/ErrorDialog/errorDialogSlice.test.ts +0 -64
  127. package/src/ErrorDialog/errorDialogSlice.ts +0 -80
  128. package/src/FactoryReset/FactoryResetButton.test.tsx +0 -46
  129. package/src/FactoryReset/FactoryResetButton.tsx +0 -81
  130. package/src/InlineInput/InlineInput.tsx +0 -170
  131. package/src/InlineInput/NumberInlineInput.tsx +0 -107
  132. package/src/InlineInput/inline-input.scss +0 -38
  133. package/src/InlineInput/number-inline-input.scss +0 -15
  134. package/src/Log/LogEntry.tsx +0 -62
  135. package/src/Log/LogViewer.tsx +0 -54
  136. package/src/Log/log-entry.scss +0 -30
  137. package/src/Log/log-viewer.scss +0 -24
  138. package/src/Log/logSlice.ts +0 -73
  139. package/src/Log/syncLogToStore.ts +0 -36
  140. package/src/Logo/Logo.tsx +0 -48
  141. package/src/Logo/logo.scss +0 -11
  142. package/src/Main/Main.tsx +0 -13
  143. package/src/Main/main.scss +0 -13
  144. package/src/MasonryLayout/MasonryLayout.tsx +0 -234
  145. package/src/MasonryLayout/masonryLayout.module.scss +0 -46
  146. package/src/NavBar/NavBar.tsx +0 -22
  147. package/src/NavBar/NavMenu.test.tsx +0 -41
  148. package/src/NavBar/NavMenu.tsx +0 -53
  149. package/src/NavBar/NavMenuItem.tsx +0 -41
  150. package/src/NavBar/nav-bar.scss +0 -26
  151. package/src/NavBar/nav-menu-item.scss +0 -34
  152. package/src/OpenApp/openApp.ts +0 -18
  153. package/src/Panes/FeedbackPane.tsx +0 -149
  154. package/src/PseudoButton/PseudoButton.tsx +0 -56
  155. package/src/PseudoButton/pseudo-button.scss +0 -11
  156. package/src/SerialPort/ConflictingSettingsDialog.tsx +0 -242
  157. package/src/SerialPort/SerialPort.test.ts +0 -54
  158. package/src/SerialPort/SerialPort.ts +0 -202
  159. package/src/Shortcuts/Shortcut-item.scss +0 -33
  160. package/src/Shortcuts/Shortcut-modal.scss +0 -20
  161. package/src/Shortcuts/ShortcutItem.tsx +0 -48
  162. package/src/Shortcuts/ShortcutModal.tsx +0 -67
  163. package/src/SidePanel/Group.tsx +0 -106
  164. package/src/SidePanel/SidePanel.tsx +0 -19
  165. package/src/SidePanel/group.scss +0 -42
  166. package/src/SidePanel/sidepanel.scss +0 -20
  167. package/src/Slider/Bar.tsx +0 -24
  168. package/src/Slider/Factor.test.ts +0 -48
  169. package/src/Slider/Handle.tsx +0 -121
  170. package/src/Slider/Slider.test.tsx +0 -25
  171. package/src/Slider/Slider.tsx +0 -91
  172. package/src/Slider/Ticks.tsx +0 -54
  173. package/src/Slider/__snapshots__/Slider.test.tsx.snap +0 -50
  174. package/src/Slider/bar.scss +0 -24
  175. package/src/Slider/factor.ts +0 -24
  176. package/src/Slider/handle.scss +0 -32
  177. package/src/Slider/percentage.ts +0 -67
  178. package/src/Slider/range.ts +0 -92
  179. package/src/Slider/slider.scss +0 -14
  180. package/src/Slider/ticks.scss +0 -28
  181. package/src/Slider/variables.scss +0 -16
  182. package/src/StartStopButton/StartStopButton.tsx +0 -60
  183. package/src/StartStopButton/play-circle.svg +0 -1
  184. package/src/StartStopButton/start-stop-button.scss +0 -47
  185. package/src/StartStopButton/stop-circle.svg +0 -1
  186. package/src/StateSelector/StateSelector.tsx +0 -64
  187. package/src/StateSelector/state-selector.scss +0 -38
  188. package/src/Stepper/Stepper.tsx +0 -139
  189. package/src/Stepper/stepper.scss +0 -127
  190. package/src/Toggle/Toggle.tsx +0 -120
  191. package/src/Toggle/toggle.scss +0 -109
  192. package/src/bootstrap.scss +0 -14
  193. package/src/index.ts +0 -146
  194. package/src/logging/appTransport.test.ts +0 -78
  195. package/src/logging/appTransport.ts +0 -41
  196. package/src/logging/describeError.test.ts +0 -38
  197. package/src/logging/describeError.ts +0 -56
  198. package/src/logging/index.ts +0 -103
  199. package/src/logging/logBuffer.test.ts +0 -41
  200. package/src/logging/logBuffer.ts +0 -24
  201. package/src/logging/sendInitialLogMessages.ts +0 -64
  202. package/src/store.ts +0 -60
  203. package/src/svg.d.ts +0 -15
  204. package/src/utils/AppTypes.ts +0 -60
  205. package/src/utils/appDirs.ts +0 -78
  206. package/src/utils/bleChannels.ts +0 -16
  207. package/src/utils/classNames.test.ts +0 -29
  208. package/src/utils/classNames.ts +0 -25
  209. package/src/utils/colors.scss +0 -46
  210. package/src/utils/colors.ts +0 -38
  211. package/src/utils/describeVersion.ts +0 -21
  212. package/src/utils/environment.ts +0 -6
  213. package/src/utils/logLibVersions.ts +0 -103
  214. package/src/utils/open.ts +0 -46
  215. package/src/utils/packageJson.ts +0 -60
  216. package/src/utils/persistentStore.ts +0 -144
  217. package/src/utils/systemReport.ts +0 -160
  218. package/src/utils/truncateMiddle.test.ts +0 -21
  219. package/src/utils/truncateMiddle.ts +0 -20
  220. package/src/utils/usageData.ts +0 -189
  221. package/src/utils/useHotKey.ts +0 -62
  222. package/src/utils/useStopwatch.test.tsx +0 -311
  223. package/src/utils/useStopwatch.ts +0 -140
  224. package/src/variables.scss +0 -820
  225. package/styles.scss +0 -88
  226. package/test/dispatchTo.ts +0 -23
  227. package/test/index.ts +0 -7
  228. package/test/jestResolver.js +0 -28
  229. package/test/setupTests.ts +0 -27
  230. package/test/testUtil.ts +0 -20
  231. package/test/testrenderer.tsx +0 -39
  232. /package/{src/Logo/nordic-logo-white-icon-only.png → dist/nordic-logo-white-icon-only-XIZBW537.png} +0 -0
@@ -1,24 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React, { ReactNode } from 'react';
8
-
9
- import AboutButton from './AboutButton';
10
- import Section from './Section';
11
-
12
- interface Props {
13
- title?: string;
14
- link?: string;
15
- linkLabel?: string;
16
- children?: ReactNode;
17
- }
18
-
19
- export default ({ title, link, linkLabel, children }: Props) => (
20
- <Section title={title}>
21
- <p>{children}</p>
22
- {link && <AboutButton url={link} label={linkLabel as string} />}
23
- </Section>
24
- );
@@ -1,21 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React, { ReactNode } from 'react';
8
-
9
- import './section.scss';
10
-
11
- interface Props {
12
- title?: string;
13
- children?: ReactNode;
14
- }
15
-
16
- export default ({ children, title }: Props) => (
17
- <div className="about-section">
18
- {title != null && <h3 className="about-section-title">{title}</h3>}
19
- {children}
20
- </div>
21
- );
@@ -1,41 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React, { FC, useState } from 'react';
8
-
9
- import Button from '../Button/Button';
10
- import ShortcutModal from '../Shortcuts/ShortcutModal';
11
- import useHotKey from '../utils/useHotKey';
12
-
13
- interface Props {
14
- label: string;
15
- }
16
-
17
- const ShortcutButton: FC<Props> = ({ label }) => {
18
- const [isModalVisible, setIsModalVisible] = useState(false);
19
- const toggleModalVisible = () => setIsModalVisible(!isModalVisible);
20
-
21
- useHotKey({
22
- hotKey: '?',
23
- title: 'Open shortcut overview',
24
- isGlobal: true,
25
- action: () => toggleModalVisible(),
26
- });
27
-
28
- return (
29
- <>
30
- <Button variant="secondary" onClick={toggleModalVisible}>
31
- {label}
32
- </Button>
33
- <ShortcutModal
34
- isVisible={isModalVisible}
35
- onCancel={toggleModalVisible}
36
- />
37
- </>
38
- );
39
- };
40
-
41
- export default ShortcutButton;
@@ -1,97 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React from 'react';
8
- import { useDispatch, useSelector } from 'react-redux';
9
- import { getCurrentWindow } from '@electron/remote';
10
-
11
- import Button from '../Button/Button';
12
- import Card from '../Card/Card';
13
- import { setVerboseDeviceLibLogging } from '../Device/deviceLibWrapper';
14
- import {
15
- deviceInfo,
16
- getDevices,
17
- selectedSerialNumber,
18
- } from '../Device/deviceSlice';
19
- import {
20
- isLoggingVerboseSelector,
21
- toggleIsLoggingVerbose,
22
- } from '../Log/logSlice';
23
- import { Toggle } from '../Toggle/Toggle';
24
- import { persistIsLoggingVerbose } from '../utils/persistentStore';
25
- import systemReport from '../utils/systemReport';
26
- import AboutButton from './AboutButton';
27
- import Section from './Section';
28
-
29
- export default () => {
30
- const dispatch = useDispatch();
31
- const devices = useSelector(getDevices);
32
- const currentSerialNumber = useSelector(selectedSerialNumber);
33
- const verboseLogging = useSelector(isLoggingVerboseSelector);
34
- const currentDevice = useSelector(deviceInfo);
35
-
36
- return (
37
- <Card title="Support">
38
- <Section title="DevZone">
39
- <p>
40
- All support requests must be sent through our developer
41
- portal DevZone.
42
- </p>
43
- <AboutButton
44
- url="https://devzone.nordicsemi.com"
45
- label="Go to DevZone"
46
- />
47
- </Section>
48
- <Section title="System report">
49
- <p>
50
- In order to get the best support it is helpful for our
51
- employees to know details about your operating system and
52
- related software. Create a system report and add to your
53
- support request.
54
- </p>
55
- <AboutButton
56
- onClick={() =>
57
- systemReport(
58
- [...devices.values()],
59
- currentSerialNumber as string,
60
- currentDevice
61
- )
62
- }
63
- label="Create system report"
64
- />
65
- </Section>
66
- <Section title="Verbose Logging">
67
- <p>
68
- Aid our support team with additional log information. Enable
69
- this only when necessary as the log will grow quickly.
70
- </p>
71
- <Toggle
72
- id="enableVerboseLoggin"
73
- label="VERBOSE LOGGING"
74
- onToggle={() => {
75
- setVerboseDeviceLibLogging(!verboseLogging);
76
- dispatch(toggleIsLoggingVerbose());
77
- }}
78
- isToggled={verboseLogging}
79
- variant="primary"
80
- />
81
- <Section>
82
- <Button
83
- variant="secondary"
84
- onClick={() => {
85
- persistIsLoggingVerbose(true);
86
- getCurrentWindow().reload();
87
- }}
88
- title="Restart application with verbose logging turned on to get log messages from initial enumeration"
89
- disabled={!verboseLogging}
90
- >
91
- Restart with verbose logging
92
- </Button>
93
- </Section>
94
- </Section>
95
- </Card>
96
- );
97
- };
@@ -1,40 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- @import '../variables';
8
-
9
- .about {
10
- display: flex;
11
- align-items: center;
12
- height: 100%;
13
-
14
- .about-inner {
15
- display: flex;
16
- flex-direction: row;
17
- justify-content: center;
18
- flex-wrap: wrap;
19
- width: 100%;
20
- margin: auto;
21
- padding-bottom: 16px;
22
- padding-right: 16px;
23
- .card {
24
- min-width: 230px;
25
- max-width: 20em;
26
- margin-left: 8px;
27
- margin-bottom: 8px;
28
- }
29
- .card-body {
30
- margin-bottom: 1em;
31
- }
32
- .factory-reset-button {
33
- height: 24px;
34
- padding: 0;
35
- }
36
- }
37
- button {
38
- width: 100%;
39
- }
40
- }
@@ -1,41 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React from 'react';
8
- import { createSlice } from '@reduxjs/toolkit';
9
-
10
- interface DocumentationSectionProps {
11
- title?: string;
12
- linkLabel?: string;
13
- link?: string;
14
- }
15
-
16
- export interface DocumentationState {
17
- sections: React.Component<DocumentationSectionProps>[];
18
- }
19
-
20
- const initialState: DocumentationState = {
21
- sections: [],
22
- };
23
-
24
- const slice = createSlice({
25
- name: 'documentation',
26
- initialState,
27
- reducers: {
28
- setDocumentationSections: (state, action) => {
29
- state.sections = action.payload;
30
- },
31
- },
32
- });
33
-
34
- export const {
35
- reducer,
36
- actions: { setDocumentationSections },
37
- } = slice;
38
-
39
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
40
- export const documentationSections = ({ documentation }: any) =>
41
- documentation.sections;
@@ -1,15 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- .about {
8
- .about-section:first-child { margin-top: 0 }
9
- .about-section { margin-top: 1em }
10
-
11
- .about-section-title {
12
- font-size: inherit;
13
- margin-bottom: 2px;
14
- }
15
- }
@@ -1,52 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import { createSlice, PayloadAction } from '@reduxjs/toolkit';
8
- import { enableMapSet } from 'immer';
9
-
10
- import type { RootState } from '../store';
11
-
12
- enableMapSet();
13
-
14
- export interface Shortcut {
15
- hotKey: string[] | string;
16
- title: string;
17
- isGlobal: boolean;
18
- action: () => void;
19
- }
20
-
21
- export type ShortcutState = Set<Shortcut>;
22
-
23
- const initialState: ShortcutState = new Set();
24
-
25
- const slice = createSlice({
26
- name: 'shortcuts',
27
- initialState,
28
- reducers: {
29
- addShortcut: (state, action: PayloadAction<Shortcut>) => {
30
- state.add(action.payload);
31
- },
32
- removeShortcut: (state, action: PayloadAction<Shortcut>) => {
33
- state.delete(action.payload);
34
- },
35
- },
36
- });
37
-
38
- export const {
39
- reducer,
40
- actions: { addShortcut, removeShortcut },
41
- } = slice;
42
-
43
- const sortedShortcuts = (shortcuts: Iterable<Shortcut>, global: boolean) =>
44
- Array.from(shortcuts)
45
- .filter(shortcut => shortcut.isGlobal === global)
46
- .sort((s1, s2) => s1.title.localeCompare(s2.title));
47
-
48
- export const globalShortcuts = (state: RootState) =>
49
- sortedShortcuts(state.shortcuts, true);
50
-
51
- export const localShortcuts = (state: RootState) =>
52
- sortedShortcuts(state.shortcuts, false);
@@ -1,29 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- @import '../variables.scss';
8
-
9
- .container {
10
- border-radius: 0;
11
- color: white;
12
- border: 0;
13
-
14
- &.info {
15
- background-color: $nordic-blue;
16
- }
17
-
18
- &.warning {
19
- background-color: $brand-warning;
20
- }
21
-
22
- &.success {
23
- background-color: $brand-success;
24
- }
25
-
26
- &.danger {
27
- background-color: $brand-danger;
28
- }
29
- }
@@ -1,37 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React from 'react';
8
- import BootstrapAlert from 'react-bootstrap/Alert';
9
-
10
- import styles from './Alert.module.scss';
11
-
12
- type Variant = 'info' | 'warning' | 'success' | 'danger';
13
- export interface AlertProps {
14
- variant: Variant;
15
- label?: React.ReactNode;
16
- dismissable?: boolean;
17
- onClose?: () => void;
18
- }
19
-
20
- export const Alert: React.FC<AlertProps> = ({
21
- children,
22
- label,
23
- variant,
24
- dismissable = false,
25
- onClose,
26
- }) => (
27
- <BootstrapAlert
28
- variant={variant}
29
- dismissible={dismissable}
30
- onClose={onClose}
31
- className={`${styles.container} ${styles[variant]}`}
32
- >
33
- {label && <strong>{label}</strong>}
34
- {/* eslint-disable-next-line react/jsx-no-useless-fragment -- I think we need a fragment because children could also be an array of components */}
35
- <>{children}</>
36
- </BootstrapAlert>
37
- );
@@ -1,47 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React from 'react';
8
- import { screen } from '@testing-library/react';
9
-
10
- import render from '../../test/testrenderer';
11
- import App, { Pane } from './App';
12
-
13
- jest.mock('../Log/LogViewer', () => ({
14
- __esModule: true,
15
- default: () => null,
16
- }));
17
-
18
- const renderApp = (panes: Pane[]) => {
19
- const dummyReducer = (s = null) => s;
20
- const dummyNode = <div />;
21
-
22
- return render(
23
- <App
24
- appReducer={dummyReducer}
25
- deviceSelect={dummyNode}
26
- sidePanel={dummyNode}
27
- panes={panes}
28
- />
29
- );
30
- };
31
-
32
- const aPane = {
33
- name: 'an menu item',
34
- Main: () => <div>A pane</div>,
35
- };
36
- const anotherPane = {
37
- name: 'another menu item',
38
- Main: () => <div>Another pane</div>,
39
- };
40
-
41
- describe('App', () => {
42
- it('automatically gets an About pane attached', () => {
43
- renderApp([aPane, anotherPane]);
44
-
45
- expect(screen.getByText('About')).toBeInTheDocument();
46
- });
47
- });
package/src/App/App.tsx DELETED
@@ -1,227 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import 'focus-visible';
8
-
9
- import React, { FC, ReactNode, useEffect, useMemo } from 'react';
10
- import Carousel from 'react-bootstrap/Carousel';
11
- import { useDispatch, useSelector } from 'react-redux';
12
- import { ipcRenderer } from 'electron';
13
- import { Reducer } from 'redux';
14
-
15
- import About from '../About/About';
16
- import { setDocumentationSections } from '../About/documentationSlice';
17
- import BrokenDeviceDialog from '../Device/BrokenDeviceDialog/BrokenDeviceDialog';
18
- import { setAutoReselect } from '../Device/deviceAutoSelectSlice';
19
- import {
20
- getDevices,
21
- selectedDevice as selectedDeviceSelector,
22
- selectedSerialNumber as selectedSerialNumberSelector,
23
- } from '../Device/deviceSlice';
24
- import ErrorBoundary from '../ErrorBoundary/ErrorBoundary';
25
- import ErrorDialog from '../ErrorDialog/ErrorDialog';
26
- import LogViewer from '../Log/LogViewer';
27
- import NavBar from '../NavBar/NavBar';
28
- import classNames from '../utils/classNames';
29
- import packageJson from '../utils/packageJson';
30
- import { getPersistedCurrentPane } from '../utils/persistentStore';
31
- import { init as usageDataInit } from '../utils/usageData';
32
- import useHotKey from '../utils/useHotKey';
33
- import {
34
- currentPane as currentPaneSelector,
35
- isLogVisible as isLogVisibleSelector,
36
- isSidePanelVisible as isSidePanelVisibleSelector,
37
- setCurrentPane,
38
- setPanes,
39
- toggleLogVisible,
40
- } from './appLayout';
41
- import ConnectedToStore from './ConnectedToStore';
42
- import VisibilityBar from './VisibilityBar';
43
-
44
- import './app.scss';
45
- import './shared.scss';
46
-
47
- let usageDataAlreadyInitialised = false;
48
- const initialiseUsageData = () => {
49
- if (!usageDataAlreadyInitialised) {
50
- usageDataAlreadyInitialised = true;
51
- try {
52
- usageDataInit(packageJson());
53
- } catch (error) {
54
- // No need to display the error message for the user
55
- console.log(error);
56
- }
57
- }
58
- };
59
-
60
- export interface PaneProps {
61
- active: boolean;
62
- }
63
-
64
- export interface Pane {
65
- name: string;
66
- Main: FC<PaneProps>;
67
- SidePanel?: FC;
68
- }
69
-
70
- interface ConnectedAppProps {
71
- deviceSelect?: ReactNode;
72
- panes: Pane[];
73
- sidePanel?: ReactNode;
74
- showLogByDefault?: boolean;
75
- reportUsageData?: boolean;
76
- documentation?: ReactNode[];
77
- children?: ReactNode;
78
- autoReselectByDefault?: boolean;
79
- }
80
-
81
- const ConnectedApp: FC<ConnectedAppProps> = ({
82
- deviceSelect,
83
- panes,
84
- sidePanel,
85
- showLogByDefault = true,
86
- reportUsageData = false,
87
- documentation,
88
- children,
89
- autoReselectByDefault = false,
90
- }) => {
91
- usePersistedPane();
92
- const isLogVisible = useSelector(isLogVisibleSelector);
93
- const currentPane = useSelector(currentPaneSelector);
94
- const allPanes = useAllPanes(panes);
95
- const dispatch = useDispatch();
96
-
97
- useHotKey({
98
- hotKey: 'alt+l',
99
- title: 'Open launcher',
100
- isGlobal: true,
101
- action: () => ipcRenderer.send('open-app-launcher'),
102
- });
103
-
104
- useEffect(() => {
105
- dispatch(setAutoReselect(autoReselectByDefault));
106
- }, [dispatch, autoReselectByDefault]);
107
-
108
- useEffect(() => {
109
- if (!showLogByDefault) {
110
- dispatch(toggleLogVisible());
111
- }
112
- }, [dispatch, showLogByDefault]);
113
-
114
- useEffect(() => {
115
- if (documentation) dispatch(setDocumentationSections(documentation));
116
- }, [dispatch, documentation]);
117
-
118
- const SidePanelComponent = allPanes[currentPane].SidePanel;
119
- const currentSidePanel =
120
- SidePanelComponent != null ? <SidePanelComponent /> : sidePanel;
121
-
122
- const isSidePanelVisible =
123
- useSelector(isSidePanelVisibleSelector) && currentSidePanel;
124
-
125
- useEffect(() => {
126
- if (reportUsageData) {
127
- initialiseUsageData();
128
- }
129
- }, [reportUsageData]);
130
-
131
- return (
132
- <div className="core19-app">
133
- <NavBar deviceSelect={deviceSelect} />
134
- <div className="core19-app-content">
135
- <div
136
- className={classNames(
137
- 'core19-side-panel-container',
138
- isSidePanelVisible || 'hidden'
139
- )}
140
- >
141
- {currentSidePanel}
142
- </div>
143
- <div className="core19-main-and-log">
144
- <Carousel
145
- className="core19-main-container"
146
- activeIndex={currentPane}
147
- controls={false}
148
- indicators={false}
149
- keyboard={false}
150
- interval={null}
151
- slide
152
- fade
153
- >
154
- {allPanes.map(({ name, Main }, paneIndex) => (
155
- <Carousel.Item key={name}>
156
- <Main active={paneIndex === currentPane} />
157
- </Carousel.Item>
158
- ))}
159
- </Carousel>
160
- <div
161
- className={classNames(
162
- 'core19-log-viewer',
163
- isLogVisible || 'hidden'
164
- )}
165
- >
166
- <LogViewer />
167
- </div>
168
- </div>
169
- </div>
170
- <VisibilityBar isSidePanelEnabled={sidePanel !== null} />
171
-
172
- <ErrorDialog />
173
- <BrokenDeviceDialog />
174
- {children}
175
- </div>
176
- );
177
- };
178
-
179
- const ConnectedErrorBoundary: React.FC = ({ children }) => {
180
- const devices = useSelector(getDevices);
181
- const selectedDevice = useSelector(selectedDeviceSelector);
182
- const selectedSerialNumber = useSelector(selectedSerialNumberSelector);
183
-
184
- return (
185
- <ErrorBoundary
186
- devices={[...devices.values()]}
187
- selectedDevice={selectedDevice}
188
- selectedSerialNumber={selectedSerialNumber ?? undefined}
189
- >
190
- {children}
191
- </ErrorBoundary>
192
- );
193
- };
194
-
195
- export default ({
196
- appReducer,
197
- ...props
198
- }: { appReducer?: Reducer } & ConnectedAppProps) => (
199
- <ConnectedToStore appReducer={appReducer}>
200
- <ConnectedErrorBoundary>
201
- <ConnectedApp {...props} />
202
- </ConnectedErrorBoundary>
203
- </ConnectedToStore>
204
- );
205
-
206
- const usePersistedPane = () => {
207
- const dispatch = useDispatch();
208
- useEffect(() => {
209
- const pane = getPersistedCurrentPane() ?? 0;
210
- dispatch(setCurrentPane(pane));
211
- }, [dispatch]);
212
- };
213
-
214
- const useAllPanes = (panes: Pane[]) => {
215
- const dispatch = useDispatch();
216
-
217
- const allPanes = useMemo(
218
- () => [...panes, { name: 'About', Main: About }] as Pane[],
219
- [panes]
220
- );
221
-
222
- useEffect(() => {
223
- dispatch(setPanes(allPanes));
224
- }, [dispatch, allPanes]);
225
-
226
- return allPanes;
227
- };
@@ -1,19 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React, { ReactNode } from 'react';
8
- import { Provider } from 'react-redux';
9
- import { Reducer } from 'redux';
10
-
11
- import store from '../store';
12
-
13
- export default ({
14
- appReducer,
15
- children,
16
- }: {
17
- appReducer?: Reducer;
18
- children: ReactNode;
19
- }) => <Provider store={store(appReducer)}>{children}</Provider>;