From b86f50f6086cce133562dea09f72f3f1156fee2d Mon Sep 17 00:00:00 2001 From: PMinn <40393799+PMinn@users.noreply.github.com> Date: Sun, 24 Mar 2024 02:47:21 +0800 Subject: [PATCH] update: version4_1 --- components/Alert.js | 47 + components/Confirm.js | 40 + components/ConfirmComponent.js | 21 - components/CourseCardComponent.js | 139 +- components/FooterComponent.js | 46 +- components/Icons.js | 15 + components/Layout.js | 14 + components/NavComponent.js | 38 +- components/WayCheckbox.js | 24 + components/WayChip.js | 85 + components/WeatherCheckbox.js | 24 + contexts/System.js | 12 + data/category.json | 5 + data/exam.json | 8 + data/functions.json | 12 +- data/generalType.json | 5 + next.config.js | 41 +- package-lock.json | 16657 +++++++++++++++++------- package.json | 15 +- pages/404.js | 20 +- pages/_app.js | 91 +- pages/_document.js | 5 +- pages/addCourse.js | 620 +- pages/course/[[...params]].js | 232 +- pages/index.js | 197 +- pages/line/form.js | 461 +- pages/line/settings.js | 391 +- postcss.config.js | 6 + styles/404.module.css | 21 - styles/ConfirmComponent.module.css | 60 - styles/CourseCardComponent.module.css | 111 - styles/FooterComponent.module.css | 96 +- styles/LoadingComponent.module.css | 8 +- styles/NavComponent.module.css | 67 +- styles/addCourse.module.css | 131 - styles/course.module.css | 364 +- styles/globals.css | 80 +- styles/index.module.css | 74 +- styles/line/form.module.css | 6 +- styles/line/settings.module.css | 240 - tailwind.config.js | 65 + 41 files changed, 14035 insertions(+), 6559 deletions(-) create mode 100644 components/Alert.js create mode 100644 components/Confirm.js delete mode 100644 components/ConfirmComponent.js create mode 100644 components/Icons.js create mode 100644 components/Layout.js create mode 100644 components/WayCheckbox.js create mode 100644 components/WayChip.js create mode 100644 components/WeatherCheckbox.js create mode 100644 contexts/System.js create mode 100644 data/category.json create mode 100644 data/exam.json create mode 100644 data/generalType.json create mode 100644 postcss.config.js delete mode 100644 styles/404.module.css delete mode 100644 styles/ConfirmComponent.module.css delete mode 100644 styles/CourseCardComponent.module.css delete mode 100644 styles/addCourse.module.css delete mode 100644 styles/line/settings.module.css create mode 100644 tailwind.config.js diff --git a/components/Alert.js b/components/Alert.js new file mode 100644 index 0000000..cf50ec8 --- /dev/null +++ b/components/Alert.js @@ -0,0 +1,47 @@ +import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, cn } from "@nextui-org/react"; + +export default function Alert({ + title = "", + content = "", + disclosure, + callback, + placement = "center", + className = "", + color = "primary", + isDismissable = true +}) { + const dismissableProp = { + isDismissable: false, + isKeyboardDismissDisabled: true + } + return ( + + + { + onClose => ( + <> + {title} + +

{content}

+
+ + + + + ) + } +
+
+ ) +} \ No newline at end of file diff --git a/components/Confirm.js b/components/Confirm.js new file mode 100644 index 0000000..e16a2fe --- /dev/null +++ b/components/Confirm.js @@ -0,0 +1,40 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + cn +} from "@nextui-org/react"; + +export default function Confirm({ title, content, disclosure, confirm, placement = "center", className = "" }) { + return ( + + + { + onClose => ( + <> + {title} + {content} + + + + + + ) + } + + + ) +} \ No newline at end of file diff --git a/components/ConfirmComponent.js b/components/ConfirmComponent.js deleted file mode 100644 index 9a6a292..0000000 --- a/components/ConfirmComponent.js +++ /dev/null @@ -1,21 +0,0 @@ -import styles from '../styles/ConfirmComponent.module.css'; - -import coverStyles from '../styles/cover.module.css'; - -export default function Confirm({ title, content, btn, onClick, show, theme, size }) { - return ( -
-
-
{title}
-
{content}
-
- { - btn.map((item, index) => { - return (
{item}
) - }) - } -
-
-
- ) -} \ No newline at end of file diff --git a/components/CourseCardComponent.js b/components/CourseCardComponent.js index b696f5a..7cfeaa7 100644 --- a/components/CourseCardComponent.js +++ b/components/CourseCardComponent.js @@ -1,73 +1,108 @@ import Link from 'next/link'; +import { Card, CardHeader, CardBody, CardFooter, Progress, CheckboxGroup } from "@nextui-org/react"; +import examString from '@/data/exam.json'; +import { WayCheckbox } from '@/components/WayCheckbox'; +import { WayChip } from '@/components/WayChip'; -import styles from '../styles/CourseCardComponent.module.css'; - -export default function CourseCard({ e, isDemo, theme, setRevelationConfirmShow, setRevelationID }) { +export default function CourseCard({ e, isDemo, setRevelationConfirmShow, setRevelationID, setShareErrorConfirmShow }) { function shareOnClick(shareData) { if (navigator.share) { navigator.share(shareData); } else { - setShareErrorConfirmShow(true); - setShareErrorText('您的瀏覽器不支援分享功能,請使用其他瀏覽器。'); + setShareErrorConfirmShow(); } } return ( -
-
-
{e.className}
-
-
{ } : - () => shareOnClick({ - title: `${e.teacher.join('和')}的${e.className} 的課程評價`, - text: `在每日文大課程評價中,查看${e.teacher.join('和')}的${e.className}。`, - url: 'https://daily-pccu.web.app/course/' + e.id, - }) - }> - + + +
{e.className}
+
+
shareOnClick({ + title: `${e.teacher.join('和')}的${e.className} 的課程評價`, + text: `在每日文大課程評價中,查看${e.teacher.join('和')}的${e.className}。`, + url: 'https://daily-pccu.web.app/course/' + e.id, + }) + }> +
-
{ } : - () => { - setRevelationConfirmShow(true); - setRevelationID(e.id); - } - }> - +
{ + setRevelationConfirmShow(); + setRevelationID(e.id); + } + }> +
-
-
{e.department}
-
- { - e.teacher.map(teacher => { - return ( - {teacher} - ) - }) - } -
-
-
-
= 80 ? 'var(--green)' : (e.point >= 60 ? 'var(--yellow)' : 'var(--red)')) }}>
+ + +
{e.department}
+
+ { + e.teacher.map(teacher => {teacher}) + }
-
= 80 ? 'var(--green)' : (e.point >= 60 ? 'var(--yellow)' : 'var(--red)')) }}>{e.point}
-
-
{ - (e.exam != '' ? e.exam.split(',').map((exam, index) =>
{exam}
) : '') + e.point >= 80 ? + + : + e.point >= 60 ? + + : + } -
-
授課方式:
- {e.way} -
-
課程評語:
- {e.evaluation.replaceAll('\\n', '\n')} -
-
+
+ { + examString.map((exam, index) => ( + e.exam.includes(exam) ? + {exam} + : + {exam} + )) + } +
+
授課方式:
+ {e.way} +
+
課程評語:
+ {e.evaluation.replaceAll('\\n', '\n')} +
+ +
{e.year}學年
{new Date(e.date).toLocaleDateString()}
-
-
+ +
) } \ No newline at end of file diff --git a/components/FooterComponent.js b/components/FooterComponent.js index f282921..2bb8d00 100644 --- a/components/FooterComponent.js +++ b/components/FooterComponent.js @@ -1,31 +1,35 @@ import Link from 'next/link'; -import styles from '../styles/FooterComponent.module.css'; +import styles from '@/styles/FooterComponent.module.css'; -export default function Footer() { +export default function Footer({ options = {} }) { + if (options.hidden == true) return null; return ( -