Skip to content

Commit 1e27b9a

Browse files
committed
feat: removed old ui and added a new one
1 parent 2bd7661 commit 1e27b9a

Some content is hidden

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

91 files changed

+12965
-6723
lines changed

ui/.eslintignore

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

ui/.eslintrc.cjs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
module.exports = {
2-
root: true,
3-
parser: '@typescript-eslint/parser',
4-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
5-
plugins: ['svelte3', '@typescript-eslint'],
6-
ignorePatterns: ['*.cjs'],
7-
overrides: [{files: ['*.svelte'], processor: 'svelte3/svelte3'}],
8-
settings: {
9-
'svelte3/typescript': () => require('typescript'),
10-
},
11-
parserOptions: {
12-
sourceType: 'module',
13-
ecmaVersion: 2020,
14-
},
15-
env: {
16-
browser: true,
17-
es2017: true,
18-
node: true,
19-
},
20-
};
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'@typescript-eslint/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
parser: '@typescript-eslint/parser',
11+
plugins: ['react-refresh'],
12+
rules: {
13+
'react-refresh/only-export-components': [
14+
'warn',
15+
{ allowConstantExport: true },
16+
],
17+
},
18+
}

ui/.gitignore

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

ui/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

ui/.prettierignore

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

ui/.prettierrc

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

ui/README.md

Lines changed: 110 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,126 @@
1-
# ChargePi UI
1+
# ChargePi Web Interface
22

3-
## Building
3+
A modern, sleek React TypeScript web interface for the ChargePi charging point framework.
44

5-
Install dependencies
5+
## Features
6+
7+
- **Modern Design**: Sleek, minimalistic UI with dark mode support using shadcn/ui components
8+
- **Responsive**: Works on desktop and mobile devices
9+
- **Widget System**: Customizable dashboard with addable/removable widgets
10+
- **Mock Data**: Simulated API with realistic charge point data
11+
- **Configurable Auth**: Authentication can be easily disabled for development
12+
- **Dark Mode**: Anthracite theme with orange and red accent colors
13+
14+
## Widgets
15+
16+
- **Status Widget**: Shows current status of all connectors
17+
- **Energy Widget**: Displays energy consumption statistics and charts
18+
- **Sessions Widget**: Lists recent charging sessions
19+
- **Faults Widget**: Shows active faults and error messages
20+
- **Current Session Widget**: Details of ongoing charging session
21+
22+
## Development
23+
24+
### Prerequisites
25+
26+
- Node.js 16+
27+
- npm or yarn
28+
29+
### Installation
630

731
```bash
32+
cd ui
833
npm install
934
```
1035

11-
Build project
36+
### Development Server
37+
38+
```bash
39+
npm start
40+
```
41+
42+
The application will be available at `http://localhost:3000`
43+
44+
### Building for Production
1245

1346
```bash
1447
npm run build
1548
```
1649

17-
The static output files will be generated in `./build`
50+
The built files will be in the `build/` directory, which is served by the Go HTTP server.
1851

19-
## Development
52+
## Authentication Configuration
2053

21-
Start the development server
54+
Authentication can be easily configured in `src/config/auth.ts`:
55+
56+
```typescript
57+
export const authConfig = {
58+
enabled: false, // Set to false to disable authentication
59+
mockUser: {
60+
id: '1',
61+
username: 'admin',
62+
role: 'admin'
63+
},
64+
mockCredentials: {
65+
username: 'admin',
66+
password: 'admin'
67+
}
68+
};
69+
```
70+
71+
When authentication is disabled, users are automatically logged in and redirected to the dashboard.
72+
73+
## Integration with Go Server
74+
75+
The UI is designed to be served by the Go HTTP server using the `gin-spa` middleware. The built files are served from `./ui/build` directory.
76+
77+
## Styling
78+
79+
The application uses Tailwind CSS with custom colors:
80+
- **Anthracite**: Dark theme colors (#0d1117 to #f8f9fa)
81+
- **Accent Orange**: #ff6b35
82+
- **Accent Red**: #dc2626
83+
84+
## Project Structure
2285

23-
```bash
24-
npm run dev
2586
```
87+
ui/
88+
├── public/
89+
│ └── index.html
90+
├── src/
91+
│ ├── components/
92+
│ │ ├── ui/ # shadcn/ui components
93+
│ │ │ ├── button.tsx
94+
│ │ │ ├── card.tsx
95+
│ │ │ ├── dialog.tsx
96+
│ │ │ └── input.tsx
97+
│ │ ├── widgets/
98+
│ │ │ ├── StatusWidget.tsx
99+
│ │ │ ├── EnergyWidget.tsx
100+
│ │ │ ├── SessionsWidget.tsx
101+
│ │ │ ├── FaultsWidget.tsx
102+
│ │ │ └── CurrentSessionWidget.tsx
103+
│ │ ├── Sidebar.tsx
104+
│ │ ├── WidgetGrid.tsx
105+
│ │ ├── WidgetSelector.tsx
106+
│ │ └── ProtectedRoute.tsx
107+
│ ├── config/
108+
│ │ └── auth.ts # Authentication configuration
109+
│ ├── contexts/
110+
│ │ ├── AuthContext.tsx
111+
│ │ └── ThemeContext.tsx
112+
│ ├── lib/
113+
│ │ └── utils.ts # Utility functions
114+
│ ├── pages/
115+
│ │ ├── LoginPage.tsx
116+
│ │ └── Dashboard.tsx
117+
│ ├── services/
118+
│ │ └── api.ts # Mock API service
119+
│ ├── App.tsx
120+
│ ├── index.tsx
121+
│ └── index.css
122+
├── package.json
123+
├── tailwind.config.js
124+
├── tsconfig.json
125+
└── README.md
126+
```

ui/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="ChargePi - Open Source Charge Point Management Interface"
11+
/>
12+
<title>ChargePi</title>
13+
</head>
14+
<body>
15+
<div id="root"></div>
16+
<script type="module" src="/src/main.tsx"></script>
17+
</body>
18+
</html>

0 commit comments

Comments
 (0)