Skip to content

Commit 3debb28

Browse files
committed
added modal and post init actions
1 parent 05f8431 commit 3debb28

File tree

21 files changed

+564
-64
lines changed

21 files changed

+564
-64
lines changed

package-lock.json

Lines changed: 29 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@
106106
"electron-debug": "^3.2.0",
107107
"electron-log": "^4.4.8",
108108
"electron-updater": "^6.1.4",
109+
"js-yaml": "^4.1.0",
109110
"react": "^18.2.0",
110111
"react-ace": "^13.0.0",
111112
"react-dom": "^18.2.0",
112113
"react-router-dom": "^6.16.0",
114+
"react-toastify": "^11.0.3",
113115
"react-tooltip": "^5.28.0"
114116
},
115117
"devDependencies": {
@@ -120,6 +122,7 @@
120122
"@testing-library/jest-dom": "^6.1.3",
121123
"@testing-library/react": "^14.0.0",
122124
"@types/jest": "^29.5.5",
125+
"@types/js-yaml": "^4.0.9",
123126
"@types/node": "20.6.2",
124127
"@types/react": "^18.2.21",
125128
"@types/react-dom": "^18.2.7",

src/main/ipcHandlers/cli.ipcHandlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const registerCliHandlers = (mainWindow: BrowserWindow) => {
1414
ipcMain.removeAllListeners('cli:error');
1515
ipcMain.removeAllListeners('cli:done');
1616

17-
ipcMain.handle('cli:run', async (_event, args: string[]) => {
17+
ipcMain.handle('cli:run', async (_event, args: string) => {
1818
try {
1919
await cliService.runCommand(mainWindow, args);
2020
return { success: true };

src/main/services/cli.service.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
22
import { BrowserWindow } from 'electron';
3-
import path from 'path';
43
import SettingsService from './settings.service';
54

65
export default class CliService {
@@ -26,22 +25,14 @@ export default class CliService {
2625
};
2726
}
2827

29-
runCommand(mainWindow: BrowserWindow, args: string[]) {
30-
if (args.length !== 2) {
31-
throw new Error('Invalid number of arguments');
32-
}
33-
args[1] = path.join(
34-
SettingsService.loadSettings().projectsDirectory,
35-
args[1],
36-
);
37-
28+
runCommand(mainWindow: BrowserWindow, args: string) {
3829
return new Promise<void>((resolve, reject) => {
3930
if (this.process) {
4031
reject(new Error('A command is already running. Please wait.'));
4132
return;
4233
}
4334

44-
this.process = spawn(this.cliPath, args, { shell: true });
35+
this.process = spawn(args, { shell: true });
4536

4637
this.process.stdout.on('data', (data) => {
4738
mainWindow.webContents.send('cli:output', '', data.toString());

src/renderer/App.css

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,6 @@ button:enabled:hover {
3939
opacity: 1;
4040
}
4141

42-
input {
43-
background-color: white;
44-
padding: 10px 20px;
45-
border-radius: 10px;
46-
border: 1px solid rgba(24, 39, 75, 0.2);
47-
font-size: 1.3rem;
48-
box-shadow: 0 4px 16px -4px rgba(24, 39, 75, 0.08),
49-
0 8px 32px -4px rgba(24, 39, 75, 0.1);
50-
transition: all ease-in 0.15s;
51-
outline: none;
52-
max-width: calc(100% - 40px);
53-
opacity: 0.9;
54-
55-
&:focus {
56-
border-color: rgba(24, 39, 75, 0.4);
57-
box-shadow: 0 6px 24px -4px rgba(24, 39, 75, 0.12),
58-
0 12px 48px -4px rgba(24, 39, 75, 0.14);
59-
opacity: 1;
60-
}
61-
62-
&::placeholder {
63-
color: rgba(24, 39, 75, 0.5);
64-
}
65-
}
66-
67-
6842
li {
6943
list-style: none;
7044
}
@@ -81,17 +55,31 @@ a:hover {
8155
text-decoration: none;
8256
}
8357

58+
input,
8459
select {
8560
background-color: white;
8661
padding: 10px 20px;
87-
border-radius: 10px;
88-
border: none;
89-
appearance: none;
90-
font-size: 1.3rem;
62+
border-radius: 6px;
63+
border: 1px solid rgba(24, 39, 75, 0.2);
64+
font-size: 1rem;
9165
box-shadow: 0 8px 28px -6px rgba(24, 39, 75, 0.12),
9266
0 18px 88px -4px rgba(24, 39, 75, 0.14);
9367
transition: all ease-in 0.1s;
9468
opacity: 0.9;
69+
}
70+
71+
input:focus,
72+
select:focus {
73+
border-color: #007bff;
74+
outline: none;
75+
}
76+
77+
input {
78+
max-width: calc(100% - 40px);
79+
}
80+
81+
select {
82+
padding: 13px 10px 13px 10px;
9583
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 5'%3E%3Cpath fill='%23000' d='M0 0L5 5L10 0H0Z'/%3E%3C/svg%3E");
9684
background-repeat: no-repeat;
9785
background-position: right 10px center;

src/renderer/App.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Route,
66
Navigate,
77
} from 'react-router-dom';
8+
import { ToastContainer } from 'react-toastify';
89
import './App.css';
910
import { AddProject, ProjectDetails, Settings, SetupProject } from './screens';
1011
import { AppLayout } from './layouts';
@@ -30,6 +31,17 @@ const AppWithProjectProvider: React.FC = () => {
3031
return (
3132
<AppProvider>
3233
<App />
34+
<ToastContainer
35+
position="bottom-right"
36+
autoClose={5000}
37+
hideProgressBar={false}
38+
newestOnTop={false}
39+
closeOnClick={false}
40+
rtl={false}
41+
pauseOnFocusLoss
42+
pauseOnHover
43+
theme="dark"
44+
/>
3345
</AppProvider>
3446
);
3547
};

src/renderer/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export * from './menu';
44
export * from './treeViewer';
55
export * from './editor';
66
export * from './customToolTip';
7+
export * from './modals';
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.form {
2+
display: flex;
3+
flex-direction: column;
4+
padding: 20px 0;
5+
}
6+
7+
.formGroup {
8+
margin-bottom: 15px;
9+
10+
input {
11+
width: 326px;
12+
}
13+
select {
14+
width: 400px;
15+
}
16+
}
17+
18+
label {
19+
display: block;
20+
margin-bottom: 5px;
21+
font-weight: bold;
22+
}
23+
24+
.formActions {
25+
display: flex;
26+
justify-content: flex-end;
27+
gap: 10px;
28+
}
29+
30+
.saveButton {
31+
padding: 10px 20px;
32+
border: none;
33+
border-radius: 5px;
34+
background-color: #007bff;
35+
color: white;
36+
font-size: 1rem;
37+
cursor: pointer;
38+
transition: background-color 0.3s ease;
39+
}
40+
41+
.saveButton:hover {
42+
background-color: #0056b3;
43+
}
44+
45+
.cancelButton {
46+
padding: 10px 20px;
47+
border: none;
48+
border-radius: 5px;
49+
background-color: #6c757d;
50+
color: white;
51+
font-size: 1rem;
52+
cursor: pointer;
53+
transition: background-color 0.3s ease;
54+
}
55+
56+
.cancelButton:hover {
57+
background-color: #5a6268;
58+
}

0 commit comments

Comments
 (0)