Skip to content
This repository was archived by the owner on Mar 29, 2026. It is now read-only.

Commit 64c4a07

Browse files
committed
fix:样式美化;update:0.1.1;
1 parent 1075112 commit 64c4a07

12 files changed

Lines changed: 65 additions & 532 deletions

File tree

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ <h3>Loading...</h3>
4444
.error-help {
4545
padding-left: 24px;
4646
}
47+
#app{
48+
background-color: #fff;
49+
}
4750
</style>
4851

4952
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vss-task",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"private": true,
55
"authors": "github262302",
66
"description": "一个小而美的任务管理工具",

src/App.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { useAppDispatch } from "@/store";
33
import { update_process } from "@/store/slice/process";
44
import { useEffect } from "react";
55
import { onProcess } from "@/utils/process";
6-
import { update_project } from "@/store/slice/project";
7-
import { loadProjectTask } from "@/utils";
8-
import { useProjectStorage } from "@/utils/project";
96
import { onMessage } from "@/utils/index";
107
import { add_message } from "@/store/slice/message";
118
import { message } from "antd";

src/add-project.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ function Root() {
5555
<Form.Item<FieldType>
5656
label="名称"
5757
name="name"
58-
rules={[{ required: true, message: "请输入项目名称!" }]}
58+
rules={[{ required: true, message: "请输入项目名称!" },{
59+
pattern: /^[a-zA-Z0-9_-]+$/,
60+
message: "项目名称只能包含字母、数字、下划线和中划线"
61+
}]}
5962
>
6063
<Input />
6164
</Form.Item>

src/components/Project/Add.tsx

Lines changed: 0 additions & 92 deletions
This file was deleted.
Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
.container{
2-
display: grid;
3-
gap: 12px;
2+
// gap: 12px;
43
box-sizing: border-box;
5-
grid-template-rows: auto;
64
padding: 24px;
7-
}
8-
.project-item{
9-
height: 100%;
10-
background-color: #A0F0A0;
11-
display: grid;
12-
place-items: center;
135
position: relative;
14-
border-radius: 8px;
15-
overflow: hidden;
16-
// hover 占 2row 1col 2行1列
17-
&:hover{
18-
grid-row: span 3 ;
19-
}
206
}
217
.project-item-menu{
22-
background-color: #F0F0F0;
8+
background-color: rgba(210, 212, 218, 0.1);
239
height: 100%;
2410
width: 100%;
2511
padding: 12px;
@@ -30,7 +16,11 @@
3016
display: none;
3117
}
3218
color: #333;
33-
19+
margin-bottom: 12px;
20+
overflow: hidden;
21+
border-bottom-right-radius: 8px;
22+
box-shadow:inset 0 0 1px rgba(0, 0, 0, 0.2);
23+
border-bottom-left-radius: 8px;
3424
}
3525
.project-item-menu-item{
3626
cursor: pointer;
@@ -51,4 +41,20 @@
5141
display: grid;
5242
place-items: center;
5343
cursor: pointer;
44+
}
45+
.project-item-title-container{
46+
background-color: #fff;
47+
text-align: center;
48+
font-weight: bold;
49+
50+
box-shadow:inset 0 0 1px rgba(0, 0, 0, 0.5);
51+
position: sticky;
52+
top: 0;
53+
overflow: hidden;
54+
border-top-right-radius: 8px;
55+
border-top-left-radius: 8px;
56+
}
57+
.project-item-title{
58+
padding: 4px 0;
59+
background-color: rgba(210, 212, 218, 0.3);
5460
}

src/components/project-list/index.tsx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
1-
import { project_data } from "@/store/slice/project";
1+
import { get_project_data_async, project_data } from "@/store/slice/project";
22
import Styles from "./index.module.less";
3-
import { useAppSelector } from "@/store";
3+
import { useAppDispatch, useAppSelector } from "@/store";
44
import { openAddProject, openTerminal, startProcessOutSide } from "@/utils";
55
import { openFolder } from "@/utils/index";
66
import { settings_data } from "@/store/slice/settings";
7+
import { ups } from "@/utils/project";
78
export default function ProjectList() {
9+
const dispatch = useAppDispatch();
810
const pd = useAppSelector(project_data);
911
const settings = useAppSelector(settings_data);
10-
console.log("pd", pd);
12+
const renderData = pd.slice(0);
13+
renderData.sort((a, b) => {
14+
return a.scripts.length - b.scripts.length;
15+
});
1116
const addProject = () => {
1217
openAddProject();
1318
};
1419
const terminal = path => {
1520
openTerminal(path);
1621
};
22+
const deleteProject = (name: string) => {
23+
console.log("delete", name);
24+
const isRemove = confirm("是否删除项目 " + name + " ?");
25+
if (isRemove) {
26+
ups.remove(name);
27+
dispatch(get_project_data_async());
28+
}
29+
};
1730
const folder = path => {
1831
openFolder(path);
1932
};
2033
const startProcess = (index, data) => {
2134
let node = pd[index];
22-
const params:startProcessOutSideParams = {
35+
const params: startProcessOutSideParams = {
2336
cwd: node.path,
2437
projectName: node.name,
2538
scriptName: data.name,
@@ -31,10 +44,12 @@ export default function ProjectList() {
3144
};
3245
return (
3346
<div className={Styles["container"]}>
34-
{pd.map((v, i) => {
47+
{renderData.map((v, i) => {
3548
return (
36-
<div className={Styles["project-item"]} key={i}>
37-
{v.name}
49+
<>
50+
<div className={Styles["project-item-title-container"]}>
51+
<div className={Styles["project-item-title"]}>{v.name}</div>
52+
</div>
3853
<div className={Styles["project-item-menu"]}>
3954
<div
4055
className={Styles["project-item-menu-item"]}
@@ -48,6 +63,10 @@ export default function ProjectList() {
4863
onClick={() => folder(v.path)}
4964
className="btn icon iconfont icon-folder"
5065
></i>
66+
<i
67+
onClick={() => deleteProject(v.name)}
68+
className="btn icon iconfont icon-shanchu"
69+
></i>
5170
</div>
5271
{v.scripts.map((it, ii) => {
5372
return (
@@ -61,7 +80,7 @@ export default function ProjectList() {
6180
);
6281
})}
6382
</div>
64-
</div>
83+
</>
6584
);
6685
})}
6786
<div onClick={addProject} className={Styles["project-add"]}>

0 commit comments

Comments
 (0)