From 170b4a7f321869e35430e266bdcd1e45c3d0b7a5 Mon Sep 17 00:00:00 2001 From: ymd <74826010+ymd1138@users.noreply.github.com> Date: Fri, 31 Mar 2023 20:17:39 +0900 Subject: [PATCH 01/12] =?UTF-8?q?=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF?= =?UTF-8?q?=E3=81=AE=E9=A0=85=E7=9B=AE=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=81?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E5=B7=A6=E5=8F=B3=E3=81=AB=E4=BD=99=E7=99=BD?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 63 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index 5833873..54d72be 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -14,29 +14,49 @@ const UsersPage = ({ users }: Props) => { const [selectTypes, setSelectTypes] = useState([]); const onCheckFilter = (checked: boolean, type: TableDataType) => { if (checked) setSelectTypes([...selectTypes, type]); - else setSelectTypes(selectTypes.filter(t => t !== type)); - } + else setSelectTypes(selectTypes.filter((t) => t !== type)); + }; return ( -
- {allTableDataTypes.map(t => ( +
+ {allTableDataTypes.map((t) => ( <> - { onCheckFilter(e.target.checked, t) }} /> + { + onCheckFilter(e.target.checked, t); + }} + /> {t} ))} - +
- { - // 幅は調整中。細かい調整は後ほど。 - } - {selectTypes.indexOf("id") !== -1 ? : <>} - + {/* 幅は調整中。細かい調整は後ほど。*/} + {selectTypes.indexOf("id") !== -1 ? ( + + ) : ( + <> + )} - - + {selectTypes.indexOf("icon") !== -1 ? ( + + ) : ( + <> + )} + {selectTypes.indexOf("discord") !== -1 ? ( + + ) : ( + <> + )} @@ -56,14 +76,21 @@ const UsersPage = ({ users }: Props) => { {users.map((user) => ( {selectTypes.indexOf("id") !== -1 ? : <>} - - - + {selectTypes.indexOf("icon") !== -1 ? ( + + ) : ( + <> + )} + {selectTypes.indexOf("discord") !== -1 ? ( + + ) : ( + <> + )} From 17750ddd7b5a6eb12958331104abb21912923a83 Mon Sep 17 00:00:00 2001 From: ymd1138 <74826010+ymd1138@users.noreply.github.com> Date: Wed, 12 Apr 2023 01:46:41 +0900 Subject: [PATCH 02/12] =?UTF-8?q?=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E5=85=A8=E9=A0=85=E7=9B=AE=E3=81=AB=E5=AF=BE=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=81=E6=9C=89=E5=8A=B9=E6=9C=9F?= =?UTF-8?q?=E9=99=90=E3=81=AE=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 171 ++++++++++++++++++++++++++++++--------------- styles/globals.css | 2 +- 2 files changed, 116 insertions(+), 57 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index 54d72be..a157b06 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -8,8 +8,23 @@ type Props = { users: User[]; }; -type TableDataType = "id" | "icon" | "discord"; -const allTableDataTypes: TableDataType[] = ["id", "icon", "discord"]; +{ + /* あとでオブジェクトのリストに書き換えます */ +} +type TableDataType = + | "学籍番号" + | "公開情報" + | "有効期限・ID" + | "個人情報" + | "保護者情報"; + +const allTableDataTypes: TableDataType[] = [ + "学籍番号", + "公開情報", + "有効期限・ID", + "個人情報", + "保護者情報", +]; const UsersPage = ({ users }: Props) => { const [selectTypes, setSelectTypes] = useState([]); const onCheckFilter = (checked: boolean, type: TableDataType) => { @@ -20,14 +35,21 @@ const UsersPage = ({ users }: Props) => {
{allTableDataTypes.map((t) => ( <> - { - onCheckFilter(e.target.checked, t); - }} - /> - {t} +
+ { + onCheckFilter(e.target.checked, t); + }} + /> + +
))}
IDID学籍番号 ユーザー名 学年アイコンDiscord IDアイコンDiscord ID有効期限 自己紹介 名字
{user.id}{user.studentNumber} {user.username} {user.schoolGrade} - - {user.discordUserId} + + {user.discordUserId}{user.activeLimit} {user.shortIntroduction} {user.firstName}
{ {/* 幅は調整中。細かい調整は後ほど。*/} - {selectTypes.indexOf("id") !== -1 ? ( - + {selectTypes.indexOf("学籍番号") !== -1 ? ( + ) : ( <> )} - - - - {selectTypes.indexOf("icon") !== -1 ? ( - + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + + + + + + ) : ( + <> + )} + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + + + + + ) : ( <> )} - {selectTypes.indexOf("discord") !== -1 ? ( - + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + + + + + + + + + ) : ( + <> + )} + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + + + + + ) : ( <> )} - - - - - - - - - - - - - {users.map((user) => ( - {selectTypes.indexOf("id") !== -1 ? : <>} - - - - {selectTypes.indexOf("icon") !== -1 ? ( - + {selectTypes.indexOf("学籍番号") !== -1 ? ( + + ) : ( + <> + )} + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + + + + + + ) : ( + <> + )} + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + + + + + ) : ( + <> + )} + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + + + + + + + + ) : ( <> )} - {selectTypes.indexOf("discord") !== -1 ? ( - + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + + + + + ) : ( <> )} - - - - - - - - - - - - - ))} @@ -155,7 +214,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { schoolGrade: r.school_grade, iconUrl: r.icon_url, discordUserId: r.discord_userid, - activeLimit: r.active_limit.toString(), + activeLimit: r.active_limit.toLocaleString("ja-JP"), shortIntroduction: r.short_introduction, firstName: r.first_name, lastName: r.last_name, diff --git a/styles/globals.css b/styles/globals.css index 09dbba4..0862ae1 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -6,7 +6,7 @@ } .table-th-studentNumber{ - width: 75px; + width: 82px; } .table-th-username{ From c720d3beebc2c2a18795233d99e55cb3e3fac5fc Mon Sep 17 00:00:00 2001 From: ymd1138 <74826010+ymd1138@users.noreply.github.com> Date: Sun, 16 Apr 2023 19:39:38 +0900 Subject: [PATCH 03/12] =?UTF-8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=81=AE=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=82=92React=20Bootstrap=E3=81=B8=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 264 ++++++++++++++++++++++++------------------------ 1 file changed, 134 insertions(+), 130 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index a157b06..b994b21 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -1,6 +1,7 @@ import { queryDb } from "@/util/db"; import { GetServerSideProps } from "next"; import { useState } from "react"; +import { Form } from "react-bootstrap"; import { Table } from "react-bootstrap"; import { User } from "./api/user"; @@ -32,142 +33,145 @@ const UsersPage = ({ users }: Props) => { else setSelectTypes(selectTypes.filter((t) => t !== type)); }; return ( -
- {allTableDataTypes.map((t) => ( - <> -
- +
+ {allTableDataTypes.map((t) => ( +
+ { onCheckFilter(e.target.checked, t); }} /> -
- - ))} -
ID学籍番号学籍番号ユーザー名学年アイコンユーザー名学年アイコン自己紹介有効期限IDDiscord IDDiscord ID名字名前名字カナ名前カナ性別電話番号住所親氏名親電話番号親固定電話番号親住所有効期限自己紹介名字名前名字カナ名前カナ性別電話番号住所親氏名親電話番号親固定電話番号親住所
{user.id}{user.studentNumber}{user.username}{user.schoolGrade} - - {user.studentNumber}{user.username}{user.schoolGrade} + + {user.shortIntroduction}{user.activeLimit}{user.id}{user.discordUserId}{user.firstName}{user.lastName}{user.firstNameKana}{user.lastNameKana}{user.isMale ? "男" : "女"}{user.phoneNumber}{user.address}{user.discordUserId}{user.parentName}{user.parentCellphoneNumber}{user.parentHomephoneNumber}{user.parentAddress}{user.activeLimit}{user.shortIntroduction}{user.firstName}{user.lastName}{user.firstNameKana}{user.lastNameKana}{user.isMale ? "男" : "女"}{user.phoneNumber}{user.address}{user.parentName}{user.parentCellphoneNumber}{user.parentHomephoneNumber}{user.parentAddress}
- - - {/* 幅は調整中。細かい調整は後ほど。*/} - {selectTypes.indexOf("学籍番号") !== -1 ? ( - - ) : ( - <> - )} - {selectTypes.indexOf("公開情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("有効期限・ID") !== -1 ? ( - <> - + ))} + - - - - ) : ( - <> - )} - {selectTypes.indexOf("個人情報") !== -1 ? ( - <> - - - - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("保護者情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - - - - {users.map((user) => ( - - {selectTypes.indexOf("学籍番号") !== -1 ? ( - - ) : ( - <> - )} - {selectTypes.indexOf("公開情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("有効期限・ID") !== -1 ? ( - <> - - - - - ) : ( - <> - )} - {selectTypes.indexOf("個人情報") !== -1 ? ( - <> - - - - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("保護者情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - - ))} - -
学籍番号ユーザー名学年アイコン自己紹介有効期限IDDiscord ID名字名前名字カナ名前カナ性別電話番号住所親氏名親電話番号親固定電話番号親住所
{user.studentNumber}{user.username}{user.schoolGrade} - - {user.shortIntroduction}{user.activeLimit}{user.id}{user.discordUserId}{user.firstName}{user.lastName}{user.firstNameKana}{user.lastNameKana}{user.isMale ? "男" : "女"}{user.phoneNumber}{user.address}{user.parentName}{user.parentCellphoneNumber}{user.parentHomephoneNumber}{user.parentAddress}
-
+
+ <> + + + + {/* 幅は調整中。細かい調整は後ほど。*/} + {selectTypes.indexOf("学籍番号") !== -1 ? ( + + ) : ( + <> + )} + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + + + + + + ) : ( + <> + )} + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + + + + + ) : ( + <> + )} + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + + + + + + + + + ) : ( + <> + )} + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + + + + + + ) : ( + <> + )} + + + + {users.map((user) => ( + + {selectTypes.indexOf("学籍番号") !== -1 ? ( + + ) : ( + <> + )} + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + + + + + + ) : ( + <> + )} + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + + + + + ) : ( + <> + )} + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + + + + + + + + + ) : ( + <> + )} + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + + + + + + ) : ( + <> + )} + + ))} + +
学籍番号ユーザー名学年アイコン自己紹介有効期限IDDiscord ID名字名前名字カナ名前カナ性別電話番号住所親氏名親電話番号親固定電話番号親住所
{user.studentNumber}{user.username}{user.schoolGrade} + + {user.shortIntroduction}{user.activeLimit}{user.id}{user.discordUserId}{user.firstName}{user.lastName}{user.firstNameKana}{user.lastNameKana}{user.isMale ? "男" : "女"}{user.phoneNumber}{user.address}{user.parentName}{user.parentCellphoneNumber}{user.parentHomephoneNumber}{user.parentAddress}
+ +
+ ); }; From ce061ffb9580b959f41f0aed44decc95e7409c3a Mon Sep 17 00:00:00 2001 From: ymd1138 <74826010+ymd1138@users.noreply.github.com> Date: Sun, 16 Apr 2023 23:50:44 +0900 Subject: [PATCH 04/12] =?UTF-8?q?=E4=B8=80=E9=83=A8=E3=81=AE=E9=A0=85?= =?UTF-8?q?=E7=9B=AE=E3=81=8C=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88?= =?UTF-8?q?=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=80=81Container=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 247 +++++++++++++++++++++++++++--------------------- 1 file changed, 138 insertions(+), 109 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index b994b21..36b2ab3 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -1,6 +1,9 @@ import { queryDb } from "@/util/db"; import { GetServerSideProps } from "next"; import { useState } from "react"; +import { Container } from "react-bootstrap"; +import { Row } from "react-bootstrap"; +import { Col } from "react-bootstrap"; import { Form } from "react-bootstrap"; import { Table } from "react-bootstrap"; import { User } from "./api/user"; @@ -26,152 +29,178 @@ const allTableDataTypes: TableDataType[] = [ "個人情報", "保護者情報", ]; + +const defaultTableDataTypes: TableDataType[] = [ + "学籍番号", + "公開情報", + "有効期限・ID", +]; + const UsersPage = ({ users }: Props) => { - const [selectTypes, setSelectTypes] = useState([]); + const [selectTypes, setSelectTypes] = useState([ + ...defaultTableDataTypes, + ]); const onCheckFilter = (checked: boolean, type: TableDataType) => { if (checked) setSelectTypes([...selectTypes, type]); else setSelectTypes(selectTypes.filter((t) => t !== type)); }; return ( - <> -
- {allTableDataTypes.map((t) => ( -
- { - onCheckFilter(e.target.checked, t); - }} - /> -
- ))} -
- -
- <> - - - - {/* 幅は調整中。細かい調整は後ほど。*/} - {selectTypes.indexOf("学籍番号") !== -1 ? ( - - ) : ( - <> - )} - {selectTypes.indexOf("公開情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("有効期限・ID") !== -1 ? ( - <> - - - - - ) : ( - <> - )} - {selectTypes.indexOf("個人情報") !== -1 ? ( - <> - - - - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("保護者情報") !== -1 ? ( - <> - - - - - + + + + + {allTableDataTypes.map((t) => ( +
+ {defaultTableDataTypes.includes(t) ? ( + { + onCheckFilter(e.target.checked, t); + }} + /> ) : ( - <> + { + onCheckFilter(e.target.checked, t); + }} + /> )} - - -
- {users.map((user) => ( - + + ))} + + + + +
+ <> +
学籍番号ユーザー名学年アイコン自己紹介有効期限IDDiscord ID名字名前名字カナ名前カナ性別電話番号住所親氏名親電話番号親固定電話番号親住所
+ + + {/* 幅は調整中。細かい調整は後ほど。*/} {selectTypes.indexOf("学籍番号") !== -1 ? ( - + ) : ( <> )} {selectTypes.indexOf("公開情報") !== -1 ? ( <> - - - - + + + + ) : ( <> )} {selectTypes.indexOf("有効期限・ID") !== -1 ? ( <> - - - + + + ) : ( <> )} {selectTypes.indexOf("個人情報") !== -1 ? ( <> - - - - - - - + + + + + + + ) : ( <> )} {selectTypes.indexOf("保護者情報") !== -1 ? ( <> - - - - + + + + ) : ( <> )} - ))} - -
{user.studentNumber}学籍番号{user.username}{user.schoolGrade} - - {user.shortIntroduction}ユーザー名学年アイコン自己紹介{user.activeLimit}{user.id}{user.discordUserId}有効期限IDDiscord ID{user.firstName}{user.lastName}{user.firstNameKana}{user.lastNameKana}{user.isMale ? "男" : "女"}{user.phoneNumber}{user.address}名字名前名字カナ名前カナ性別電話番号住所{user.parentName}{user.parentCellphoneNumber}{user.parentHomephoneNumber}{user.parentAddress}親氏名親電話番号親固定電話番号親住所
- -
- + + + {users.map((user) => ( + + {selectTypes.indexOf("学籍番号") !== -1 ? ( + {user.studentNumber} + ) : ( + <> + )} + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + {user.username} + {user.schoolGrade} + + + + {user.shortIntroduction} + + ) : ( + <> + )} + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + {user.activeLimit} + {user.id} + {user.discordUserId} + + ) : ( + <> + )} + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + {user.firstName} + {user.lastName} + {user.firstNameKana} + {user.lastNameKana} + {user.isMale ? "男" : "女"} + {user.phoneNumber} + {user.address} + + ) : ( + <> + )} + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + {user.parentName} + {user.parentCellphoneNumber} + {user.parentHomephoneNumber} + {user.parentAddress} + + ) : ( + <> + )} + + ))} + + + +
+ + ); }; From e120eed9984447f06a8e59d0c1d4284e18e6da18 Mon Sep 17 00:00:00 2001 From: ymd1138 <74826010+ymd1138@users.noreply.github.com> Date: Mon, 17 Apr 2023 00:07:21 +0900 Subject: [PATCH 05/12] =?UTF-8?q?=E3=82=BB=E3=83=9F=E3=82=B3=E3=83=AD?= =?UTF-8?q?=E3=83=B3=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/_app.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/_app.tsx b/pages/_app.tsx index d13473c..bf22044 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -7,7 +7,7 @@ export default function App({ Component, pageProps }: AppProps) { return ( <>
- ; + ); } From 437fd96cede038fbc41cadff32955fb2258e42c3 Mon Sep 17 00:00:00 2001 From: ymd1138 <74826010+ymd1138@users.noreply.github.com> Date: Sat, 29 Apr 2023 01:10:13 +0900 Subject: [PATCH 06/12] =?UTF-8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=82=92=E6=A8=AA=E4=B8=A6?= =?UTF-8?q?=E3=81=B3=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=80=81import=E3=81=AEcur?= =?UTF-8?q?ly=20brackets=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 244 +++++++++++++++++++++++------------------------- 1 file changed, 115 insertions(+), 129 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index 36b2ab3..a08fa0a 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -1,11 +1,11 @@ import { queryDb } from "@/util/db"; import { GetServerSideProps } from "next"; import { useState } from "react"; -import { Container } from "react-bootstrap"; -import { Row } from "react-bootstrap"; -import { Col } from "react-bootstrap"; -import { Form } from "react-bootstrap"; -import { Table } from "react-bootstrap"; +import Container from "react-bootstrap/Container"; +import Row from "react-bootstrap/Row"; +import Col from "react-bootstrap/Col"; +import Form from "react-bootstrap/Form"; +import Table from "react-bootstrap/Table"; import { User } from "./api/user"; type Props = { @@ -15,26 +15,16 @@ type Props = { { /* あとでオブジェクトのリストに書き換えます */ } -type TableDataType = - | "学籍番号" - | "公開情報" - | "有効期限・ID" - | "個人情報" - | "保護者情報"; +type TableDataType = "公開情報" | "有効期限・ID" | "個人情報" | "保護者情報"; const allTableDataTypes: TableDataType[] = [ - "学籍番号", "公開情報", "有効期限・ID", "個人情報", "保護者情報", ]; -const defaultTableDataTypes: TableDataType[] = [ - "学籍番号", - "公開情報", - "有効期限・ID", -]; +const defaultTableDataTypes: TableDataType[] = ["公開情報", "有効期限・ID"]; const UsersPage = ({ users }: Props) => { const [selectTypes, setSelectTypes] = useState([ @@ -45,162 +35,158 @@ const UsersPage = ({ users }: Props) => { else setSelectTypes(selectTypes.filter((t) => t !== type)); }; return ( - - - -
+ <> + + +
{allTableDataTypes.map((t) => ( -
+ <> {defaultTableDataTypes.includes(t) ? ( { onCheckFilter(e.target.checked, t); }} /> ) : ( { onCheckFilter(e.target.checked, t); }} /> )} -
+ ))} - - - - -
- <> - - - - {/* 幅は調整中。細かい調整は後ほど。*/} - {selectTypes.indexOf("学籍番号") !== -1 ? ( + + + +
+ <> +
+ + + {/* 幅は調整中。細かい調整は後ほど。*/} - ) : ( - <> - )} - {selectTypes.indexOf("公開情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("有効期限・ID") !== -1 ? ( - <> - - - - - ) : ( - <> - )} - {selectTypes.indexOf("個人情報") !== -1 ? ( - <> - - - - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("保護者情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - - - - {users.map((user) => ( - - {selectTypes.indexOf("学籍番号") !== -1 ? ( - - ) : ( - <> - )} {selectTypes.indexOf("公開情報") !== -1 ? ( <> - - - - + + + + ) : ( <> )} {selectTypes.indexOf("有効期限・ID") !== -1 ? ( <> - - - + + + ) : ( <> )} {selectTypes.indexOf("個人情報") !== -1 ? ( <> - - - - - - - + + + + + + + ) : ( <> )} {selectTypes.indexOf("保護者情報") !== -1 ? ( <> - - - - + + + + ) : ( <> )} - ))} - -
学籍番号ユーザー名学年アイコン自己紹介有効期限IDDiscord ID名字名前名字カナ名前カナ性別電話番号住所親氏名親電話番号親固定電話番号親住所
{user.studentNumber}{user.username}{user.schoolGrade} - - {user.shortIntroduction}ユーザー名学年アイコン自己紹介{user.activeLimit}{user.id}{user.discordUserId}有効期限IDDiscord ID{user.firstName}{user.lastName}{user.firstNameKana}{user.lastNameKana}{user.isMale ? "男" : "女"}{user.phoneNumber}{user.address}名字名前名字カナ名前カナ性別電話番号住所{user.parentName}{user.parentCellphoneNumber}{user.parentHomephoneNumber}{user.parentAddress}親氏名親電話番号親固定電話番号親住所
- -
-
- + + + {users.map((user) => ( + + {user.studentNumber} + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + {user.username} + {user.schoolGrade} + + + + {user.shortIntroduction} + + ) : ( + <> + )} + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + {user.activeLimit} + {user.id} + {user.discordUserId} + + ) : ( + <> + )} + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + {user.firstName} + {user.lastName} + {user.firstNameKana} + {user.lastNameKana} + {user.isMale ? "男" : "女"} + {user.phoneNumber} + {user.address} + + ) : ( + <> + )} + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + {user.parentName} + {user.parentCellphoneNumber} + {user.parentHomephoneNumber} + {user.parentAddress} + + ) : ( + <> + )} + + ))} + + + +
+
+
+ ); }; From 4717367063296df6b43a71ff192724d71bcfc7f8 Mon Sep 17 00:00:00 2001 From: ymd1138 <74826010+ymd1138@users.noreply.github.com> Date: Sat, 29 Apr 2023 01:46:42 +0900 Subject: [PATCH 07/12] =?UTF-8?q?defaultChecked=E3=81=AE=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=82=92=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=B0=E3=80=81margin=E3=82=92padding?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=80=81=E3=81=AA=E3=81=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 281 ++++++++++++++++++++++-------------------------- 1 file changed, 131 insertions(+), 150 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index a08fa0a..31930d1 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -35,158 +35,139 @@ const UsersPage = ({ users }: Props) => { else setSelectTypes(selectTypes.filter((t) => t !== type)); }; return ( - <> - - -
- {allTableDataTypes.map((t) => ( - <> - {defaultTableDataTypes.includes(t) ? ( - { - onCheckFilter(e.target.checked, t); - }} - /> + + +
+ {allTableDataTypes.map((t) => ( + { + onCheckFilter(e.target.checked, t); + }} + /> + ))} +
+
+ +
+ + + + {/* 幅は調整中。細かい調整は後ほど。*/} + + + + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + + + ) : ( - { - onCheckFilter(e.target.checked, t); - }} - /> + <> )} - - ))} - - - -
- <> -
学籍番号ユーザー名学年アイコン自己紹介
- - - {/* 幅は調整中。細かい調整は後ほど。*/} - - {selectTypes.indexOf("公開情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("有効期限・ID") !== -1 ? ( - <> - - - - - ) : ( - <> - )} - {selectTypes.indexOf("個人情報") !== -1 ? ( - <> - - - - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("保護者情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - - - - {users.map((user) => ( - - - {selectTypes.indexOf("公開情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("有効期限・ID") !== -1 ? ( - <> - - - - - ) : ( - <> - )} - {selectTypes.indexOf("個人情報") !== -1 ? ( - <> - - - - - - - - - ) : ( - <> - )} - {selectTypes.indexOf("保護者情報") !== -1 ? ( - <> - - - - - - ) : ( - <> - )} - - ))} - -
学籍番号ユーザー名学年アイコン自己紹介有効期限IDDiscord ID名字名前名字カナ名前カナ性別電話番号住所親氏名親電話番号親固定電話番号親住所
{user.studentNumber}{user.username}{user.schoolGrade} - - {user.shortIntroduction}{user.activeLimit}{user.id}{user.discordUserId}{user.firstName}{user.lastName}{user.firstNameKana}{user.lastNameKana}{user.isMale ? "男" : "女"}{user.phoneNumber}{user.address}{user.parentName}{user.parentCellphoneNumber}{user.parentHomephoneNumber}{user.parentAddress}
- -
-
-
- + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + 有効期限 + ID + Discord ID + + ) : ( + <> + )} + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + 名字 + 名前 + 名字カナ + 名前カナ + 性別 + 電話番号 + 住所 + + ) : ( + <> + )} + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + 親氏名 + 親電話番号 + 親固定電話番号 + 親住所 + + ) : ( + <> + )} + + + + {users.map((user) => ( + + {user.studentNumber} + {user.username} + {user.schoolGrade} + {selectTypes.indexOf("公開情報") !== -1 ? ( + <> + + + + {user.shortIntroduction} + + ) : ( + <> + )} + {selectTypes.indexOf("有効期限・ID") !== -1 ? ( + <> + {user.activeLimit} + {user.id} + {user.discordUserId} + + ) : ( + <> + )} + {selectTypes.indexOf("個人情報") !== -1 ? ( + <> + {user.firstName} + {user.lastName} + {user.firstNameKana} + {user.lastNameKana} + {user.isMale ? "男" : "女"} + {user.phoneNumber} + {user.address} + + ) : ( + <> + )} + {selectTypes.indexOf("保護者情報") !== -1 ? ( + <> + {user.parentName} + {user.parentCellphoneNumber} + {user.parentHomephoneNumber} + {user.parentAddress} + + ) : ( + <> + )} + + ))} + + +
+
+
); }; From 0bf8200f129fa3bb70343a3fdf3c7f4ce6e1d752 Mon Sep 17 00:00:00 2001 From: ymd1138 <74826010+ymd1138@users.noreply.github.com> Date: Sat, 29 Apr 2023 16:34:27 +0900 Subject: [PATCH 08/12] =?UTF-8?q?CSS=E3=82=92Inline=20Styles=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 40 ++++++++++++++++++++++++++++------------ styles/globals.css | 25 ------------------------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index 31930d1..3d79495 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -26,6 +26,22 @@ const allTableDataTypes: TableDataType[] = [ const defaultTableDataTypes: TableDataType[] = ["公開情報", "有効期限・ID"]; +const kanjiNameStyle = { + width: "100px", +}; + +const kanaNameStyle = { + width: "125px", +}; + +const phoneNumberStyle = { + width: "115px", +}; + +const addressStyle = { + width: "200px", +}; + const UsersPage = ({ users }: Props) => { const [selectTypes, setSelectTypes] = useState([ ...defaultTableDataTypes, @@ -64,13 +80,13 @@ const UsersPage = ({ users }: Props) => { {/* 幅は調整中。細かい調整は後ほど。*/} - 学籍番号 - ユーザー名 + 学籍番号 + ユーザー名 学年 {selectTypes.indexOf("公開情報") !== -1 ? ( <> アイコン - 自己紹介 + 自己紹介 ) : ( <> @@ -86,13 +102,13 @@ const UsersPage = ({ users }: Props) => { )} {selectTypes.indexOf("個人情報") !== -1 ? ( <> - 名字 - 名前 - 名字カナ - 名前カナ + 名字 + 名前 + 名字カナ + 名前カナ 性別 - 電話番号 - 住所 + 電話番号 + 住所 ) : ( <> @@ -100,9 +116,9 @@ const UsersPage = ({ users }: Props) => { {selectTypes.indexOf("保護者情報") !== -1 ? ( <> 親氏名 - 親電話番号 - 親固定電話番号 - 親住所 + 親電話番号 + 親固定電話番号 + 親住所 ) : ( <> diff --git a/styles/globals.css b/styles/globals.css index 0862ae1..d94d416 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -1,30 +1,5 @@ - * { box-sizing: border-box; padding: 0; margin: 0; } - -.table-th-studentNumber{ - width: 82px; -} - -.table-th-username{ - width: 125px; -} - -.table-th-name{ - width: 100px; -} - -.table-th-name-kana{ - width: 125px; -} - -.table-th-phoneNumber{ - width: 115px; -} - -.table-th-address{ - width: 250px; -} \ No newline at end of file From 62926b0d8fc895142eeea66bf6e26d584dcf42e7 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Mon, 1 May 2023 17:26:15 +0900 Subject: [PATCH 09/12] =?UTF-8?q?=E3=83=A1=E3=83=A2=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=80=81import=E3=82=92=E6=9C=80=E9=81=A9=E3=81=AB?= =?UTF-8?q?=E3=80=81=E5=B9=85=E8=A1=A8=E8=A8=98=E3=82=92=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index 3d79495..f6bb7a1 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -1,20 +1,12 @@ import { queryDb } from "@/util/db"; import { GetServerSideProps } from "next"; import { useState } from "react"; -import Container from "react-bootstrap/Container"; -import Row from "react-bootstrap/Row"; -import Col from "react-bootstrap/Col"; -import Form from "react-bootstrap/Form"; -import Table from "react-bootstrap/Table"; +import { Container, Row, Form, Table } from "react-bootstrap"; import { User } from "./api/user"; type Props = { users: User[]; }; - -{ - /* あとでオブジェクトのリストに書き換えます */ -} type TableDataType = "公開情報" | "有効期限・ID" | "個人情報" | "保護者情報"; const allTableDataTypes: TableDataType[] = [ @@ -79,10 +71,9 @@ const UsersPage = ({ users }: Props) => { > - {/* 幅は調整中。細かい調整は後ほど。*/} - 学籍番号 - ユーザー名 - 学年 + 学籍番号 + ユーザー名 + 学年 {selectTypes.indexOf("公開情報") !== -1 ? ( <> アイコン @@ -93,9 +84,9 @@ const UsersPage = ({ users }: Props) => { )} {selectTypes.indexOf("有効期限・ID") !== -1 ? ( <> - 有効期限 - ID - Discord ID + 有効期限 + ID + Discord ID ) : ( <> @@ -106,7 +97,7 @@ const UsersPage = ({ users }: Props) => { 名前 名字カナ 名前カナ - 性別 + 性別 電話番号 住所 @@ -115,7 +106,7 @@ const UsersPage = ({ users }: Props) => { )} {selectTypes.indexOf("保護者情報") !== -1 ? ( <> - 親氏名 + 親氏名 親電話番号 親固定電話番号 親住所 From afa9c63b468a65d53fa892114fad13ff48fdec6a Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Mon, 1 May 2023 17:42:11 +0900 Subject: [PATCH 10/12] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E5=87=A6=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/serverinfo.tsx | 43 ++++++++++---- pages/users.tsx | 138 ++++++++++++++++++++++++------------------- 2 files changed, 106 insertions(+), 75 deletions(-) diff --git a/pages/serverinfo.tsx b/pages/serverinfo.tsx index e8b257d..ddfc886 100644 --- a/pages/serverinfo.tsx +++ b/pages/serverinfo.tsx @@ -5,9 +5,18 @@ import { Container, Row, Table } from "react-bootstrap"; type Props = { dbMbSizes: { name: string; mbSize: number }[]; storageMbSize: number; + error?: string; }; -const ServerInfoPage = ({ dbMbSizes }: Props) => { +const ServerInfoPage = ({ dbMbSizes, error }: Props) => { + if (error) + return ( + + +

{error}

+
+
+ ); return ( @@ -36,7 +45,8 @@ const ServerInfoPage = ({ dbMbSizes }: Props) => { export default ServerInfoPage; export const getServerSideProps: GetServerSideProps = async (context) => { - const rows = await queryDb(`SELECT + try { + const rows = await queryDb(`SELECT table_schema, sum(data_length+index_length) /1024 /1024 AS MB FROM information_schema.tables @@ -44,16 +54,23 @@ GROUP BY table_schema ORDER BY sum(data_length+index_length) DESC;`); - const dbMbSizes = rows.map((r) => { - return { name: r.TABLE_SCHEMA, mbSize: r.MB }; - }); - console.log(dbMbSizes); - const props: Props = { - dbMbSizes, - storageMbSize: 0, - }; + const dbMbSizes = rows.map((r) => { + return { name: r.TABLE_SCHEMA, mbSize: r.MB }; + }); + console.log(dbMbSizes); + const props: Props = { + dbMbSizes, + storageMbSize: 0, + }; - return { - props: props, - }; + return { + props: props, + }; + } catch (e: any) { + return { + props: { + error: e.message, + }, + }; + } }; diff --git a/pages/users.tsx b/pages/users.tsx index f6bb7a1..ca6a88f 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -6,6 +6,7 @@ import { User } from "./api/user"; type Props = { users: User[]; + error?: string; }; type TableDataType = "公開情報" | "有効期限・ID" | "個人情報" | "保護者情報"; @@ -34,7 +35,7 @@ const addressStyle = { width: "200px", }; -const UsersPage = ({ users }: Props) => { +const UsersPage = ({ users, error }: Props) => { const [selectTypes, setSelectTypes] = useState([ ...defaultTableDataTypes, ]); @@ -44,6 +45,13 @@ const UsersPage = ({ users }: Props) => { }; return ( + {error ? ( + +

{error}

+
+ ) : ( + <> + )}
{allTableDataTypes.map((t) => ( @@ -181,67 +189,73 @@ const UsersPage = ({ users }: Props) => { export default UsersPage; export const getServerSideProps: GetServerSideProps = async (context) => { - const rows = await queryDb( - `SELECT - BIN_TO_UUID(users.id) as id, - student_number, - username, - school_grade, - icon_url, - discord_userid, - active_limit, - short_introduction, - first_name, - last_name, - first_name_kana, - last_name_kana, - is_male, - phone_number, - address, - parent_name, - parent_cellphone_number, - parent_homephone_number, - parent_address - FROM - users - LEFT JOIN - user_profiles - ON - users.id=user_profiles.user_id - LEFT JOIN - user_private_profiles - ON - users.id=user_private_profiles.user_id` - ); - const users: User[] = rows.map((r) => { - return { - id: r.id, - studentNumber: r.student_number, - username: r.username, - schoolGrade: r.school_grade, - iconUrl: r.icon_url, - discordUserId: r.discord_userid, - activeLimit: r.active_limit.toLocaleString("ja-JP"), - shortIntroduction: r.short_introduction, - firstName: r.first_name, - lastName: r.last_name, - firstNameKana: r.first_name_kana, - lastNameKana: r.last_name_kana, - isMale: r.is_male == 1 ? true : false, - phoneNumber: r.phone_number, - address: r.address, - parentName: r.parent_name, - parentCellphoneNumber: r.parent_cellphone_number, - parentHomephoneNumber: r.parent_homephone_number, - parentAddress: r.parent_address, - }; - }); + try { + const rows = await queryDb( + `SELECT + BIN_TO_UUID(users.id) as id, + student_number, + username, + school_grade, + icon_url, + discord_userid, + active_limit, + short_introduction, + first_name, + last_name, + first_name_kana, + last_name_kana, + is_male, + phone_number, + address, + parent_name, + parent_cellphone_number, + parent_homephone_number, + parent_address + FROM + users + LEFT JOIN + user_profiles + ON + users.id=user_profiles.user_id + LEFT JOIN + user_private_profiles + ON + users.id=user_private_profiles.user_id` + ); + const users: User[] = rows.map((r) => { + return { + id: r.id, + studentNumber: r.student_number, + username: r.username, + schoolGrade: r.school_grade, + iconUrl: r.icon_url, + discordUserId: r.discord_userid, + activeLimit: r.active_limit.toLocaleString("ja-JP"), + shortIntroduction: r.short_introduction, + firstName: r.first_name, + lastName: r.last_name, + firstNameKana: r.first_name_kana, + lastNameKana: r.last_name_kana, + isMale: r.is_male == 1 ? true : false, + phoneNumber: r.phone_number, + address: r.address, + parentName: r.parent_name, + parentCellphoneNumber: r.parent_cellphone_number, + parentHomephoneNumber: r.parent_homephone_number, + parentAddress: r.parent_address, + }; + }); - const props: Props = { - users, - }; + const props: Props = { + users, + }; - return { - props: props, - }; + return { + props: props, + }; + } catch (e: any) { + return { + props: { users: [], error: e.message }, + }; + } }; From f4cc05808899f1e2db278dd150032fa5ecd59d49 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Mon, 1 May 2023 17:44:30 +0900 Subject: [PATCH 11/12] =?UTF-8?q?discordUserId=E3=81=AE=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E5=B9=85=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/users.tsx b/pages/users.tsx index ca6a88f..b178235 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -94,7 +94,7 @@ const UsersPage = ({ users, error }: Props) => { <> 有効期限 ID - Discord ID + Discord ID ) : ( <> From e5a502160e1f2b24abe21e85ce2212a2f42db341 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Mon, 1 May 2023 17:45:53 +0900 Subject: [PATCH 12/12] =?UTF-8?q?style=E3=81=AEwidth=E3=81=ABpx=E3=81=8C?= =?UTF-8?q?=E3=81=A4=E3=81=91=E5=BF=98=E3=82=8C=E3=81=A6=E3=81=84=E3=82=8B?= =?UTF-8?q?=E9=83=A8=E5=88=86=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/users.tsx b/pages/users.tsx index b178235..cac55ae 100644 --- a/pages/users.tsx +++ b/pages/users.tsx @@ -84,8 +84,8 @@ const UsersPage = ({ users, error }: Props) => { 学年 {selectTypes.indexOf("公開情報") !== -1 ? ( <> - アイコン - 自己紹介 + アイコン + 自己紹介 ) : ( <>