From 99e763e762718965d900b4de7f77a08da634a295 Mon Sep 17 00:00:00 2001 From: ItsukiKigoshi Date: Mon, 5 Feb 2024 01:15:37 +0900 Subject: [PATCH 1/4] Reuse "Paste it!" feat --- src/components/AddCourse/index.tsx | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/components/AddCourse/index.tsx b/src/components/AddCourse/index.tsx index 32be505..865c427 100644 --- a/src/components/AddCourse/index.tsx +++ b/src/components/AddCourse/index.tsx @@ -1,7 +1,7 @@ import { Course } from "@/src/type/Types"; -import { Button, Flex } from "@mantine/core"; +import { Button, Group, TextInput } from "@mantine/core"; import { useDisclosure } from "@mantine/hooks"; -import { IconPlus } from "@tabler/icons-react"; +import { IconClipboard, IconPlus } from "@tabler/icons-react"; import { useEffect, useState } from "react"; import ModalCourseEditor from "../ModalCourseEditor"; @@ -157,32 +157,22 @@ export default function AddCourse(props: { modalCourseEditorOpened={modalCourseEditorOpened} editorClose={editorClose} /> - - - {/* - } + leftSection={} styles={{ section: { pointerEvents: "none" } }} value={query} error={errorMessage} onChange={(e) => setQuery(e.currentTarget.value)} onSubmit={handleSubmit} - />*/} - + /> + ); } From 0ca0a85c677f72f2f9ff40f6355792cbd75133bd Mon Sep 17 00:00:00 2001 From: ItsukiKigoshi Date: Mon, 5 Feb 2024 02:39:02 +0900 Subject: [PATCH 2/4] Update .gitignore with .env and yarn.lock --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index dacb84f..389a7a8 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,5 @@ next-env.d.ts **/public/workbox-*.js **/public/workbox-*.js.map -.env \ No newline at end of file +.env +yarn.lock From 8aeb65bd3b77c673cc253333a0f53ad3169f73fb Mon Sep 17 00:00:00 2001 From: ItsukiKigoshi Date: Mon, 5 Feb 2024 02:39:18 +0900 Subject: [PATCH 3/4] Add @types/react-csv and react-csv dependencies --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index b7282a0..44df620 100644 --- a/package.json +++ b/package.json @@ -28,12 +28,14 @@ "@tiptap/extension-link": "^2.1.12", "@tiptap/react": "^2.1.12", "@tiptap/starter-kit": "^2.1.12", + "@types/react-csv": "^1.1.10", "@vercel/analytics": "^1.1.2", "dayjs": "^1.11.10", "embla-carousel-react": "^7.1.0", "next": "14.0.3", "next-pwa": "^5.6.0", "react": "^18", + "react-csv": "^2.2.2", "react-dom": "^18" }, "devDependencies": { From 6c03806ab3d35f276ff50a126466dc0451993a97 Mon Sep 17 00:00:00 2001 From: ItsukiKigoshi Date: Mon, 5 Feb 2024 02:39:30 +0900 Subject: [PATCH 4/4] Add CSV download functionality --- src/app/page.tsx | 17 ++++++++++++++--- yarn.lock | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 62b77a0..3f3e23f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,8 +1,9 @@ "use client"; -import { AppShell, Button, Flex, em } from "@mantine/core"; +import { AppShell, Button, Flex, Group, Text, em } from "@mantine/core"; import { useDisclosure, useMediaQuery, useToggle } from "@mantine/hooks"; -import { IconCalendar, IconList } from "@tabler/icons-react"; +import { IconCalendar, IconDownload, IconList } from "@tabler/icons-react"; import { useEffect, useState } from "react"; +import { CSVLink } from "react-csv"; import { Header } from "../components/Header"; import { Navbar } from "../components/Navbar"; import { Timetable } from "../components/Timetable"; @@ -207,7 +208,6 @@ export default function Page() { @@ -220,6 +220,17 @@ export default function Page() { > Search */} + + +