Skip to content

Commit 633e790

Browse files
committed
save
1 parent 50ec096 commit 633e790

File tree

7 files changed

+97
-347
lines changed

7 files changed

+97
-347
lines changed

src/main/main.ts

-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { app, BrowserWindow, shell, ipcMain } from 'electron';
55
import { autoUpdater } from 'electron-updater';
66
import log from 'electron-log';
77
import OSS from 'ali-oss';
8-
import MenuBuilder from './menu';
98
import { resolveHtmlPath } from './util';
109
import type { ConfigParams } from '../renderer/type';
1110
// oss有些方法只能在node端使用https://github.com/ali-sdk/ali-oss#browser-usage
@@ -102,9 +101,6 @@ const createWindow = async () => {
102101
mainWindow = null;
103102
});
104103

105-
const menuBuilder = new MenuBuilder(mainWindow);
106-
menuBuilder.buildMenu();
107-
108104
// Open urls in the user's browser
109105
mainWindow.webContents.setWindowOpenHandler((edata) => {
110106
shell.openExternal(edata.url);

src/main/menu.ts

-290
This file was deleted.

src/renderer/App.tsx

+20-51
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,33 @@
1-
import {
2-
MemoryRouter as Router,
3-
Routes,
4-
Route,
5-
Link,
6-
Outlet,
7-
useNavigate,
8-
} from 'react-router-dom';
9-
import { Button } from 'antd';
10-
import { useEffect, useState } from 'react';
11-
import Config from './routes/config';
12-
13-
import { initOssClient, handleOss } from './util';
1+
import { Routes, Route, useNavigate } from 'react-router-dom';
2+
import { useState } from 'react';
3+
import OssConfig from './routes/OssConfig';
4+
import ProjectList from './routes/ProjectList';
5+
import ProjectVersionList from './routes/ProjectVersionList';
6+
import { initOssClient } from './util';
147
import './App.css';
158

16-
const Hello = () => {
9+
export default function App() {
1710
const navigate = useNavigate();
1811
const [hasInit, setInit] = useState(false);
1912
const localAk = localStorage.getItem('ak');
13+
2014
if (!localAk) {
2115
navigate('/config');
2216
} else if (!hasInit) {
23-
if (!hasInit) {
24-
initOssClient(JSON.parse(localAk))
25-
.then((res) => {
26-
setInit(true);
27-
return res;
28-
})
29-
.catch((err) => console.log(err));
30-
}
17+
initOssClient(JSON.parse(localAk))
18+
.then((res) => {
19+
setInit(true);
20+
return res;
21+
})
22+
.catch((err) => console.log(err));
3123
}
32-
useEffect(() => {
33-
async function handle() {
34-
if (hasInit) {
35-
const list = await handleOss('list', {
36-
prefix: '',
37-
delimiter: '/',
38-
'max-keys': 1000,
39-
});
40-
console.log(list);
41-
}
42-
}
4324

44-
handle();
45-
}, [hasInit]);
46-
return (
47-
<div>
48-
<Button type="primary">eeee</Button>
49-
<Link to="/config">登录</Link>
50-
<Outlet />
51-
</div>
52-
);
53-
};
54-
55-
export default function App() {
5625
return (
57-
<Router>
58-
<Routes>
59-
<Route path="/" element={<Hello />} />
60-
<Route path="config" element={<Config />} />
61-
</Routes>
62-
</Router>
26+
<Routes>
27+
<Route path="/" element={<ProjectList hasInit={hasInit} />}>
28+
<Route path=":project" element={<ProjectVersionList />} />
29+
</Route>
30+
<Route path="config" element={<OssConfig />} />
31+
</Routes>
6332
);
6433
}

0 commit comments

Comments
 (0)