From c745f01a41fd5b0a68ebfe7cb4dcc8532a6930b7 Mon Sep 17 00:00:00 2001 From: Hotaru Date: Thu, 15 Aug 2024 12:29:28 +0800 Subject: [PATCH] fix: character submit problems --- .gitignore | 5 +- README.md | 82 ++++- TODO.md | 1 + .../src/components/CharacterForm/index.tsx | 8 +- .../client/src/components/Layout/index.tsx | 2 +- packages/client/src/config.ts | 2 +- packages/client/src/i18n/locales.ts | 2 +- .../client/src/views/Admin/Login/index.tsx | 4 +- packages/client/src/views/Character/index.tsx | 9 +- packages/client/src/views/Home/index.tsx | 4 +- packages/client/src/views/Photos/index.tsx | 4 +- packages/common/src/schema/index.ts | 4 +- packages/core/data.sql | 321 +++++++++++++----- packages/core/prisma/schema.prisma | 16 +- .../public/assets/ActionButton-3SQyXijp.js | 1 - .../public/assets/CheckOutlined-BR5bZcf0.js | 1 - .../public/assets/DownOutlined-CN3FJKj5.js | 1 - .../public/assets/EyeOutlined-Cm8LOwQp.js | 1 - .../core/public/assets/PurePanel-CtYiXTUc.js | 1 - .../core/public/assets/TextArea-CZwWy1NO.js | 30 -- .../assets/addEventListener-Dj6lacZr.js | 1 - .../core/public/assets/button-CElchV4s.js | 1 - .../core/public/assets/collapse-BbEVqHco.js | 3 - packages/core/public/assets/fade-BLp5ZxV7.js | 4 - packages/core/public/assets/index-6FMhMIiE.js | 1 - packages/core/public/assets/index-9xDZr7HO.js | 17 - packages/core/public/assets/index-Ag4UTIYW.js | 1 - packages/core/public/assets/index-B2LAgev7.js | 21 -- .../core/public/assets/index-BVraRauQ.css | 1 - packages/core/public/assets/index-BYoD10zd.js | 39 --- packages/core/public/assets/index-Bi6eMDVY.js | 9 - packages/core/public/assets/index-BqZJTrzk.js | 13 - .../core/public/assets/index-BsyuBKbA.css | 1 - packages/core/public/assets/index-CIrLfzuB.js | 107 ------ packages/core/public/assets/index-CMLhrbuK.js | 1 - packages/core/public/assets/index-CocNzfeP.js | 2 - packages/core/public/assets/index-CrudAHUQ.js | 1 - packages/core/public/assets/index-CtGtMs-3.js | 1 - packages/core/public/assets/index-D2FXBcfJ.js | 1 - packages/core/public/assets/index-D4_taaix.js | 1 - packages/core/public/assets/index-DFkruNbw.js | 22 -- .../core/public/assets/index-DGRvUvq0.css | 1 - packages/core/public/assets/index-DgChYpsb.js | 233 ------------- packages/core/public/assets/index-DlSRDo1c.js | 1 - .../core/public/assets/index-DnOgOUXM.css | 1 - packages/core/public/assets/index-DrXv5ZgW.js | 3 - packages/core/public/assets/index-M2xE2-GT.js | 30 -- .../core/public/assets/index-UklGg4h6.css | 1 - packages/core/public/assets/index-ZhY4ODey.js | 1 - packages/core/public/assets/index-i1NaKPKY.js | 1 - packages/core/public/assets/index-wIlz5b4F.js | 3 - packages/core/public/assets/index-x_UgWpPm.js | 1 - packages/core/public/assets/row-wWk8FtEW.js | 1 - .../public/assets/styleChecker-DWNKR-Rg.js | 1 - .../public/assets/useClosable-CRn6bIaf.js | 1 - .../core/public/assets/useLocale-BHh5rfC7.js | 1 - packages/core/public/index.html | 30 -- 57 files changed, 346 insertions(+), 711 deletions(-) delete mode 100644 packages/core/public/assets/ActionButton-3SQyXijp.js delete mode 100644 packages/core/public/assets/CheckOutlined-BR5bZcf0.js delete mode 100644 packages/core/public/assets/DownOutlined-CN3FJKj5.js delete mode 100644 packages/core/public/assets/EyeOutlined-Cm8LOwQp.js delete mode 100644 packages/core/public/assets/PurePanel-CtYiXTUc.js delete mode 100644 packages/core/public/assets/TextArea-CZwWy1NO.js delete mode 100644 packages/core/public/assets/addEventListener-Dj6lacZr.js delete mode 100644 packages/core/public/assets/button-CElchV4s.js delete mode 100644 packages/core/public/assets/collapse-BbEVqHco.js delete mode 100644 packages/core/public/assets/fade-BLp5ZxV7.js delete mode 100644 packages/core/public/assets/index-6FMhMIiE.js delete mode 100644 packages/core/public/assets/index-9xDZr7HO.js delete mode 100644 packages/core/public/assets/index-Ag4UTIYW.js delete mode 100644 packages/core/public/assets/index-B2LAgev7.js delete mode 100644 packages/core/public/assets/index-BVraRauQ.css delete mode 100644 packages/core/public/assets/index-BYoD10zd.js delete mode 100644 packages/core/public/assets/index-Bi6eMDVY.js delete mode 100644 packages/core/public/assets/index-BqZJTrzk.js delete mode 100644 packages/core/public/assets/index-BsyuBKbA.css delete mode 100644 packages/core/public/assets/index-CIrLfzuB.js delete mode 100644 packages/core/public/assets/index-CMLhrbuK.js delete mode 100644 packages/core/public/assets/index-CocNzfeP.js delete mode 100644 packages/core/public/assets/index-CrudAHUQ.js delete mode 100644 packages/core/public/assets/index-CtGtMs-3.js delete mode 100644 packages/core/public/assets/index-D2FXBcfJ.js delete mode 100644 packages/core/public/assets/index-D4_taaix.js delete mode 100644 packages/core/public/assets/index-DFkruNbw.js delete mode 100644 packages/core/public/assets/index-DGRvUvq0.css delete mode 100644 packages/core/public/assets/index-DgChYpsb.js delete mode 100644 packages/core/public/assets/index-DlSRDo1c.js delete mode 100644 packages/core/public/assets/index-DnOgOUXM.css delete mode 100644 packages/core/public/assets/index-DrXv5ZgW.js delete mode 100644 packages/core/public/assets/index-M2xE2-GT.js delete mode 100644 packages/core/public/assets/index-UklGg4h6.css delete mode 100644 packages/core/public/assets/index-ZhY4ODey.js delete mode 100644 packages/core/public/assets/index-i1NaKPKY.js delete mode 100644 packages/core/public/assets/index-wIlz5b4F.js delete mode 100644 packages/core/public/assets/index-x_UgWpPm.js delete mode 100644 packages/core/public/assets/row-wWk8FtEW.js delete mode 100644 packages/core/public/assets/styleChecker-DWNKR-Rg.js delete mode 100644 packages/core/public/assets/useClosable-CRn6bIaf.js delete mode 100644 packages/core/public/assets/useLocale-BHh5rfC7.js delete mode 100644 packages/core/public/index.html diff --git a/.gitignore b/.gitignore index ce0e766..2d3297c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,7 @@ migrations packages/core/public/imgs/**/*.png packages/core/public/imgs/**/*.jpg -packages/core/public/imgs/**/*.jpeg \ No newline at end of file +packages/core/public/imgs/**/*.jpeg + +packages/core/public/assets/* +packages/core/public/*.html \ No newline at end of file diff --git a/README.md b/README.md index e7e3c90..a884e88 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,96 @@ # MoeHub -⚡ A modern and universal Meta-Framework to construct other frameworks. ⚡ +⚡ A open source personal favorite character collection website system ⚡ + +⚡ 壹個開源的個人向喜愛角色收藏網站系統 ⚡ +## Details + +### Supports types + +- [x] Anime characters +- [x] Manga/Comic characters +- [x] Game characters +- [x] Galgame/Visual Novel characters +- [x] Light novel characters +- [x] Other characters + +Only supports **Japanese** characters, moehub doesn't support and welcome characters of other languages,especially +Z(C)hinese characters. + +### International + +- [x] Japan - Japanese (Default language) +- [x] American - English +- [x] Taiwan/Hongkong - Traditional Chinese +- [x] Zhina - Simplified Chinese (Will be deleted in the future) + +### Cli commands + +![](https://pic.imgdb.cn/item/66bd8160d9c307b7e9eb0016.png) + +- `help [...command]` Get command help information +- `pwd` Reset password in force when you forget your password +- `data` Get statistics data +- `character [name]` Get all or some characters's information + +### Characters birthdays reminder + +![](https://pic.imgdb.cn/item/66bd8160d9c307b7e9eaff64.png) + +Supports custom email template, receiver and any email accounts. + +> Need you to set configurations (refer to the next content) + ## Example > [👉 There](https://m.hotaru.icu) ## Usage +1. Download release version from [Github Release](https://github.com/biyuehu/moehub/releases) + +2. Extract the downloaded file + +3. Install dependencies (Choose one) + +```bash +npm install +yarn +pnpm install +``` + +4. Set your `.env` config and database + + +```ini +DATABASE_URL="mysql://username:password@host:port/database" + +# MoeHub server port + +PORT=5000 + +# MoeHub logger level + +LOG_LEVEL=30 +``` + +5. Import `data.sql` into your database + +6. Start the server (Choose one) + +```bash +npm run serve +yarn serve +pnpm serve +``` + +7. Login and set your website at `http://your-domain:5000/#/admin/settings` (Such as website title, name, address, +email key and more...) + ## Stacks - Frontend: React, tailwind-css, @kotori-bot/i18n diff --git a/TODO.md b/TODO.md index 5baf81e..267c26b 100644 --- a/TODO.md +++ b/TODO.md @@ -2,3 +2,4 @@ - [ ] Static webpage version - [ ] Supports character collections +- [ ] Support next.js version diff --git a/packages/client/src/components/CharacterForm/index.tsx b/packages/client/src/components/CharacterForm/index.tsx index bf8efdd..09ccc9f 100644 --- a/packages/client/src/components/CharacterForm/index.tsx +++ b/packages/client/src/components/CharacterForm/index.tsx @@ -16,7 +16,13 @@ export function handleMoehubDataCharacter(values: MoehubDataCharacterHandle): Mo // console.log(values.color) return { ...values, - color: values.color ? (values.color.cleared === false ? values.color.toHex() : '') : undefined, + color: values.color + ? typeof values.color === 'string' + ? values.color + : values.color.cleared === false + ? values.color.toHex() + : '' + : undefined, birthday: values.birthday ? new Date(values.birthday.toString()).getTime() : undefined } } diff --git a/packages/client/src/components/Layout/index.tsx b/packages/client/src/components/Layout/index.tsx index a1e9ca8..f763759 100644 --- a/packages/client/src/components/Layout/index.tsx +++ b/packages/client/src/components/Layout/index.tsx @@ -1,4 +1,4 @@ -import { Flex, Layout as AntLayout, Avatar, Button } from 'antd' +import { Flex, Layout as AntLayout, Avatar } from 'antd' import { PictureOutlined, PoweroffOutlined, TranslationOutlined } from '@ant-design/icons' import { Link, useNavigate } from 'react-router-dom' import styles from './styles.module.css' diff --git a/packages/client/src/config.ts b/packages/client/src/config.ts index 3a0aad7..55113f0 100644 --- a/packages/client/src/config.ts +++ b/packages/client/src/config.ts @@ -1,3 +1,3 @@ export default { - url: '/api' + url: 'http://localhost:5000/api' } diff --git a/packages/client/src/i18n/locales.ts b/packages/client/src/i18n/locales.ts index b680bdd..84af35a 100644 --- a/packages/client/src/i18n/locales.ts +++ b/packages/client/src/i18n/locales.ts @@ -200,12 +200,12 @@ export default { 'com.characterForm.seriesGenre.comic': 'Comic', 'com.characterForm.seriesGenre.galgame': 'Galgame/Visual Novel', 'com.characterForm.seriesGenre.game': 'Game', + 'com.characterForm.images.button': 'Add Image', 'com.characterForm.seriesGenre.novel': 'Light Novel', 'com.characterForm.seriesGenre.other': 'Other', 'com.characterForm.label.2': 'Detailed Information', 'com.characterForm.alias': 'Alias', 'com.characterForm.images': 'Images', - 'com.characterForm.images.button': 'Add Image', 'com.characterForm.description': 'Description', 'com.characterForm.hitokoto': 'Hitokoto', 'com.characterForm.birthday': 'Birthday', diff --git a/packages/client/src/views/Admin/Login/index.tsx b/packages/client/src/views/Admin/Login/index.tsx index 45b73fa..3ed36d2 100644 --- a/packages/client/src/views/Admin/Login/index.tsx +++ b/packages/client/src/views/Admin/Login/index.tsx @@ -18,7 +18,9 @@ const LoginView: React.FC = () => { const isLogged = !!useSelector(getToken) useEffect(() => { - if (isLogged) navigate('/admin') + if (!isLogged) return + navigate(0) + navigate('/admin') }, [navigate, isLogged]) const [form] = Form.useForm() diff --git a/packages/client/src/views/Character/index.tsx b/packages/client/src/views/Character/index.tsx index 7b664a7..950760a 100644 --- a/packages/client/src/views/Character/index.tsx +++ b/packages/client/src/views/Character/index.tsx @@ -58,14 +58,17 @@ const CharacterView: React.FC = () => {

{t`view.character.title`}

- {data.hitokoto ?
『{data.hitokoto}』
: null} + {data.hitokoto ? ( +
+ 『{data.hitokoto}』 +
+ ) : null} {data.songId ? ( <>