Skip to content

Commit ae7b2a4

Browse files
refactor: updated the library components to latest React structure
1 parent 52037a1 commit ae7b2a4

File tree

104 files changed

+11464
-12517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+11464
-12517
lines changed

.claude/settings.local.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(tree:*)",
5+
"Bash(npm run build:*)",
6+
"Bash(npm install)",
7+
"Bash(npm run dev:*)",
8+
"Bash(npx rimraf dist)",
9+
"Bash(npx rollup -c)",
10+
"Bash(timeout /t 3)",
11+
"Bash(npm test)",
12+
"Bash(find:*)",
13+
"Bash(npm install:*)",
14+
"Bash(npm run lint:*)",
15+
"Bash(grep:*)"
16+
]
17+
}
18+
}

.eslintrc.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,19 @@ jobs:
3838
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
3939
with:
4040
node-version: 24.x
41-
- name: Run NPM CI
42-
run: npm install
41+
- name: Install Dependencies
42+
run: npm ci
4343

4444
- name: Run Lint
4545
run: npm run lint
4646

47-
- name: Run Test
48-
run: npm run test
47+
- name: Run Tests with Coverage
48+
run: npm run test:coverage
4949

50-
- name: Run Coverage
51-
run: npm run coverage
52-
53-
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
54-
name: Upload Coverage Results
50+
- name: Upload Coverage Results
51+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
5552
with:
5653
directory: ./coverage/
5754

58-
- name: Run Build Dev
55+
- name: Run Build
5956
run: npm run build
60-
61-
- name: Run Build Externals
62-
run: npm run build-ext
63-
64-
- run: mv junit.xml ui-toolkit-react-unit.xml
65-
- name: Upload JEST Results
66-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
67-
with:
68-
name: ui-toolkit-react-unit
69-
path: ui-toolkit-react-unit.xml

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
node-version: "24.x"
3737
- run: npm ci
38-
- run: npm run build-ext --if-present
38+
- run: npm run build
3939
- run: rsync -a package.json README.md ./dist/
4040
- name: Semantic Release
4141
id: semantic

README.md

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,48 +26,61 @@ To succesfully deploy the UI Toolkit using React, the following software must be
2626
- [Visual Studio Code](https://code.visualstudio.com/) or any other IDE of choice
2727

2828

29-
## Create a New React App
29+
## Quick Start
3030

31-
The React app can be created in any preferred development directory. The MPS can continue to run while creating and running the app.
31+
```bash
32+
# Create a new React app with Vite
33+
npm create vite@latest my-app -- --template react-ts
34+
cd my-app
3235

33-
1. In a Command Prompt or Terminal, go to your preferred development directory.
36+
# Install UI Toolkit
37+
npm install @device-management-toolkit/ui-toolkit-react
3438

35-
2. Run the following commands to create sample React app named `my-app`.
39+
# Start development server
40+
npm run dev
41+
```
3642

37-
``` bash
38-
npx create-react-app my-app && cd my-app
39-
```
43+
### Run the Example
4044

41-
## Add UI Toolkit
45+
For quick testing, an example app is included. This requires a deployed MPS/RPS instance and an AMT device connected to it.
4246

43-
1. Run the following command to add the UI Toolkit and install the required dependencies:
47+
```bash
48+
cd example
49+
npm install
50+
npm run dev
51+
```
4452

45-
``` bash
46-
npm install @device-management-toolkit/ui-toolkit-react
47-
```
4853

49-
2. Run the following commands to start the web UI locally:
54+
## Development
5055

51-
``` bash
52-
npm start
53-
```
56+
To build and develop the library locally:
5457

55-
3. By default, React apps run on port `3000`. If port `3000` is already used by the MPS server or any other application, you'll be prompted to use another port. If this happens, enter 'Y'.
58+
```bash
59+
# Clone the repository
60+
git clone https://github.com/device-management-toolkit/ui-toolkit-react.git
61+
cd ui-toolkit-react
5662

57-
Sample Output:
63+
# Install dependencies
64+
npm install
5865

59-
```
60-
You can now view my-app in the browser.
61-
Local: http://localhost:3000
62-
On Your Network: http://172.16.17.4:3000
63-
```
66+
# Run tests
67+
npm test
6468

69+
# Run tests with coverage
70+
npm run test:coverage
71+
72+
# Run linting
73+
npm run lint
74+
75+
# Build the library
76+
npm run build
77+
```
6578

6679
## Additional Resources
6780

6881
- For detailed documentation and Getting Started, [visit the docs site](https://device-management-toolkit.github.io/docs).
6982

70-
- Looking to contribute? [Find more information here about contribution guidelines and practices](.\CONTRIBUTING.md).
83+
- Looking to contribute? [Find more information here about contribution guidelines and practices](./CONTRIBUTING.md).
7184

7285
- Find a bug? Or have ideas for new features? [Open a new Issue](https://github.com/device-management-toolkit/ui-toolkit-react/issues).
7386

eslint.config.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import js from '@eslint/js'
2+
import tseslint from 'typescript-eslint'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import jsxA11y from 'eslint-plugin-jsx-a11y'
6+
import globals from 'globals'
7+
8+
export default tseslint.config(
9+
// Ignore patterns
10+
{
11+
ignores: ['dist/**', 'node_modules/**', 'coverage/**', 'example/**', '**/mocks/**']
12+
},
13+
14+
// Base JavaScript recommended rules
15+
js.configs.recommended,
16+
17+
// TypeScript recommended rules
18+
...tseslint.configs.recommended,
19+
20+
// React and TypeScript files configuration
21+
{
22+
files: ['**/*.{ts,tsx}'],
23+
plugins: {
24+
react,
25+
'react-hooks': reactHooks,
26+
'jsx-a11y': jsxA11y
27+
},
28+
languageOptions: {
29+
ecmaVersion: 2022,
30+
sourceType: 'module',
31+
globals: {
32+
...globals.browser,
33+
...globals.es2022
34+
},
35+
parserOptions: {
36+
ecmaFeatures: {
37+
jsx: true
38+
}
39+
}
40+
},
41+
settings: {
42+
react: {
43+
version: 'detect'
44+
}
45+
},
46+
rules: {
47+
// React rules
48+
...react.configs.recommended.rules,
49+
...react.configs['jsx-runtime'].rules,
50+
'react/react-in-jsx-scope': 'off', // Not needed with React 17+ JSX transform
51+
'react/prop-types': 'off', // Using TypeScript for prop validation
52+
53+
// React Hooks rules
54+
...reactHooks.configs.recommended.rules,
55+
'react-hooks/set-state-in-effect': 'off', // Allow setState in effects for initialization patterns
56+
57+
// Accessibility rules
58+
...jsxA11y.configs.recommended.rules,
59+
60+
// TypeScript rules adjustments
61+
'@typescript-eslint/no-unused-vars': ['error', {
62+
argsIgnorePattern: '^_',
63+
varsIgnorePattern: '^_'
64+
}],
65+
'@typescript-eslint/no-explicit-any': 'warn',
66+
'@typescript-eslint/explicit-function-return-type': 'off',
67+
'@typescript-eslint/explicit-module-boundary-types': 'off'
68+
}
69+
},
70+
71+
// Test files - more relaxed rules
72+
{
73+
files: ['**/__tests__/**/*.{ts,tsx}', '**/*.test.{ts,tsx}', '**/__mocks__/**/*.{ts,tsx}'],
74+
rules: {
75+
'@typescript-eslint/no-explicit-any': 'off',
76+
'@typescript-eslint/no-unused-vars': 'off',
77+
'jsx-a11y/click-events-have-key-events': 'off',
78+
'jsx-a11y/no-static-element-interactions': 'off'
79+
}
80+
}
81+
)

example/index.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>UI Toolkit React - Test Application</title>
7+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xterm/[email protected]/css/xterm.min.css" />
8+
<style>
9+
* { margin: 0; padding: 0; box-sizing: border-box; }
10+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; }
11+
.app-container { max-width: 1200px; margin: 0 auto; padding: 20px; }
12+
.header { background: #1a1a2e; color: white; padding: 20px; margin-bottom: 20px; border-radius: 8px; }
13+
.header h1 { margin-bottom: 10px; }
14+
.config-panel { background: #f9f9f9; padding: 15px; border-radius: 4px; margin-bottom: 20px; }
15+
.config-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 15px; }
16+
.config-panel input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
17+
.config-actions { display: flex; gap: 10px; align-items: center; }
18+
.config-actions select { padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
19+
.config-actions button { margin-left: auto; }
20+
.tabs { display: flex; gap: 10px; margin-bottom: 20px; }
21+
.tab-button { padding: 10px 20px; border: none; background: #e0e0e0; cursor: pointer; border-radius: 4px; font-size: 14px; }
22+
.tab-button.active, .tab-button:hover { background: #007bff; color: white; }
23+
.component-container { background: white; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
24+
.btn-success { padding: 10px 30px; font-weight: bold; color: #fff; background: #28a745; border: none; border-radius: 4px; cursor: pointer; }
25+
.btn-danger { padding: 10px 30px; font-weight: bold; color: #fff; background: #dc3545; border: none; border-radius: 4px; cursor: pointer; }
26+
.btn-success:disabled, .btn-danger:disabled { background: #6c757d; cursor: not-allowed; }
27+
.alert { margin-top: 10px; padding: 10px; border-radius: 4px; }
28+
.alert-error { background: #f8d7da; color: #721c24; }
29+
.alert-success { background: #d4edda; color: #155724; }
30+
.placeholder { padding: 40px; text-align: center; color: #666; }
31+
</style>
32+
</head>
33+
<body>
34+
<div id="root"></div>
35+
<script type="module" src="/src/main.tsx"></script>
36+
</body>
37+
</html>

0 commit comments

Comments
 (0)