From ff67f5daa623f7b163095141ee69a74920b51ef2 Mon Sep 17 00:00:00 2001 From: Kubosaka Date: Sat, 6 Apr 2024 23:24:09 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[fix]network=E3=81=AE=E5=89=8A=E9=99=A4?= =?UTF-8?q?=E3=80=81yml=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=A7?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E5=AE=9A=E7=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 25 +++++-------------------- view/Dockerfile | 4 ---- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index de984d7d2..2a819979f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,9 +15,6 @@ services: ports: - "3306:3306" restart: always - networks: - app_net: - ipv4_address: 192.168.176.2 view: build: ./view @@ -28,10 +25,12 @@ services: ports: - "3000:3000" stdin_open: true + environment: + NEXT_PUBLIC_ENDPOINT: minio + NEXT_PUBLIC_PORT: 9000 + NEXT_PUBLIC_BUCKET_NAME: finansu + NEXT_PUBLIC_MINIO_ENDPONT: http://localhost:9000 tty: true - networks: - app_net: - ipv4_address: 192.168.176.3 api: build: @@ -49,9 +48,6 @@ services: depends_on: db: condition: service_started - networks: - app_net: - ipv4_address: 192.168.176.4 minio: image: minio/minio:latest @@ -64,14 +60,3 @@ services: environment: MINIO_ROOT_USER: user MINIO_ROOT_PASSWORD: password - networks: - app_net: - ipv4_address: 192.168.176.5 - -networks: - app_net: - driver: bridge - ipam: - driver: default - config: - - subnet: 192.168.176.0/24 diff --git a/view/Dockerfile b/view/Dockerfile index ab6791fa2..790b52e59 100644 --- a/view/Dockerfile +++ b/view/Dockerfile @@ -5,7 +5,3 @@ WORKDIR /app/next-project COPY ./ /app ENV API_URL='http://localhost:1323' -ENV NEXT_PUBLIC_ENDPOINT='192.168.176.1' -ENV NEXT_PUBLIC_PORT=9000 -ENV NEXT_PUBLIC_BUCKET_NAME='finansu' -ENV NEXT_PUBLIC_MINIO_ENDPONT='http://localhost:9000' From 4482a0716a1111c660cf0e8666fb48da2f72c3eb Mon Sep 17 00:00:00 2001 From: Kubosaka Date: Mon, 8 Apr 2024 23:15:59 +0900 Subject: [PATCH 2/3] =?UTF-8?q?#[feat]=E6=95=99=E5=B8=AB=E3=81=AE=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=AB=E3=82=BF=E3=83=BC=E6=A9=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next-project/src/pages/teachers/index.tsx | 142 ++++++++++++------ 1 file changed, 93 insertions(+), 49 deletions(-) diff --git a/view/next-project/src/pages/teachers/index.tsx b/view/next-project/src/pages/teachers/index.tsx index 3f3d5f48c..6538e92a0 100644 --- a/view/next-project/src/pages/teachers/index.tsx +++ b/view/next-project/src/pages/teachers/index.tsx @@ -11,7 +11,7 @@ import MainLayout from '@components/layout/MainLayout'; import OpenAddModalButton from '@components/teacher/OpenAddModalButton'; import OpenDeleteModalButton from '@components/teacher/OpenDeleteModalButton'; import OpenEditModalButton from '@components/teacher/OpenEditModalButton'; -import { Teacher, User } from '@type/common'; +import { Department, Teacher, User } from '@type/common'; interface Props { teachers: Teacher[]; @@ -28,6 +28,17 @@ export const getServerSideProps = async () => { }; export default function TeachersList(props: Props) { const { teachers } = props; + const departments = [ + { + id: 0, + name: '全て', + }, + , + ...DEPARTMENTS, + ]; + const [selectedDepartment, setSelectedDepartment] = useState( + departments[0], + ); const auth = useRecoilValue(authAtom); const [currentUser, setCurrentUser] = useState(null); @@ -39,6 +50,18 @@ export default function TeachersList(props: Props) { } }, [currentUser?.roleID, currentUser?.id, currentUser]); + const [filterTeachers, setFilterTeachers] = useState(teachers); + + useEffect(() => { + const newFilterTeachers = + selectedDepartment?.id === 0 + ? teachers + : teachers.filter((teacher) => { + return teacher.departmentID === selectedDepartment?.id; + }); + setFilterTeachers(newFilterTeachers); + }, [selectedDepartment]); + useEffect(() => { const getUser = async () => { const res = await getCurrentUser(auth); @@ -55,8 +78,26 @@ export default function TeachersList(props: Props) {
-
+
+ <select + className='md:w-100 mx-auto my-4 w-fit md:mx-10 md:my-0' + value={selectedDepartment?.id} + onChange={(e) => { + const selectDepartment = departments.find((department) => { + return department?.id === Number(e.target.value); + }); + setSelectedDepartment(selectDepartment); + }} + > + {departments.map((department) => { + return ( + <option value={department?.id} key={department?.id}> + {department?.name} + </option> + ); + })} + </select> </div> <div className='hidden justify-end md:flex'> <OpenAddModalButton>教員登録</OpenAddModalButton> @@ -66,66 +107,69 @@ export default function TeachersList(props: Props) { <table className='mb-5 w-max table-auto border-collapse md:w-full'> <thead className='text-sm text-black-600'> <tr className='border border-x-white-0 border-b-primary-1 border-t-white-0 py-3'> - <th> + <th className='w-1/6'> <p>氏名</p> </th> - <th> + <th className='w-1/6'> <p>職位</p> </th> - <th> + <th className='w-1/6'> <p>学科</p> </th> - <th> + <th className='w-1/6'> <p>居室</p> </th> - <th> + <th className='w-1/6'> <p>備考</p> </th> - <th></th> + <th className='w-1/6'></th> </tr> </thead> <tbody className='border border-x-white-0 border-b-primary-1 border-t-white-0'> - {teachers.map((teacher, index) => ( - <tr - key={teacher.name} - className={clsx( - index !== teachers.length - 1 && 'border-b', - 'text-sm text-black-600', - )} - > - <td className='py-3'> - {teacher.isBlack && <p className='text-center text-red-500'>{teacher.name}</p>} - {!teacher.isBlack && <p className='text-center'>{teacher.name}</p>} - </td> - <td> - <p className='text-center'>{teacher.position}</p> - </td> - <td> - <p className='text-center'> - { - DEPARTMENTS.find((department) => department.id === teacher.departmentID) - ?.name - } - </p> - </td> - <td> - <p className='text-center'>{teacher.room}</p> - </td> - <td> - <p className='text-center'>{teacher.remark}</p> - </td> - <td> - <div className='flex items-center justify-center gap-3'> - <OpenEditModalButton - id={teacher.id || 0} - teacher={teacher} - isDisabled={isDisabled} - /> - <OpenDeleteModalButton id={teacher.id || 0} isDisabled={isDisabled} /> - </div> - </td> - </tr> - ))} + {filterTeachers && + filterTeachers.map((teacher, index) => ( + <tr + key={index} + className={clsx( + index !== teachers.length - 1 && 'border-b', + 'text-sm text-black-600', + )} + > + <td className='py-3'> + {teacher.isBlack && ( + <p className='text-center text-red-500'>{teacher.name}</p> + )} + {!teacher.isBlack && <p className='text-center'>{teacher.name}</p>} + </td> + <td> + <p className='text-center'>{teacher.position}</p> + </td> + <td> + <p className='text-center'> + { + DEPARTMENTS.find((department) => department.id === teacher.departmentID) + ?.name + } + </p> + </td> + <td> + <p className='text-center'>{teacher.room}</p> + </td> + <td> + <p className='text-center'>{teacher.remark}</p> + </td> + <td> + <div className='flex items-center justify-center gap-3'> + <OpenEditModalButton + id={teacher.id || 0} + teacher={teacher} + isDisabled={isDisabled} + /> + <OpenDeleteModalButton id={teacher.id || 0} isDisabled={isDisabled} /> + </div> + </td> + </tr> + ))} </tbody> </table> </div> From cbe1cd070255e0dc4a0c343d347ff74af0231046 Mon Sep 17 00:00:00 2001 From: Kubosaka <s223301@stn.nagaokaut.ac.jp> Date: Tue, 9 Apr 2024 11:35:57 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[fix]Eslint=E3=81=AE=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/next-project/src/pages/teachers/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/view/next-project/src/pages/teachers/index.tsx b/view/next-project/src/pages/teachers/index.tsx index 6538e92a0..4133b72aa 100644 --- a/view/next-project/src/pages/teachers/index.tsx +++ b/view/next-project/src/pages/teachers/index.tsx @@ -33,7 +33,6 @@ export default function TeachersList(props: Props) { id: 0, name: '全て', }, - , ...DEPARTMENTS, ]; const [selectedDepartment, setSelectedDepartment] = useState<Department | undefined>(