+
}
+ disclosure={disclosure}
+ size='5xl'
+ confirm={upload}
+ placement='center'
+ />
+
+
+
新增課程評價
+
您可以提供課程具體的資訊、分享您的觀點,以幫助所有同學未來選課有資訊可以參考。感謝您抽出寶貴的時間新增課程評價,您的參與將幫助大家獲得更多選課參考資訊。
-
-
-
-
-
-
-
-
-
課程名稱為必填
-
{(categoryType == 1 ? '' : (categoryType == 2 ? '不須包含 "自然通識︰"、"社會通識︰" 或 "人文通識︰"' : '不須包含 "跨域︰"'))}
-
-
-
-
-
授課教師為必填
-
多位教師請使用半形逗號(,)分隔
-
-
-
- setYear(e.target.value)} onBlur={yearOnBlur} />
-
-
-
-
+
+
+
{
- (
- courseConfig ?
- courseConfig.colleges.filter(c => !c.includes('通識')).map((c, i) => {
- return (
-
- setCollege(c)} checked={college == c} />
-
-
- )
- })
+ success == null ?
+ <>
+
+ {
+ category.map(c => {
+ return (
+
+
+ {
+ formFields
+ .map((field, index) => {
+ if (field.all) {
+ return (
+
{field.all}
+ );
+ }
+ if (field[c]) {
+ return (
+
{field[c]}
+ );
+ }
+ return (
+
+ );
+ })
+ }
+
+
+ )
+ })
+ }
+
+ {
+ loading ?
+
+ :
+
+ }
+ >
+ :
+ success ?
+
:
- <>>
- )
+
}
-
-
-
- setTempPoint(e.target.value)} onBlur={pointOnBlur} />
-
-
-
- setWay(e.target.value)} />
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
)
}
\ No newline at end of file
diff --git a/pages/course/[[...params]].js b/pages/course/[[...params]].js
index d52aae0..5214158 100644
--- a/pages/course/[[...params]].js
+++ b/pages/course/[[...params]].js
@@ -1,21 +1,18 @@
import Head from 'next/head'
-import NavComponent from '../../components/NavComponent';
-import FooterComponent from '../../components/FooterComponent';
-import LoadingComponent from '../../components/LoadingComponent';
-import ConfirmComponent from '../../components/ConfirmComponent';
-import CourseCardComponent from '../../components/CourseCardComponent';
-import Link from 'next/link';
+import Confirm from '@/components/Confirm';
+import Alert from '@/components/Alert';
+import CourseCardComponent from '@/components/CourseCardComponent';
+import Layout from '@/components/Layout';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import useSWR from 'swr';
+import styles from '@/styles/course.module.css';
-import styles from '../../styles/course.module.css';
-import coverStyles from '../../styles/cover.module.css';
-
-import { app } from '../../js/firebaseConfig.js';
+import { app } from '@/js/firebaseConfig.js';
import { getDatabase, ref, get } from "firebase/database";
import { getFirestore, collection, query, where, getDocs, doc, getDoc } from "firebase/firestore";
import { getAnalytics, logEvent } from "firebase/analytics";
+import { Input, Card, CardHeader, CardBody, CardFooter, Link, Button, Accordion, AccordionItem, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, useDisclosure, RadioGroup, Radio } from "@nextui-org/react";
const database = getDatabase(app);
const firestore = getFirestore(app);
@@ -71,16 +68,40 @@ function fetchConfig() {
return get(ref(database, 'courseConfig/')).then(snapshot => snapshot.val())
}
-export default function Course({ theme, setTheme }) {
+function Menu({ courseConfig }) {
+ return (courseConfig ?
+
+ {
+ courseConfig.years.map(year => {
+ return (
+
+ {
+ courseConfig.colleges.map((college, index) => {
+ return (
+
+ )
+ })
+ }
+
+ )
+ })
+ }
+
+ :
+ <>>
+ )
+
+}
+
+export default function Course() {
const [loading, setLoading] = useState(false);
- const [openMenu, setOpenMenu] = useState(false);
- const [revelationConfirmShow, setRevelationConfirmShow] = useState(false);
- const [successConfirmShow, setSuccessConfirmShow] = useState(false);
const [revelationID, setRevelationID] = useState("");
- const [shareErrorConfirmShow, setShareErrorConfirmShow] = useState(false);
- const [shareErrorText, setShareErrorText] = useState("");
-
const router = useRouter();
+ const { isOpen: isRevelationOpen, onOpen: onRevelationOpen, onOpenChange: onRevelationOpenChange } = useDisclosure();
+ const { isOpen: isSuccessOpen, onOpen: onSuccessOpen, onOpenChange: onSuccessOpenChange } = useDisclosure();
+ const { isOpen: isShareErrorOpen, onOpen: onShareErrorOpen, onOpenChange: onShareErrorOpenChange } = useDisclosure();
+ const { isOpen: isMobileMenuOpen, onOpen: onMobileMenuOpen, onOpenChange: onMobileMenuOpenChange } = useDisclosure();
+
var pathname = router.asPath.replace(/([^#]+)#[^#]+/g, "$1");
const { data, error: dataError } = useSWR(pathname, fetchDatabase);
const { data: courseConfig, error: courseConfigError } = useSWR("/courseConfig", fetchConfig);
@@ -98,10 +119,8 @@ export default function Course({ theme, setTheme }) {
}
async function submitRevelation() {
- var checkedInput = document.querySelector('input[name="revelation"]:checked');
+ var checkedInput = document.getElementById('revelation').querySelector('*:checked');
if (checkedInput) {
- setRevelationConfirmShow(false);
- setLoading(true);
await fetch('https://script.google.com/macros/s/AKfycbwuhzDzw6RN6-pMb11lomwj0QEKwLYXIZaCfDiKO_QvI_FyIss6ogJ6CKoDnF2Mr_Q/exec', {
method: "POST",
headers: {
@@ -112,8 +131,7 @@ export default function Course({ theme, setTheme }) {
reason: checkedInput.value
})
})
- setLoading(false);
- setSuccessConfirmShow(true);
+ onSuccessOpen();
}
}
@@ -134,7 +152,7 @@ export default function Course({ theme, setTheme }) {
}, []);
return (
-
+
{/* HTML Meta Tags */}
{data ? data.title : "課程評價 | 每日文大"}
@@ -162,96 +180,112 @@ export default function Course({ theme, setTheme }) {
-
-
-
-
-
-
-
-
-
-
-
-
- } btn={['取消', '確認']} onClick={[() => setRevelationConfirmShow(false), submitRevelation]} show={revelationConfirmShow}>
-
-
- 成功
-
- } btn={['確認']} onClick={[() => setSuccessConfirmShow(false)]} show={successConfirmShow}>
-