@nordicsemiconductor/pc-nrfconnect-shared 214.0.0 → 215.0.0

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.
package/Changelog.md CHANGED
@@ -7,6 +7,17 @@ This project does _not_ adhere to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
8
8
  every new version is a new major version.
9
9
 
10
+ ## 215.0.0 - 2025-06-27
11
+
12
+ ### Added
13
+
14
+ - `generateSystemReport` now includes relevant app information.
15
+
16
+ ### Changed
17
+
18
+ - StateSelector:Refactored with tailwind. Added `size` prop to control the
19
+ height of the selector.
20
+
10
21
  ## 214.0.0 - 2025-06-17
11
22
 
12
23
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "214.0.0",
3
+ "version": "215.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -5,13 +5,13 @@
5
5
  */
6
6
 
7
7
  import React from 'react';
8
- import { Button, ButtonGroup } from 'react-bootstrap';
9
8
 
10
- import './state-selector.scss';
9
+ import classNames from '../utils/classNames';
11
10
 
12
11
  interface ComplexItem {
13
12
  key: string;
14
13
  renderItem: React.ReactNode;
14
+ title?: string;
15
15
  }
16
16
 
17
17
  type SelectItem = string | ComplexItem;
@@ -21,24 +21,60 @@ const convertToComplex = (item: SelectItem): ComplexItem => {
21
21
  return {
22
22
  key: item,
23
23
  renderItem: item,
24
+ title: undefined,
24
25
  } as ComplexItem;
25
26
  }
26
27
 
27
28
  return item as ComplexItem;
28
29
  };
30
+
31
+ const SwitchButton: React.FC<{
32
+ variant: string;
33
+ onClick: () => void;
34
+ disabled: boolean;
35
+ children: React.ReactNode;
36
+ size?: 'sm' | 'md';
37
+ title?: string;
38
+ }> = ({ variant, onClick, disabled, children, size = 'md', title }) => (
39
+ <button
40
+ type="button"
41
+ className={`${classNames(
42
+ 'tw-relative tw-flex-auto tw-rounded-sm tw-text-sm',
43
+ size === 'sm' && 'tw-p-0',
44
+ size === 'md' && 'tw-p-1',
45
+ variant === 'set' &&
46
+ 'tw-border-gray-700 tw-bg-white tw-text-gray-700',
47
+ variant === 'unset' &&
48
+ 'tw-border-white tw-bg-gray-700 tw-text-white'
49
+ )}`}
50
+ onClick={onClick}
51
+ disabled={disabled}
52
+ title={title}
53
+ >
54
+ {children}
55
+ </button>
56
+ );
57
+
29
58
  export interface Props {
30
59
  items: SelectItem[];
31
60
  onSelect: (index: number) => void;
32
61
  disabled?: boolean;
33
62
  selectedItem: SelectItem;
63
+ size?: 'sm' | 'md';
34
64
  }
35
65
 
36
- export default ({ items, onSelect, disabled = false, selectedItem }: Props) => {
66
+ export default ({
67
+ items,
68
+ onSelect,
69
+ disabled = false,
70
+ selectedItem,
71
+ size = 'md',
72
+ }: Props) => {
37
73
  const selectionButton = (item: SelectItem, index: number) => {
38
74
  const complexItem = convertToComplex(item);
39
75
  const complexSelectedItem = convertToComplex(selectedItem);
40
76
  return (
41
- <Button
77
+ <SwitchButton
42
78
  key={complexItem.key}
43
79
  variant={
44
80
  complexSelectedItem.key === complexItem.key
@@ -48,17 +84,18 @@ export default ({ items, onSelect, disabled = false, selectedItem }: Props) => {
48
84
  onClick={() => {
49
85
  onSelect(index);
50
86
  }}
51
- active={complexSelectedItem.key === complexItem.key}
52
87
  disabled={disabled}
88
+ size={size}
89
+ title={complexItem.title}
53
90
  >
54
91
  {complexItem.renderItem}
55
- </Button>
92
+ </SwitchButton>
56
93
  );
57
94
  };
58
95
 
59
96
  return (
60
- <ButtonGroup className="w-100 d-flex channel-selection flex-row">
97
+ <div className="tw-preflight tw-flex tw-w-full tw-flex-row tw-justify-center tw-bg-gray-700 tw-p-1">
61
98
  {items.map((item, index) => selectionButton(item, index))}
62
- </ButtonGroup>
99
+ </div>
63
100
  );
64
101
  };
@@ -18,6 +18,7 @@ import {
18
18
  import { deviceInfo as getDeviceInfo } from '../Device/deviceInfo/deviceInfo';
19
19
  import { Device } from '../Device/deviceSlice';
20
20
  import logger from '../logging';
21
+ import appDetails from './appDetails';
21
22
  import { getAppDataDir } from './appDirs';
22
23
  import { openFile } from './open';
23
24
 
@@ -120,6 +121,17 @@ const currentDeviceReport = (device?: Device, currentSerialNumber?: string) => {
120
121
  ];
121
122
  };
122
123
 
124
+ const appInfoReport = () =>
125
+ appDetails()
126
+ .then(app => [
127
+ `- App: ${app.displayName}`,
128
+ `- Version: ${app.currentVersion}`,
129
+ `- Source: ${app.source}`,
130
+ `- Core version: ${app.coreVersion}`,
131
+ `- Engine version: ${app.engineVersion}`,
132
+ ])
133
+ .catch(() => []);
134
+
123
135
  export const generateSystemReport = async (
124
136
  timestamp: string,
125
137
  allDevices?: Device[],
@@ -129,6 +141,7 @@ export const generateSystemReport = async (
129
141
  [
130
142
  `# nRFConnect System Report - ${timestamp}`,
131
143
  '',
144
+ ...(await appInfoReport()),
132
145
  ...(await generalInfoReport()),
133
146
  ...allDevicesReport(allDevices),
134
147
  ...currentDeviceReport(currentDevice, currentSerialNumber),
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import './state-selector.scss';
3
2
  interface ComplexItem {
4
3
  key: string;
5
4
  renderItem: React.ReactNode;
5
+ title?: string;
6
6
  }
7
7
  type SelectItem = string | ComplexItem;
8
8
  export interface Props {
@@ -10,7 +10,8 @@ export interface Props {
10
10
  onSelect: (index: number) => void;
11
11
  disabled?: boolean;
12
12
  selectedItem: SelectItem;
13
+ size?: 'sm' | 'md';
13
14
  }
14
- declare const _default: ({ items, onSelect, disabled, selectedItem }: Props) => JSX.Element;
15
+ declare const _default: ({ items, onSelect, disabled, selectedItem, size, }: Props) => JSX.Element;
15
16
  export default _default;
16
17
  //# sourceMappingURL=StateSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateSelector.d.ts","sourceRoot":"","sources":["../../../../src/StateSelector/StateSelector.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,uBAAuB,CAAC;AAE/B,UAAU,WAAW;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B;AAED,KAAK,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;AAYvC,MAAM,WAAW,KAAK;IAClB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,UAAU,CAAC;CAC5B;sEAEoE,KAAK;AAA1E,wBA4BE"}
1
+ {"version":3,"file":"StateSelector.d.ts","sourceRoot":"","sources":["../../../../src/StateSelector/StateSelector.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,WAAW;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;AAyCvC,MAAM,WAAW,KAAK;IAClB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,UAAU,CAAC;IACzB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB;6EAQE,KAAK;AANR,wBAmCE"}
@@ -1 +1 @@
1
- {"version":3,"file":"systemReport.d.ts","sourceRoot":"","sources":["../../../../src/utils/systemReport.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAwG/C,eAAO,MAAM,oBAAoB,cAClB,MAAM,eACJ,MAAM,EAAE,kBACL,MAAM,wBACA,MAAM,oBAQjB,CAAC;qCAGA,MAAM,EAAE,uBACC,MAAM,kBACX,MAAM;AAH1B,wBAwBE"}
1
+ {"version":3,"file":"systemReport.d.ts","sourceRoot":"","sources":["../../../../src/utils/systemReport.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAoH/C,eAAO,MAAM,oBAAoB,cAClB,MAAM,eACJ,MAAM,EAAE,kBACL,MAAM,wBACA,MAAM,oBASjB,CAAC;qCAGA,MAAM,EAAE,uBACC,MAAM,kBACX,MAAM;AAH1B,wBAwBE"}
@@ -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
- .channel-selection {
10
- padding: 4px;
11
- background-color: $gray-700;
12
- button {
13
- padding: 4px;
14
- border-radius: 4px !important;
15
- }
16
- .btn-unset {
17
- z-index: 0 !important;
18
- }
19
- .btn:disabled {
20
- opacity: initial;
21
- }
22
- .dot {
23
- position: absolute;
24
- top: 1px;
25
- right: 1px;
26
- width: 6px;
27
- height: 6px;
28
- border-radius: 3px;
29
- }
30
- .btn-set {
31
- color: $gray-700;
32
- background-color: $white;
33
- border-color: $gray-700;
34
- }
35
- .btn-unset {
36
- color: $white;
37
- background-color: $gray-700;
38
- border-color: $gray-700;
39
- }
40
- }