From daf301ee7366ea48193c4e8f0917fc5463b7fb8c Mon Sep 17 00:00:00 2001 From: Philip Cheung Date: Mon, 7 Oct 2024 12:44:34 +0800 Subject: [PATCH] deleted noused library --- frontend/src/client/services.ts | 8 ------ .../src/components/AboutUs/AddAboutUs.tsx | 28 ++++--------------- .../src/components/AboutUs/EditAboutUs.tsx | 6 ++-- .../src/components/Common/ActionsMenu.tsx | 4 +-- .../CourseImage/editCourseImage.tsx | 7 ++--- .../src/components/Courses/CourseDetails.tsx | 10 +------ .../src/components/Courses/CourseImages.tsx | 15 ++-------- .../components/Courses/CourseInfoImages.tsx | 18 ++---------- .../src/components/Courses/EditSechedule.tsx | 4 +-- frontend/src/components/Courses/Sechedule.tsx | 14 ++-------- frontend/src/main.tsx | 1 - .../src/routes/_layout/Courses/AddCourse.tsx | 16 +++-------- .../src/routes/_layout/Courses/Courses.tsx | 2 -- frontend/src/routes/_layout/aboutUs.tsx | 2 +- frontend/src/routes/_layout/webSetting.tsx | 12 ++------ 15 files changed, 29 insertions(+), 118 deletions(-) diff --git a/frontend/src/client/services.ts b/frontend/src/client/services.ts index 8e3557e..0ef6a93 100644 --- a/frontend/src/client/services.ts +++ b/frontend/src/client/services.ts @@ -18,28 +18,20 @@ import type { UserUpdate, UserUpdateMe, UsersPublic, - ClientMessagePublic, ClientMessagesPublic, WebSettingPublic, WebSettingUpdate, AboutUssPublic, - AboutUsPublic, AboutUsUpdate, AboutUsCreate, CoursesPublic, CourseCreate, CourseDetailsPublic, CourseUpdate, - CoursePublic, ImagePublic, - Info_imagePublic, - SchedulePublic, ScheduleCreate, ScheduleUpdate, ImageCreate, - ImageUpdate, - Info_imagesCreate, - Info_imageUpdate, } from "./models" export type TDataLoginAccessToken = { diff --git a/frontend/src/components/AboutUs/AddAboutUs.tsx b/frontend/src/components/AboutUs/AddAboutUs.tsx index 1e6ba02..1d10985 100644 --- a/frontend/src/components/AboutUs/AddAboutUs.tsx +++ b/frontend/src/components/AboutUs/AddAboutUs.tsx @@ -1,10 +1,9 @@ -import React, { useRef, ReactNode, useState } from 'react'; +import { useRef, ReactNode, useState } from 'react'; import { Button, FormControl, FormErrorMessage, FormLabel, - Input, Modal, ModalBody, ModalCloseButton, @@ -19,16 +18,15 @@ import { NumberIncrementStepper, NumberDecrementStepper, } from "@chakra-ui/react" -import { writeFileSync, createReadStream } from "fs"; + import { useMutation, useQueryClient } from "@tanstack/react-query" import { type SubmitHandler, useForm, UseFormRegisterReturn } from "react-hook-form" import { type ApiError, type AboutUsCreate, AboutUsService } from "../../client" import useCustomToast from "../../hooks/useCustomToast" import { handleError } from "../../utils" -import { EditorState, ContentState, convertToRaw } from 'draft-js'; +import { EditorState, convertToRaw } from 'draft-js'; import { Editor } from "react-draft-wysiwyg"; import draftToHtml from 'draftjs-to-html'; -import htmlToDraft from 'html-to-draftjs'; import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; interface AddAboutUsProps { @@ -134,7 +132,7 @@ const AddAboutUs = ({ isOpen, onClose }: AddAboutUsProps) => { } mutation.mutate(data) console.log(data) - + } @@ -152,20 +150,6 @@ const AddAboutUs = ({ isOpen, onClose }: AddAboutUsProps) => { - - Title - - {errors.title && ( - {errors.title.message} - )} - { - + {errors.index && ( {errors.index.message} )} @@ -209,7 +193,7 @@ const AddAboutUs = ({ isOpen, onClose }: AddAboutUsProps) => { {'Image Upload'} - + diff --git a/frontend/src/components/AboutUs/EditAboutUs.tsx b/frontend/src/components/AboutUs/EditAboutUs.tsx index 0fe8f59..1b8c1a0 100644 --- a/frontend/src/components/AboutUs/EditAboutUs.tsx +++ b/frontend/src/components/AboutUs/EditAboutUs.tsx @@ -1,4 +1,4 @@ -import React, { useRef, ReactNode, useState } from 'react'; +import { useRef, ReactNode, useState } from 'react'; import { Button, FormControl, @@ -21,10 +21,10 @@ import { Box, Image, } from "@chakra-ui/react" -import { writeFileSync, createReadStream } from "fs"; + import { useMutation, useQueryClient } from "@tanstack/react-query" import { type SubmitHandler, useForm, UseFormRegisterReturn } from "react-hook-form" -import { type ApiError, type AboutUsCreate, AboutUsService, AboutUsUpdate, AboutUsPublic } from "../../client" +import { type ApiError, AboutUsService, AboutUsUpdate, AboutUsPublic } from "../../client" import useCustomToast from "../../hooks/useCustomToast" import { handleError } from "../../utils" import { EditorState, ContentState, convertToRaw } from 'draft-js'; diff --git a/frontend/src/components/Common/ActionsMenu.tsx b/frontend/src/components/Common/ActionsMenu.tsx index e55d8a8..76a0323 100644 --- a/frontend/src/components/Common/ActionsMenu.tsx +++ b/frontend/src/components/Common/ActionsMenu.tsx @@ -8,8 +8,8 @@ import { } from "@chakra-ui/react" import { BsThreeDotsVertical } from "react-icons/bs" import { FiEdit, FiTrash } from "react-icons/fi" -import { Link } from "@tanstack/react-router" -import type { ItemPublic, UserPublic, AboutUsPublic, AboutUsUpdate, CoursePublic, ImagePublic, SchedulePublic } from "../../client" + +import type { ItemPublic, UserPublic, AboutUsPublic, CoursePublic, ImagePublic, SchedulePublic } from "../../client" import EditUser from "../Admin/EditUser" import EditItem from "../Items/EditItem" import EditCourseImage from "../CourseImage/editCourseImage" diff --git a/frontend/src/components/CourseImage/editCourseImage.tsx b/frontend/src/components/CourseImage/editCourseImage.tsx index a67da5a..402a6ce 100644 --- a/frontend/src/components/CourseImage/editCourseImage.tsx +++ b/frontend/src/components/CourseImage/editCourseImage.tsx @@ -1,10 +1,8 @@ -import React, { useRef, ReactNode, useState } from 'react'; + import { Button, FormControl, - FormErrorMessage, FormLabel, - Input, Modal, ModalBody, ModalCloseButton, @@ -12,7 +10,6 @@ import { ModalFooter, ModalHeader, ModalOverlay, - InputGroup, NumberInput, NumberInputField, NumberInputStepper, @@ -20,7 +17,7 @@ import { NumberDecrementStepper, } from "@chakra-ui/react" import { useMutation, useQueryClient } from "@tanstack/react-query" -import { type SubmitHandler, useForm, UseFormRegisterReturn } from "react-hook-form" +import { type SubmitHandler, useForm } from "react-hook-form" import { type ApiError, ImageService, Info_imageService, ImageUpdate, ImagePublic } from "../../client" import useCustomToast from "../../hooks/useCustomToast" import { handleError } from "../../utils" diff --git a/frontend/src/components/Courses/CourseDetails.tsx b/frontend/src/components/Courses/CourseDetails.tsx index 5345f03..24daa96 100644 --- a/frontend/src/components/Courses/CourseDetails.tsx +++ b/frontend/src/components/Courses/CourseDetails.tsx @@ -5,19 +5,11 @@ import { FormLabel, Input, Textarea, - Modal, - ModalBody, - ModalCloseButton, - ModalContent, - ModalFooter, - ModalHeader, - ModalOverlay, Container, Heading, Box } from "@chakra-ui/react" -import { useQuery, useQueryClient, useMutation, QueryClient } from "@tanstack/react-query" -import { createFileRoute, useNavigate, Await, useRouter } from "@tanstack/react-router" +import { useQueryClient, useMutation } from "@tanstack/react-query" import { useEffect, useState } from "react" import useCustomToast from "../../hooks/useCustomToast" import { CoursesService, type ApiError, CourseCreate, CourseDetailsPublic } from "../../client" diff --git a/frontend/src/components/Courses/CourseImages.tsx b/frontend/src/components/Courses/CourseImages.tsx index e81807f..49ef96d 100644 --- a/frontend/src/components/Courses/CourseImages.tsx +++ b/frontend/src/components/Courses/CourseImages.tsx @@ -3,15 +3,6 @@ import { FormControl, FormErrorMessage, FormLabel, - Input, - Textarea, - Modal, - ModalBody, - ModalCloseButton, - ModalContent, - ModalFooter, - ModalHeader, - ModalOverlay, Container, Heading, Box, @@ -29,10 +20,8 @@ import { Icon, Grid } from "@chakra-ui/react" -import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query" -import { createFileRoute, useNavigate, Await, useRouter } from "@tanstack/react-router" -import { FaPlus, FaPen, FaTrashAlt } from "react-icons/fa" -import { useEffect, useState } from "react" +import { useQueryClient, useMutation } from "@tanstack/react-query" +import { useEffect } from "react" import useCustomToast from "../../hooks/useCustomToast" import { ImageService, type ApiError, CourseDetailsPublic, ImageCreate } from "../../client" import { handleError } from "../../utils" diff --git a/frontend/src/components/Courses/CourseInfoImages.tsx b/frontend/src/components/Courses/CourseInfoImages.tsx index fcd91aa..92dda93 100644 --- a/frontend/src/components/Courses/CourseInfoImages.tsx +++ b/frontend/src/components/Courses/CourseInfoImages.tsx @@ -3,15 +3,6 @@ import { FormControl, FormErrorMessage, FormLabel, - Input, - Textarea, - Modal, - ModalBody, - ModalCloseButton, - ModalContent, - ModalFooter, - ModalHeader, - ModalOverlay, Container, Heading, Box, @@ -21,18 +12,13 @@ import { NumberIncrementStepper, NumberDecrementStepper, Image, - Flex, HStack, VStack, Text, - Td, - Icon, Grid } from "@chakra-ui/react" -import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query" -import { createFileRoute, useNavigate, Await, useRouter } from "@tanstack/react-router" -import { FaPlus, FaPen, FaTrashAlt } from "react-icons/fa" -import { useEffect, useState } from "react" +import { useQueryClient, useMutation } from "@tanstack/react-query" +import { useEffect } from "react" import useCustomToast from "../../hooks/useCustomToast" import { Info_imageService, type ApiError, CourseDetailsPublic, ImageCreate } from "../../client" import { handleError } from "../../utils" diff --git a/frontend/src/components/Courses/EditSechedule.tsx b/frontend/src/components/Courses/EditSechedule.tsx index ab6c29d..841fc60 100644 --- a/frontend/src/components/Courses/EditSechedule.tsx +++ b/frontend/src/components/Courses/EditSechedule.tsx @@ -12,12 +12,12 @@ import { ModalHeader, ModalOverlay, } from "@chakra-ui/react" -import { useEffect, useState } from "react" +import {useState } from "react" import { useMutation, useQueryClient } from "@tanstack/react-query" import { type SubmitHandler, useForm } from "react-hook-form" import DateTimePicker from 'react-datetime-picker'; import 'react-calendar/dist/Calendar.css'; -import { type ApiError, type ScheduleCreate, SchedulePublic, ScheduleUpdate, secheduleService } from "../../client" +import { type ApiError, SchedulePublic, ScheduleUpdate, secheduleService } from "../../client" import useCustomToast from "../../hooks/useCustomToast" import { handleError } from "../../utils" import moment from "moment"; diff --git a/frontend/src/components/Courses/Sechedule.tsx b/frontend/src/components/Courses/Sechedule.tsx index 2309f36..04949ce 100644 --- a/frontend/src/components/Courses/Sechedule.tsx +++ b/frontend/src/components/Courses/Sechedule.tsx @@ -1,9 +1,5 @@ import { - Button, Container, - Flex, - Heading, - SkeletonText, Table, TableContainer, Tbody, @@ -13,16 +9,10 @@ import { Tr, } from "@chakra-ui/react" import moment from 'moment'; -import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query" -import { createFileRoute, useNavigate, Await, useRouter } from "@tanstack/react-router" -import { FaPlus, FaPen, FaTrashAlt } from "react-icons/fa" -import { useEffect, useState } from "react" +import { useQueryClient, } from "@tanstack/react-query" import useCustomToast from "../../hooks/useCustomToast" -import { Info_imageService, type ApiError, CourseDetailsPublic, ImageCreate } from "../../client" -import { handleError } from "../../utils" -import { type SubmitHandler, useForm } from "react-hook-form" +import { CourseDetailsPublic } from "../../client" import ActionsMenu from "../../components/Common/ActionsMenu" -import DateTimePicker from 'react-datetime-picker'; import 'react-datetime-picker/dist/DateTimePicker.css'; import Navbar from "../../components/Common/Navbar" import AddSechedule from "./AddSechedule"; diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 892cfbe..d55263c 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -3,7 +3,6 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query" import { RouterProvider, createRouter } from "@tanstack/react-router" import ReactDOM from "react-dom/client" import { routeTree } from "./routeTree.gen" -import { StrictMode } from "react" import { OpenAPI } from "./client" import theme from "./theme" diff --git a/frontend/src/routes/_layout/Courses/AddCourse.tsx b/frontend/src/routes/_layout/Courses/AddCourse.tsx index 3f578bd..ace86fc 100644 --- a/frontend/src/routes/_layout/Courses/AddCourse.tsx +++ b/frontend/src/routes/_layout/Courses/AddCourse.tsx @@ -5,26 +5,18 @@ import { FormLabel, Input, Textarea, - Modal, - ModalBody, - ModalCloseButton, - ModalContent, - ModalFooter, - ModalHeader, - ModalOverlay, Container } from "@chakra-ui/react" -import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query" -import { createFileRoute, useNavigate, Await, useRouter } from "@tanstack/react-router" -import { useEffect, useState } from "react" +import {useQueryClient, useMutation } from "@tanstack/react-query" +import { createFileRoute } from "@tanstack/react-router" +import {useState } from "react" import useCustomToast from "../../../hooks/useCustomToast" import { CoursesService, type ApiError, CourseCreate, } from "../../../client" import { handleError } from "../../../utils" import { type SubmitHandler, useForm } from "react-hook-form" -import { EditorState, ContentState, convertToRaw } from 'draft-js'; +import { EditorState, convertToRaw } from 'draft-js'; import { Editor } from "react-draft-wysiwyg"; import draftToHtml from 'draftjs-to-html'; -import htmlToDraft from 'html-to-draftjs'; import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; diff --git a/frontend/src/routes/_layout/Courses/Courses.tsx b/frontend/src/routes/_layout/Courses/Courses.tsx index 3538a49..e8b9093 100644 --- a/frontend/src/routes/_layout/Courses/Courses.tsx +++ b/frontend/src/routes/_layout/Courses/Courses.tsx @@ -21,8 +21,6 @@ import { z } from "zod" import { FaPlus, FaPen, FaTrashAlt } from "react-icons/fa" import { CoursesService } from "../../../client" import Delete from "../../../components/Common/DeleteAlert" -import ActionsMenu from "../../../components/Common/ActionsMenu" -import Navbar from "../../../components/Common/Navbar" //import Addcourse from "../../components/courses/Addcourse" import { Link } from "@tanstack/react-router" const CoursesSearchSchema = z.object({ diff --git a/frontend/src/routes/_layout/aboutUs.tsx b/frontend/src/routes/_layout/aboutUs.tsx index c5f4d60..6b628c1 100644 --- a/frontend/src/routes/_layout/aboutUs.tsx +++ b/frontend/src/routes/_layout/aboutUs.tsx @@ -14,7 +14,7 @@ import { } from "@chakra-ui/react" import { useQuery, useQueryClient } from "@tanstack/react-query" import { createFileRoute, useNavigate } from "@tanstack/react-router" -import { useEffect, useState } from "react" +import { useEffect } from "react" import { z } from "zod" import parse from 'html-react-parser'; import { AboutUsService } from "../../client" diff --git a/frontend/src/routes/_layout/webSetting.tsx b/frontend/src/routes/_layout/webSetting.tsx index e22dd15..1ae93e9 100644 --- a/frontend/src/routes/_layout/webSetting.tsx +++ b/frontend/src/routes/_layout/webSetting.tsx @@ -4,18 +4,10 @@ import { FormErrorMessage, FormLabel, Input, - Modal, - ModalBody, - ModalCloseButton, - ModalContent, - ModalFooter, - ModalHeader, - ModalOverlay, Container } from "@chakra-ui/react" -import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query" -import { createFileRoute, useNavigate, Await } from "@tanstack/react-router" -import { useEffect, useState } from "react" +import { useQueryClient, useMutation } from "@tanstack/react-query" +import { createFileRoute } from "@tanstack/react-router" import useCustomToast from "../../hooks/useCustomToast" import { WebSettingsService, type WebSettingUpdate, type ApiError, } from "../../client" import { handleError } from "../../utils"