diff --git a/.env.example b/.env.example index 194a2de..5e7091c 100644 --- a/.env.example +++ b/.env.example @@ -1 +1 @@ -VITE_API_KEY = '' \ No newline at end of file +VITE_API_KEY = '@yQveRWre@b(!_9HmL' \ No newline at end of file diff --git a/README.md b/README.md index f02aedf..159591b 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,3 @@ -# React + TypeScript + Vite +DELETE https://zulip.ipsupply.com.au/apac-custom/api/truncate-notes?key={key} -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: - -- Configure the top-level `parserOptions` property like this: - -```js -export default { - // other rules... - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - project: ['./tsconfig.json', './tsconfig.node.json'], - tsconfigRootDir: __dirname, - }, -} -``` - -- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` -- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list +GET https://zulip.ipsupply.com.au/apac-custom/api/getAllNotes?key={key} diff --git a/electron/main.ts b/electron/main.ts index cdeae20..9cf3775 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -119,7 +119,9 @@ function createWindow() { } function createTray() { - tray = new Tray(path.join(process.env.VITE_PUBLIC, "assets", "icon16x16.png")); + tray = new Tray( + path.join(process.env.VITE_PUBLIC, "assets", "icon16x16.png") + ); const contextMenu = Menu.buildFromTemplate([ { @@ -228,5 +230,13 @@ ipcMain.handle("show-notification", async (_, { title, body }) => { body, silent: false, }); + + notification.on("click", () => { + if (win && !isQuiting) { + win.show(); + win.focus(); + } + }); + notification.show(); }); diff --git a/public/assets/icon-1.png b/public/assets/icon-1.png new file mode 100644 index 0000000..dde0232 Binary files /dev/null and b/public/assets/icon-1.png differ diff --git a/src/App.tsx b/src/App.tsx index 7cdff47..6071aee 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,12 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Route, HashRouter as Router, Routes } from "react-router-dom"; -import { MailsPage, MainPage } from "./pages"; +import { MainPage } from "./pages"; function App() { return ( } /> - } /> + {/* } /> */} ); diff --git a/src/components/message.tsx b/src/components/message.tsx index 9df3085..002fc13 100644 --- a/src/components/message.tsx +++ b/src/components/message.tsx @@ -1,67 +1,100 @@ -import { ActionIcon, Box, Paper, Textarea, Tooltip } from '@mantine/core'; -import { useDisclosure } from '@mantine/hooks'; -import { IconEye, IconEyeOff, IconTrash } from '@tabler/icons-react'; -import { useEffect, useMemo, useState } from 'react'; +import { ActionIcon, Box, Paper, Textarea, Tooltip } from "@mantine/core"; +import { useDisclosure } from "@mantine/hooks"; +import { IconEye, IconEyeOff, IconTrash } from "@tabler/icons-react"; +import { useEffect, useMemo, useState } from "react"; -import dayjs from 'dayjs' +import dayjs from "dayjs"; export interface IMessageProps { - data: IMessage; - onDelete: () => void + data: IMessage; + onDelete: () => void; } export default function Message({ data, onDelete }: IMessageProps) { - const [show, { toggle }] = useDisclosure(true); + const [show, { toggle }] = useDisclosure(true); - const [animation, setAnimation] = useState(false); + const [animation, setAnimation] = useState(false); - const messageContent = useMemo(() => { - return show ? data.message : data.message.replace(/./g, '•'); - }, [data.message, show]); + const messageContent = useMemo(() => { + return show ? data.message : data.message.replace(/./g, "•"); + }, [data.message, show]); - // Tắt hiệu ứng nhấp nháy sau 1 giây - useEffect(() => { - if (!animation) return; + // Tắt hiệu ứng nhấp nháy sau 1 giây + useEffect(() => { + if (!animation) return; - const timer = setTimeout(() => { - setAnimation(false); - }, 5000); - return () => clearTimeout(timer); - }, [animation]); + const timer = setTimeout(() => { + setAnimation(false); + }, 5000); + return () => clearTimeout(timer); + }, [animation]); - useEffect(() => { - const showAnimation = new Date().getTime() - new Date(data.time).getTime() <= 110000; + useEffect(() => { + const showAnimation = + new Date().getTime() - new Date(data.time).getTime() <= 110000; - setAnimation(showAnimation); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + setAnimation(showAnimation); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); - return ( - -
-