From 2a21d24f44e7f25d60e2399084c45938f96a1573 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Fri, 13 Jan 2023 10:26:54 +0900 Subject: [PATCH 01/16] =?UTF-8?q?=E5=80=8B=E4=BA=BA=E3=81=AE=E6=97=A5?= =?UTF-8?q?=E5=A0=B1=E4=B8=80=E8=A6=A7=E3=82=92=E3=83=97=E3=83=A9=E3=82=AF?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=82=B9=E3=81=A7=E7=B5=9E=E3=82=8A=E8=BE=BC?= =?UTF-8?q?=E3=82=81=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/reports/index.html.slim | 6 ++++++ test/system/user/reports_test.rb | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/app/views/users/reports/index.html.slim b/app/views/users/reports/index.html.slim index 67cfa6c8aa9..c08859e9967 100644 --- a/app/views/users/reports/index.html.slim +++ b/app/views/users/reports/index.html.slim @@ -6,4 +6,10 @@ .page-body .container.is-md + .page-filter.form + = form_with url: user_reports_path, local: true, method: 'get' + .form-item.is-inline-md-up + = label_tag :practice_id, 'プラクティスで絞り込む', class: 'a-form-label' + = select_tag :practice_id, options_from_collection_for_select(current_user.practices, :id, :title, selected: params[:practice_id]), include_blank: '全ての日報を表示', onchange: 'this.form.submit()', id: 'js-choices-single-select' + div(data-vue="Reports" data-vue-user-id:number="#{params[:user_id]}") diff --git a/test/system/user/reports_test.rb b/test/system/user/reports_test.rb index c7d2b50ddc6..8fadf15d300 100644 --- a/test/system/user/reports_test.rb +++ b/test/system/user/reports_test.rb @@ -8,6 +8,24 @@ class User::ReportsTest < ApplicationSystemTestCase assert_equal 'hatsuno 日報 | FBC', title end + test 'can use select box to filter user reports by practice' do + visit_with_auth "/users/#{users(:hajime).id}/reports", 'kimura' + + expected_reports = users(:hajime).reports + displayed_reports_count = all('.card-list-item-title__link').count + assert_equal expected_reports.count, displayed_reports_count + + find('.choices__inner').click + find('#choices--js-choices-single-select-item-choice-3', text: 'Terminalの基礎を覚える').click + assert_text 'Terminalの基礎を覚える' + + expected_reports = Practice.find_by(title: 'Terminalの基礎を覚える').reports.where(user: users(:hajime)) + displayed_reports_count = all('.card-list-item-title__link').count + assert_equal expected_reports.count, displayed_reports_count + + assert_text expected_reports.first.title + end + test 'cannot access other users download reports' do visit_with_auth "/users/#{users(:hatsuno).id}/reports.md", 'kimura' assert_text '自分以外の日報はダウンロードすることができません' From 3cfb370c2d9ea6b0563a2bbcfb20cf810245e772 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Sat, 28 Jan 2023 17:17:25 +0900 Subject: [PATCH 02/16] =?UTF-8?q?=E5=80=8B=E4=BA=BA=E3=81=AE=E6=97=A5?= =?UTF-8?q?=E5=A0=B1=E4=B8=80=E8=A6=A7=E3=82=92Vue=E3=81=8B=E3=82=89React?= =?UTF-8?q?=E3=81=AB=E7=BD=AE=E3=81=8D=E6=8F=9B=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/CommentUserIcon.jsx | 9 ++ app/javascript/components/Report.jsx | 122 ++++++++++++++++++ app/javascript/components/Reports.jsx | 85 ++++++++++++ app/views/users/reports/index.html.slim | 8 +- 4 files changed, 217 insertions(+), 7 deletions(-) create mode 100644 app/javascript/components/CommentUserIcon.jsx create mode 100644 app/javascript/components/Report.jsx create mode 100644 app/javascript/components/Reports.jsx diff --git a/app/javascript/components/CommentUserIcon.jsx b/app/javascript/components/CommentUserIcon.jsx new file mode 100644 index 00000000000..130297fde13 --- /dev/null +++ b/app/javascript/components/CommentUserIcon.jsx @@ -0,0 +1,9 @@ +import React from 'react' + +export default function CommentUserIcon({comment}) { + return ( + + + + ) +} diff --git a/app/javascript/components/Report.jsx b/app/javascript/components/Report.jsx new file mode 100644 index 00000000000..676b4887ffa --- /dev/null +++ b/app/javascript/components/Report.jsx @@ -0,0 +1,122 @@ +import React from 'react' +import CommentUserIcon from './CommentUserIcon' + +export default function Report({report, currentUser}){ + return ( +
+
+
+ + + {report.user.login_name} + + +
+
+
+
+
+ {report.wip && ( +
+ WIP +
+ )} +

+ + {report.emotion} + {report.title} + +

+ {(currentUser.id === report.user.id) && ( + + )} +
+
+
+
+
+
+ +
+ +
+
+
+ {(report.hasAnyComments) && ( + + )} +
+
+ {report.hascheck && ( +
+

確認済

+ +
+
{ report.checkUserName }
+
+
+ )} +
+
+ ) +} + +const ReportListItemActions = ({ report }) => { + return ( +
+ +
+ +
+ + +
+
+
+ ) +} + +const ReportListComment = ({ report }) => { + return ( + <> +
+
+
+
+
+
コメント({ report.numberOfComments })
+
+
+
+ {report.comments.map((comment) => { + return ( + + ) + })} +
+
+
+ +
+
+
+
+
+ + ) +} diff --git a/app/javascript/components/Reports.jsx b/app/javascript/components/Reports.jsx new file mode 100644 index 00000000000..1969d65a34c --- /dev/null +++ b/app/javascript/components/Reports.jsx @@ -0,0 +1,85 @@ +import React, { useState, useEffect } from 'react' +import useSWR from 'swr' +import queryString from 'query-string' +import fetcher from '../fetcher' +import LoadingListPlaceholder from './LoadingListPlaceholder' +import Report from './Report' +import Pagination from './Pagination' + +export default function Reports({user, currentUser}) { + const per = 20 + const neighbours = 4 + const defaultPage = parseInt(queryString.parse(location.search).page) || 1 + const [page, setPage] = useState(defaultPage) + + useEffect(() => { + setPage(page) + }, [page]) + + const { data, error } = useSWR(`/api/reports.json?user_id=${user.id}&page=${page}`, fetcher) + + const handlePaginate = (p) => { + setPage(p) + window.history.pushState(null, null, `/events?page=${p}`) + } + + if (error) return <>エラーが発生しました。 + if (!data) { + return ( +
+ +
+ ) + } + + if (data.totalPages === 0){ + return + } else { + return ( +
+ {data.totalPages > 1 && ( + handlePaginate(e.page)} + /> + )} +
    +
    + {data.reports.map((report) => { + return ( + + ) + })} +
    +
+ {data.totalPages > 1 && ( + handlePaginate(e.page)} + /> + )} +
+ ) + } +} + +const NoReports = () => { + return ( +
+
+ +

日報はまだありません。

+
+
+ ) +} diff --git a/app/views/users/reports/index.html.slim b/app/views/users/reports/index.html.slim index c08859e9967..8b15c1a784f 100644 --- a/app/views/users/reports/index.html.slim +++ b/app/views/users/reports/index.html.slim @@ -6,10 +6,4 @@ .page-body .container.is-md - .page-filter.form - = form_with url: user_reports_path, local: true, method: 'get' - .form-item.is-inline-md-up - = label_tag :practice_id, 'プラクティスで絞り込む', class: 'a-form-label' - = select_tag :practice_id, options_from_collection_for_select(current_user.practices, :id, :title, selected: params[:practice_id]), include_blank: '全ての日報を表示', onchange: 'this.form.submit()', id: 'js-choices-single-select' - - div(data-vue="Reports" data-vue-user-id:number="#{params[:user_id]}") + = react_component("Reports" , user: @user, currentUser: current_user) From d561f2b271ceffa2809d664c6ea96f7a10873b27 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Sun, 29 Jan 2023 12:48:52 +0900 Subject: [PATCH 03/16] =?UTF-8?q?=E3=83=97=E3=83=AB=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=82=92=E4=BB=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/Reports.jsx | 125 ++++++++++++++++-------- app/views/users/reports/index.html.slim | 2 +- 2 files changed, 86 insertions(+), 41 deletions(-) diff --git a/app/javascript/components/Reports.jsx b/app/javascript/components/Reports.jsx index 1969d65a34c..666b24e52ce 100644 --- a/app/javascript/components/Reports.jsx +++ b/app/javascript/components/Reports.jsx @@ -6,17 +6,22 @@ import LoadingListPlaceholder from './LoadingListPlaceholder' import Report from './Report' import Pagination from './Pagination' -export default function Reports({user, currentUser}) { +export default function Reports({user, currentUser, practices}) { const per = 20 const neighbours = 4 const defaultPage = parseInt(queryString.parse(location.search).page) || 1 const [page, setPage] = useState(defaultPage) + const [practiceId, setPracticeId] = useState('') useEffect(() => { setPage(page) }, [page]) + + useEffect(() => { + setPracticeId(practiceId) + }, [practiceId]) - const { data, error } = useSWR(`/api/reports.json?user_id=${user.id}&page=${page}`, fetcher) + const { data, error } = useSWR(`/api/reports.json?user_id=${user.id}&page=${page}&practice_id=${practiceId}`, fetcher) const handlePaginate = (p) => { setPage(p) @@ -32,45 +37,53 @@ export default function Reports({user, currentUser}) { ) } - if (data.totalPages === 0){ - return - } else { - return ( -
- {data.totalPages > 1 && ( - handlePaginate(e.page)} - /> - )} -
    -
    - {data.reports.map((report) => { - return ( - - ) - })} -
    -
- {data.totalPages > 1 && ( - handlePaginate(e.page)} - /> - )} + return ( + <> + + {(data.totalPages === 0) && } + {(data.totalPages > 0) && ( +
+
+ {data.totalPages > 1 && ( + handlePaginate(e.page)} + /> + )} +
    +
    + {data.reports.map((report) => { + return ( + + ) + })} +
    +
+ {data.totalPages > 1 && ( + handlePaginate(e.page)} + /> + )} +
- ) - } + ) + } + + ) } const NoReports = () => { @@ -83,3 +96,35 @@ const NoReports = () => {
) } + +const DropDown = ({practices, setPracticeId}) => { + const [selectValue, setSelectValue] = useState(''); + const onChange = (event) => { + const value = event.target.value + setSelectValue(value) + setPracticeId(value) + }; + return ( + <> + + + ) +} diff --git a/app/views/users/reports/index.html.slim b/app/views/users/reports/index.html.slim index 8b15c1a784f..e9720401742 100644 --- a/app/views/users/reports/index.html.slim +++ b/app/views/users/reports/index.html.slim @@ -6,4 +6,4 @@ .page-body .container.is-md - = react_component("Reports" , user: @user, currentUser: current_user) + = react_component("Reports" , user: @user, currentUser: current_user, practices: @user.practices) From daae2167bce7cfa00ad03564989ca311fb891d2d Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Sun, 29 Jan 2023 14:09:17 +0900 Subject: [PATCH 04/16] =?UTF-8?q?rubocop=E3=81=AE=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/reports/index.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/reports/index.html.slim b/app/views/users/reports/index.html.slim index e9720401742..be152904070 100644 --- a/app/views/users/reports/index.html.slim +++ b/app/views/users/reports/index.html.slim @@ -6,4 +6,4 @@ .page-body .container.is-md - = react_component("Reports" , user: @user, currentUser: current_user, practices: @user.practices) + = react_component('Reports' , user: @user, currentUser: current_user, practices: @user.practices) From 7c141af9c64e5c56b737c72ab0a3aeba8a61bb67 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:47:35 +0900 Subject: [PATCH 05/16] =?UTF-8?q?lint=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/reports/index.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/reports/index.html.slim b/app/views/users/reports/index.html.slim index be152904070..fd310d4deee 100644 --- a/app/views/users/reports/index.html.slim +++ b/app/views/users/reports/index.html.slim @@ -6,4 +6,4 @@ .page-body .container.is-md - = react_component('Reports' , user: @user, currentUser: current_user, practices: @user.practices) + = react_component('Reports', user: @user, currentUser: current_user, practices: @user.practices) From 5d9daad41b0640b48b431372420173305c348be0 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Fri, 3 Feb 2023 15:18:20 +0900 Subject: [PATCH 06/16] =?UTF-8?q?Choices.js=E3=82=92=E5=88=A9=E7=94=A8?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=83=97=E3=83=AB=E3=83=80=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=82=92=E4=BB=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/Reports.jsx | 71 ++++++++++++++++++--------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/app/javascript/components/Reports.jsx b/app/javascript/components/Reports.jsx index 666b24e52ce..2925ff12d5a 100644 --- a/app/javascript/components/Reports.jsx +++ b/app/javascript/components/Reports.jsx @@ -1,10 +1,11 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect, useRef } from 'react' import useSWR from 'swr' import queryString from 'query-string' import fetcher from '../fetcher' import LoadingListPlaceholder from './LoadingListPlaceholder' import Report from './Report' import Pagination from './Pagination' +import Choices from "choices.js"; export default function Reports({user, currentUser, practices}) { const per = 20 @@ -23,11 +24,6 @@ export default function Reports({user, currentUser, practices}) { const { data, error } = useSWR(`/api/reports.json?user_id=${user.id}&page=${page}&practice_id=${practiceId}`, fetcher) - const handlePaginate = (p) => { - setPage(p) - window.history.pushState(null, null, `/events?page=${p}`) - } - if (error) return <>エラーが発生しました。 if (!data) { return ( @@ -42,6 +38,7 @@ export default function Reports({user, currentUser, practices}) { {(data.totalPages === 0) && } {(data.totalPages > 0) && ( @@ -53,7 +50,7 @@ export default function Reports({user, currentUser, practices}) { per={per} neighbours={neighbours} page={page} - onChange={e => handlePaginate(e.page)} + onChange={e => setPage(e.page)} /> )}
    @@ -75,7 +72,7 @@ export default function Reports({user, currentUser, practices}) { per={per} neighbours={neighbours} page={page} - onChange={e => handlePaginate(e.page)} + onChange={e => setPage(e.page)} /> )} @@ -97,31 +94,57 @@ const NoReports = () => { ) } -const DropDown = ({practices, setPracticeId}) => { - const [selectValue, setSelectValue] = useState(''); +const DropDown = ({practices, setPracticeId, practiceId}) => { + const [selectedId, setSelectedId] = useState(practiceId) + const onChange = (event) => { const value = event.target.value - setSelectValue(value) + setSelectedId(value) setPracticeId(value) }; + + const selectRef = useRef(null); + + useEffect(() => { + const selectElement = selectRef.current; + const choicesInstance = new Choices(selectElement, { + searchEnabled: true, + allowHTML: true, + searchResultLimit: 20, + searchPlaceholderValue: '検索ワード', + noResultsText: '一致する情報は見つかりません', + itemSelectText: '選択', + shouldSort: false + }); + + return () => { + choicesInstance.destroy(); + }; + }, []); + return ( <> From dd7c24eabf5043f98b02272737893d56dc48125e Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Fri, 3 Feb 2023 15:42:16 +0900 Subject: [PATCH 07/16] =?UTF-8?q?CSS=E3=81=AE=E3=82=AF=E3=83=A9=E3=82=B9?= =?UTF-8?q?=E3=81=A8=E3=80=81=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=AE=E9=85=8D=E7=BD=AE=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/Reports.jsx | 56 ++++++++++++++----------- app/views/users/reports/index.html.slim | 3 +- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/app/javascript/components/Reports.jsx b/app/javascript/components/Reports.jsx index 2925ff12d5a..63921162e2e 100644 --- a/app/javascript/components/Reports.jsx +++ b/app/javascript/components/Reports.jsx @@ -35,14 +35,23 @@ export default function Reports({user, currentUser, practices}) { return ( <> - - {(data.totalPages === 0) && } + {(data.totalPages === 0) && ( +
    + + +
    + )} {(data.totalPages > 0) && (
    +
    {data.totalPages > 1 && ( { diff --git a/app/views/users/reports/index.html.slim b/app/views/users/reports/index.html.slim index fd310d4deee..e057bebff85 100644 --- a/app/views/users/reports/index.html.slim +++ b/app/views/users/reports/index.html.slim @@ -5,5 +5,4 @@ = render 'users/page_tabs', user: @user .page-body - .container.is-md - = react_component('Reports', user: @user, currentUser: current_user, practices: @user.practices) + = react_component('Reports', user: @user, currentUser: current_user, practices: @user.practices) From 1f69daf117037c8767d0763e5521ef08c121fbc9 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Fri, 3 Feb 2023 19:13:38 +0900 Subject: [PATCH 08/16] =?UTF-8?q?jsx=E3=81=AEfor=E3=82=92htmlFor=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/Report.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/components/Report.jsx b/app/javascript/components/Report.jsx index 676b4887ffa..98ff46dcaba 100644 --- a/app/javascript/components/Report.jsx +++ b/app/javascript/components/Report.jsx @@ -68,7 +68,7 @@ export default function Report({report, currentUser}){ const ReportListItemActions = ({ report }) => { return (
    - +
    @@ -84,7 +84,7 @@ const ReportListItemActions = ({ report }) => {
- + From 163e288c48b75655d172950a4666a7c3810b9079 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:10:29 +0900 Subject: [PATCH 09/16] =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=B7=A8=E9=9B=86?= =?UTF-8?q?=E3=83=BB=E3=82=B3=E3=83=94=E3=83=BC=E3=81=AE=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=AF=E3=81=8C=E7=84=A1=E5=8A=B9=E3=81=AB=E3=81=AA=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/report.vue | 4 ++-- app/views/api/reports/_report.json.jbuilder | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/javascript/components/report.vue b/app/javascript/components/report.vue index 90cf42df67f..33e2579e2ef 100644 --- a/app/javascript/components/report.vue +++ b/app/javascript/components/report.vue @@ -30,11 +30,11 @@ .card-list-item-actions__inner ul.card-list-item-actions__items li.card-list-item-actions__item - a.card-list-item-actions__action(:href='report.editURL') + a.card-list-item-actions__action(:href='report.editPath') i.fa-solid.fa-pen | 内容変更 li.card-list-item-actions__item - a.card-list-item-actions__action(:href='report.newURL') + a.card-list-item-actions__action(:href='report.newPath') i.fa-solid.fa-copy | コピー label.a-overlay(:for='report.id') diff --git a/app/views/api/reports/_report.json.jbuilder b/app/views/api/reports/_report.json.jbuilder index 15f401fb220..8aac763affc 100644 --- a/app/views/api/reports/_report.json.jbuilder +++ b/app/views/api/reports/_report.json.jbuilder @@ -2,7 +2,9 @@ json.id report.id json.title report.title json.reportedOn l(report.reported_on) json.url report_url(report) -json.editURL edit_report_path(report) -json.newURL new_report_path(id: report) +json.editPath edit_report_path(report) +json.newPath new_report_path(id: report) +json.editURL edit_report_url(report) +json.newURL new_report_url(id: report) json.wip report.wip? json.emotion report.emotion From ef46f369fc076e8e5ed12bf2e1fe3ce91f3740c1 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:14:11 +0900 Subject: [PATCH 10/16] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E9=83=A8=E5=88=86=E3=82=92=E5=88=A5=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE=E3=82=B3=E3=83=B3=E3=83=9D?= =?UTF-8?q?=E3=83=BC=E3=83=8D=E3=83=B3=E3=83=88=E3=81=AB=E5=88=87=E3=82=8A?= =?UTF-8?q?=E5=87=BA=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/Report.jsx | 36 ++-------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/app/javascript/components/Report.jsx b/app/javascript/components/Report.jsx index 98ff46dcaba..22ba0c0bba3 100644 --- a/app/javascript/components/Report.jsx +++ b/app/javascript/components/Report.jsx @@ -1,5 +1,5 @@ import React from 'react' -import CommentUserIcon from './CommentUserIcon' +import ListComment from './ListComment' export default function Report({report, currentUser}){ return ( @@ -46,9 +46,7 @@ export default function Report({report, currentUser}){ - {(report.hasAnyComments) && ( - - )} + {report.hasAnyComments && } {report.hascheck && ( @@ -90,33 +88,3 @@ const ReportListItemActions = ({ report }) => { ) } - -const ReportListComment = ({ report }) => { - return ( - <> -
-
-
-
-
-
コメント({ report.numberOfComments })
-
-
-
- {report.comments.map((comment) => { - return ( - - ) - })} -
-
-
- -
-
-
-
-
- - ) -} From ac88ae08233ee43641f2c6af7f097c5d79d70d6c Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:17:13 +0900 Subject: [PATCH 11/16] lint --- app/javascript/components/Report.jsx | 46 +++++++++++++++++++--------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/app/javascript/components/Report.jsx b/app/javascript/components/Report.jsx index 22ba0c0bba3..7e7e99b38b8 100644 --- a/app/javascript/components/Report.jsx +++ b/app/javascript/components/Report.jsx @@ -1,14 +1,19 @@ import React from 'react' import ListComment from './ListComment' -export default function Report({report, currentUser}){ +export default function Report({ report, currentUser }) { return ( -
+
@@ -22,12 +27,18 @@ export default function Report({report, currentUser}){
)}

- - {report.emotion} + + {report.emotion} {report.title}

- {(currentUser.id === report.user.id) && ( + {currentUser.id === report.user.id && ( )}
@@ -38,11 +49,11 @@ export default function Report({report, currentUser}){
- +
@@ -52,9 +63,11 @@ export default function Report({report, currentUser}){ {report.hascheck && (

確認済

- +
-
{ report.checkUserName }
+
{report.checkUserName}
)} @@ -66,18 +79,23 @@ export default function Report({report, currentUser}){ const ReportListItemActions = ({ report }) => { return (
- +
  • - + 内容変更
  • - + コピー
  • From 93a76a2a9d224d6ee8098304e35f10436990d817 Mon Sep 17 00:00:00 2001 From: peno022 <40317050+peno022@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:17:46 +0900 Subject: [PATCH 12/16] =?UTF-8?q?=E7=A2=BA=E8=AA=8D=E6=B8=88=E3=81=BF?= =?UTF-8?q?=E5=88=A4=E5=AE=9A=E3=81=AE=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E8=AA=A4=E3=82=8A=E3=81=8C=E3=81=82=E3=82=8A=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/Report.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/components/Report.jsx b/app/javascript/components/Report.jsx index 7e7e99b38b8..3be342a57bc 100644 --- a/app/javascript/components/Report.jsx +++ b/app/javascript/components/Report.jsx @@ -60,7 +60,7 @@ export default function Report({ report, currentUser }) { {report.hasAnyComments && }
- {report.hascheck && ( + {report.hasCheck && (

確認済