diff --git a/a.md b/a.md index e8c819f..aad5b11 100644 --- a/a.md +++ b/a.md @@ -22,4 +22,6 @@ https://www.jianshu.com/p/4699b825d285 https://chakra-ui.com/ https://www.npmjs.com/package/node-fetch https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_API/Using_Fetch - react-desktop \ No newline at end of file + react-desktop + + 考虑使用谷歌的材料ui \ No newline at end of file diff --git a/src/render/views/Home/Dialog.tsx b/backup/Home/Dialog.tsx similarity index 100% rename from src/render/views/Home/Dialog.tsx rename to backup/Home/Dialog.tsx diff --git a/src/render/views/Home/dialog.module.scss b/backup/Home/dialog.module.scss similarity index 100% rename from src/render/views/Home/dialog.module.scss rename to backup/Home/dialog.module.scss diff --git a/backup/Home/index.module.scss b/backup/Home/index.module.scss new file mode 100644 index 0000000..e7062d7 --- /dev/null +++ b/backup/Home/index.module.scss @@ -0,0 +1,10 @@ +.container { + padding: 20px; + .title { + font-size: 25px; + font-weight: bolder; + } + .opeation { + margin: 20px 0; + } +} diff --git a/backup/Home/index.tsx b/backup/Home/index.tsx new file mode 100644 index 0000000..f53b55c --- /dev/null +++ b/backup/Home/index.tsx @@ -0,0 +1,152 @@ +import electron from "@/plugins/electron" +import { addTodo, removeTodo } from "@/store/action/todo" +import { Button, ButtonGroup, ControlGroup, FormGroup, HotkeysProvider, InputGroup } from "@blueprintjs/core" +import { Cell, Column, Table2 } from "@blueprintjs/table" +import cs from "classnames" +import _ from "lodash" +import React, { useEffect, useRef, useState } from "react" +import { connect } from "react-redux" +import Dialog from "./Dialog" +import style from "./index.module.scss" +import useLocation from "./useLocation" + +export interface HomeProps { + add(text: string): void + + todo: ITodo[] + + remove(id: number): void +} + +let keyGen = 0 + +function Home(props: HomeProps) { + const [isOpen, setIsOpen] = useState(false) + const keyRef = useRef(null) + + function delItem() { + let key = keyRef.current?.value + if (key) { + let index = _.findIndex(clockList, { key: +key }) + if (index != -1) { + var list = [...clockList] + list.splice(index, 1) + setClockList(list) + keyRef.current!.value = "" + } + } + } + + const { save, get } = useLocation() + const [clockList, setClockList] = useState[]>([]) + const keyList = _.map(clockList, "key") + const titleList = _.map(clockList, "title") + const timeList = _.map(clockList, "time") + const descList = _.map(clockList, "desc") + + function onConfrim(title: string, time: string, desc: string) { + if (title && time) { + const value = { + key: ++keyGen, + title: title, + time: time, + desc: desc, + } + setClockList([...clockList, value]) + setIsOpen(false) + } + } + + useEffect(() => { + ;(async () => { + let list = await electron.ipcRenderer.invoke("@func:clock:getData") + if (list) { + setClockList(list) + const keyList = _.map(list, "key") + if (keyList.length) { + keyGen = Math.max(...keyList) + } + } + })() + }, []) + useEffect(() => { + electron.ipcRenderer.send("@func:clock:saveData", clockList) + }, [clockList]) + + return ( +
+
闹钟列表
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
MonthSavings
Sum$180
January$100
February$80
+ {/* + + {keyList[index]}}> + {titleList[index]}}> + {timeList[index]}}> + {descList[index]}}> + + */} +
+ + + + + + +
+ +
+ ) +} + +const mapStateToProps = (state: any) => { + return { + todo: state.todo, + } +} + +const mapDispatchToProps = (dispatch: any) => ({ + add: (text: string) => dispatch(addTodo(text)), + remove: (id: string | number) => dispatch(removeTodo(id)), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Home) diff --git a/src/render/views/Home/useLocation.ts b/backup/Home/useLocation.ts similarity index 100% rename from src/render/views/Home/useLocation.ts rename to backup/Home/useLocation.ts diff --git a/src/main/facilities/float/index.ts b/src/main/facilities/float/index.ts index 7644a84..6aafdce 100644 --- a/src/main/facilities/float/index.ts +++ b/src/main/facilities/float/index.ts @@ -82,7 +82,7 @@ ipcMain.on("@func:float:showRightMenu", e => { function createSuspensionWindow() { Shared.data.floatWindow = new BrowserWindow({ width: 260, // 悬浮窗口的宽度 比实际DIV的宽度要多2px 因为有1px的边框 - height: 95, // 悬浮窗口的高度 比实际DIV的高度要多2px 因为有1px的边框 + height: 105, // 悬浮窗口的高度 比实际DIV的高度要多2px 因为有1px的边框 type: "toolbar", // 创建的窗口类型为工具栏窗口 frame: false, // 要创建无边框窗口 resizable: false, // 禁止窗口大小缩放 diff --git a/src/render/views/About/index.tsx b/src/render/views/About/index.tsx index 1a77efb..e37b31f 100644 --- a/src/render/views/About/index.tsx +++ b/src/render/views/About/index.tsx @@ -1,7 +1,7 @@ import React from "react" import style from "./index.module.scss" import { useLocation, Route, Switch, useHistory } from "react-router-dom" -// import html from "./a.md" +import html from "./a.md" function Test() { return
test
@@ -20,7 +20,7 @@ export default function About(props: any) { return (
- {/* {html} */} + {html}
{/*
back()}>阿萨 阿松大asdasd
*/} {/*
22{props.children}{location.href}
*/} diff --git a/src/render/views/Home/index.tsx b/src/render/views/Home/index.tsx index 5955ccc..44b2c71 100644 --- a/src/render/views/Home/index.tsx +++ b/src/render/views/Home/index.tsx @@ -1,127 +1,15 @@ import electron from "@/plugins/electron" -import { addTodo, removeTodo } from "@/store/action/todo" -import { Button, ButtonGroup, ControlGroup, FormGroup, HotkeysProvider, InputGroup } from "@blueprintjs/core" -import { Cell, Column, Table2 } from "@blueprintjs/table" import cs from "classnames" import _ from "lodash" -import React, { useEffect, useRef, useState } from "react" -import { connect } from "react-redux" -import Dialog from "./Dialog" +import React from "react" import style from "./index.module.scss" -import useLocation from "./useLocation" - -export interface HomeProps { - add(text: string): void - - todo: ITodo[] - - remove(id: number): void -} - -let keyGen = 0 - -function Home(props: HomeProps) { - const [isOpen, setIsOpen] = useState(false) - const keyRef = useRef(null) - - function delItem() { - let key = keyRef.current?.value - if (key) { - let index = _.findIndex(clockList, { key: +key }) - if (index != -1) { - var list = [...clockList] - list.splice(index, 1) - setClockList(list) - keyRef.current!.value = "" - } - } - } - - const { save, get } = useLocation() - const [clockList, setClockList] = useState[]>([]) - const keyList = _.map(clockList, "key") - const titleList = _.map(clockList, "title") - const timeList = _.map(clockList, "time") - const descList = _.map(clockList, "desc") - - function onConfrim(title: string, time: string, desc: string) { - if (title && time) { - const value = { - key: ++keyGen, - title: title, - time: time, - desc: desc - } - setClockList([...clockList, value]) - setIsOpen(false) - - } - } - - useEffect(() => { - (async ()=>{ - let list = await electron.ipcRenderer.invoke("@func:clock:getData") - if(list){ - setClockList(list) - const keyList = _.map(list, "key") - if (keyList.length) { - keyGen = Math.max(...keyList) - } - } - })() - }, []) - useEffect(() => { - electron.ipcRenderer.send("@func:clock:saveData", clockList) - }, [clockList]) +function Home() { return (
-
闹钟列表
-
- - - - -
- - - {keyList[index]}}> - {titleList[index]}}> - {timeList[index]}}> - {descList[index]}}> - - -
- - - - - - -
- + add
) } -const mapStateToProps = (state: any) => { - return { - todo: state.todo - } -} - -const mapDispatchToProps = (dispatch: any) => ({ - add: (text: string) => dispatch(addTodo(text)), - remove: (id: string | number) => dispatch(removeTodo(id)) -}) - -export default connect(mapStateToProps, mapDispatchToProps)(Home) +export default Home \ No newline at end of file diff --git a/src/render/views/Layout/index.module.scss b/src/render/views/Layout/index.module.scss index a6b2b3b..4d39186 100644 --- a/src/render/views/Layout/index.module.scss +++ b/src/render/views/Layout/index.module.scss @@ -3,6 +3,15 @@ height: 100vh; position: relative; transform:scale(1,1); + &.NoLayout{ + .left { + display: none; + width: 0; + } + .right{ + margin-left: 0; + } + } .left { position: fixed; left: 0; diff --git a/src/render/views/Layout/index.tsx b/src/render/views/Layout/index.tsx index de62bc3..3cbbbd3 100644 --- a/src/render/views/Layout/index.tsx +++ b/src/render/views/Layout/index.tsx @@ -3,11 +3,11 @@ import route, { useRoute } from "@render/route" import React, { Fragment } from "react" import { NavLink, useLocation } from "react-router-dom" import style from "./index.module.scss" -import { TitleBar, Toolbar, Text } from "react-desktop/macOs" +import cs from "classnames" -// interface IProps { -// render(): ReactElement -// } +function ActionItem(){ + +} export default function Layout(props: any) { let isLayout = true @@ -26,8 +26,8 @@ export default function Layout(props: any) { { path: "/home", icon: "time", - title: "添加闹钟", - text: "闹钟", + title: "首页", + text: "首页", }, { path: "/about", @@ -35,39 +35,34 @@ export default function Layout(props: any) { title: "添加闹钟", text: "关于", }, - { - path: "/float", - icon: "mugshot", - title: "浮动框测试", - text: "浮动", - }, ] - return isLayout ? ( -
-
-
- {list.map((v, i) => ( - -
- -
{v.text}
- {v.path == curRoute.path &&
} -
-
- ))} + return ( +
+
+
+ {list.map((v, i) => ( + +
+ +
{v.text}
+ {v.path == curRoute.path &&
} +
+
+ ))} +
+
+
+
-
-
- -
+
+
-
- -
- ) : ( - +
+ +
+
) }