From 0822d0189694b0934b03f748641c91a2b6ee7fc0 Mon Sep 17 00:00:00 2001 From: kizahasi Date: Thu, 13 Jan 2022 23:31:24 +0900 Subject: [PATCH] =?UTF-8?q?feat(web-server):=20=E3=82=B7=E3=83=B3=E3=83=97?= =?UTF-8?q?=E3=83=AB=E3=83=AD=E3=82=B0=E5=87=BA=E5=8A=9B=E3=81=A7=E3=83=A6?= =?UTF-8?q?=E3=83=BC=E3=82=B6=E3=83=BC=E5=90=8D=E3=81=A8=E6=9B=B8=E3=81=8D?= =?UTF-8?q?=E8=BE=BC=E3=81=BF=E6=97=A5=E6=99=82=E3=82=92=E5=90=AB=E3=82=81?= =?UTF-8?q?=E3=81=AA=E3=81=84=E8=A8=AD=E5=AE=9A=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../room/message/GenerateLogModal.tsx | 33 ++++++- .../src/utils/message/generateHtml.test.ts | 9 ++ .../src/utils/message/generateHtml.ts | 32 +++++++ .../src/utils/message/roomLogGenerator.ts | 87 +++++++++++++------ 4 files changed, 135 insertions(+), 26 deletions(-) create mode 100644 apps/web-server/src/utils/message/generateHtml.test.ts create mode 100644 apps/web-server/src/utils/message/generateHtml.ts diff --git a/apps/web-server/src/components/contextual/room/message/GenerateLogModal.tsx b/apps/web-server/src/components/contextual/room/message/GenerateLogModal.tsx index 996a05060..62e5c1ee0 100644 --- a/apps/web-server/src/components/contextual/room/message/GenerateLogModal.tsx +++ b/apps/web-server/src/components/contextual/room/message/GenerateLogModal.tsx @@ -17,7 +17,7 @@ import { generateAsStaticHtml, } from '../../../../utils/message/roomLogGenerator'; import moment from 'moment'; -import { Button, Modal, Progress, Radio } from 'antd'; +import { Button, Checkbox, Modal, Progress, Radio } from 'antd'; import classNames from 'classnames'; import { flex, flexColumn } from '../../../../utils/className'; import { useApolloClient } from '@apollo/client'; @@ -63,6 +63,11 @@ export const GenerateLogModal: React.FC = ({ roomId, visible, onClose }: ); const channelsFilterOptionsRef = useReadonlyRef(channelsFilterOptions); + const [showCreatedAt, setShowCreatedAt] = React.useState(true); + const showCreatedAtRef = useReadonlyRef(showCreatedAt); + const [showUsernameAlways, setShowUsernameAlways] = React.useState(true); + const showUsernameAlwaysRef = useReadonlyRef(showUsernameAlways); + const [progress, setProgress] = React.useState(); const [errorMessage, setErrorMessage] = React.useState(); React.useEffect(() => { @@ -131,6 +136,8 @@ export const GenerateLogModal: React.FC = ({ roomId, visible, onClose }: messages: logData.data.result, participants: participantsRef.current, filter: ChannelsFilterOptions.toFilter(channelsFilterOptionsRef.current), + showCreatedAt: showCreatedAtRef.current, + showUsernameAlways: showUsernameAlwaysRef.current, }), `log_simple_${moment(new Date()).format('YYYY-MM-DD-HH-mm-ss')}.html` ); @@ -177,6 +184,8 @@ export const GenerateLogModal: React.FC = ({ roomId, visible, onClose }: channelsFilterOptionsRef, configRef, firebaseStorageRef, + showCreatedAtRef, + showUsernameAlwaysRef, ]); return ( @@ -214,6 +223,28 @@ export const GenerateLogModal: React.FC = ({ roomId, visible, onClose }: onChange={setChannelsFilterOptions} disabled={isDownloading} /> + {logMode === simple && ( + <> +
ログに含める情報
+
+ setShowUsernameAlways(e.target.checked)} + > + 常にユーザー名を含める + +
+ setShowCreatedAt(e.target.checked)} + > + 書き込み日時 + +
+ + )}