From 5ef9a93371b0ba2309ebd0ffdaea27ebda52d4ed Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 27 Nov 2022 13:12:40 -0600 Subject: [PATCH 1/4] Admin Reports: restyle with Tailwind --- app/soapbox/components/ui/text/text.tsx | 2 +- .../admin/components/report-status.tsx | 96 +++---------------- .../features/admin/components/report.tsx | 87 ++++++++++------- app/soapbox/features/admin/tabs/reports.tsx | 1 + app/styles/components/admin.scss | 80 ---------------- 5 files changed, 68 insertions(+), 198 deletions(-) diff --git a/app/soapbox/components/ui/text/text.tsx b/app/soapbox/components/ui/text/text.tsx index 221c070fc..973d0c8b2 100644 --- a/app/soapbox/components/ui/text/text.tsx +++ b/app/soapbox/components/ui/text/text.tsx @@ -51,7 +51,7 @@ const families = { }; export type Sizes = keyof typeof sizes -type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' +type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'blockquote' type Directions = 'ltr' | 'rtl' interface IText extends Pick, 'dangerouslySetInnerHTML' | 'tabIndex' | 'lang'> { diff --git a/app/soapbox/features/admin/components/report-status.tsx b/app/soapbox/features/admin/components/report-status.tsx index f81deeab7..d990d8e81 100644 --- a/app/soapbox/features/admin/components/report-status.tsx +++ b/app/soapbox/features/admin/components/report-status.tsx @@ -1,16 +1,14 @@ -import noop from 'lodash/noop'; import React from 'react'; import { useIntl, defineMessages } from 'react-intl'; -import { openModal } from 'soapbox/actions/modals'; import { deleteStatusModal } from 'soapbox/actions/moderation'; import StatusContent from 'soapbox/components/status-content'; +import StatusMedia from 'soapbox/components/status-media'; +import { HStack, Stack } from 'soapbox/components/ui'; import DropdownMenu from 'soapbox/containers/dropdown-menu-container'; -import Bundle from 'soapbox/features/ui/components/bundle'; -import { MediaGallery, Video, Audio } from 'soapbox/features/ui/util/async-components'; import { useAppDispatch } from 'soapbox/hooks'; -import type { AdminReport, Attachment, Status } from 'soapbox/types/entities'; +import type { AdminReport, Status } from 'soapbox/types/entities'; const messages = defineMessages({ viewStatus: { id: 'admin.reports.actions.view_status', defaultMessage: 'View post' }, @@ -26,10 +24,6 @@ const ReportStatus: React.FC = ({ status }) => { const intl = useIntl(); const dispatch = useAppDispatch(); - const handleOpenMedia = (media: Attachment, index: number) => { - dispatch(openModal('MEDIA', { media, status, index })); - }; - const handleDeleteStatus = () => { dispatch(deleteStatusModal(intl, status.id)); }; @@ -49,84 +43,20 @@ const ReportStatus: React.FC = ({ status }) => { }]; }; - const getMedia = () => { - const firstAttachment = status.media_attachments.get(0); - - if (firstAttachment) { - if (status.media_attachments.some(item => item.type === 'unknown')) { - // Do nothing - } else if (firstAttachment.type === 'video') { - const video = firstAttachment; - - return ( - - {(Component: any) => ( - - )} - - ); - } else if (firstAttachment.type === 'audio') { - const audio = firstAttachment; - - return ( - - {(Component: any) => ( - - )} - - ); - } else { - return ( - - {(Component: any) => ( - - )} - - ); - } - } - - return null; - }; - - const media = getMedia(); const menu = makeMenu(); return ( -
-
+ + - {media} -
-
- -
-
+ + + + + ); }; diff --git a/app/soapbox/features/admin/components/report.tsx b/app/soapbox/features/admin/components/report.tsx index 4c37b7b61..605eea32c 100644 --- a/app/soapbox/features/admin/components/report.tsx +++ b/app/soapbox/features/admin/components/report.tsx @@ -7,7 +7,7 @@ import { deactivateUserModal, deleteUserModal } from 'soapbox/actions/moderation import snackbar from 'soapbox/actions/snackbar'; import Avatar from 'soapbox/components/avatar'; import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper'; -import { Accordion, Button, HStack } from 'soapbox/components/ui'; +import { Accordion, Button, Stack, HStack, Text } from 'soapbox/components/ui'; import DropdownMenu from 'soapbox/containers/dropdown-menu-container'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import { makeGetReport } from 'soapbox/selectors'; @@ -82,49 +82,68 @@ const Report: React.FC = ({ id }) => { const reporterAcct = account.acct as string; return ( -
-
- - - - - -
-
-

+ + + + + + + + + + @{acct} ) }} /> -

-
- {statusCount > 0 && ( - - {statuses.map(status => )} - - )} -
-
+ + + {statusCount > 0 && ( + + + {statuses.map(status => ( + + ))} + + + )} + + {(report.comment || '').length > 0 && ( -
+ )} - - — - - @{reporterAcct} + + + + + + + @{reporterAcct} + - -
-
+ + + +
+ ); }; diff --git a/app/soapbox/features/admin/tabs/reports.tsx b/app/soapbox/features/admin/tabs/reports.tsx index 8975fff5c..d066f34e1 100644 --- a/app/soapbox/features/admin/tabs/reports.tsx +++ b/app/soapbox/features/admin/tabs/reports.tsx @@ -35,6 +35,7 @@ const Reports: React.FC = () => { showLoading={showLoading} scrollKey='admin-reports' emptyMessage={intl.formatMessage(messages.emptyMessage)} + className='divide-y divide-solid divide-gray-200 dark:divide-gray-800' > {reports.map(report => report && )} diff --git a/app/styles/components/admin.scss b/app/styles/components/admin.scss index 302baa4e1..bba02ffe8 100644 --- a/app/styles/components/admin.scss +++ b/app/styles/components/admin.scss @@ -56,86 +56,6 @@ } } -.admin-report { - padding: 15px; - display: flex; - border-bottom: 1px solid var(--brand-color--faint); - - &__content { - padding: 0 16px; - flex: 1; - overflow: hidden; - } - - &__title { - font-weight: bold; - text-overflow: ellipsis; - overflow: hidden; - } - - &__quote { - font-size: 14px; - - a { - color: var(--brand-color--hicontrast); - } - - .byline { - font-size: 12px; - - a { - text-decoration: none; - } - } - } - - &__actions { - display: flex; - align-items: center; - height: fit-content; - margin-left: auto; - - .icon-button { - padding-left: 10px; - - > div { - display: flex; - align-items: center; - justify-content: center; - - > .svg-icon { - height: 20px; - width: 20px; - } - } - } - } - - &__status-content { - overflow: hidden; - } - - &__status { - display: flex; - border-bottom: 1px solid var(--accent-color--med); - padding: 10px 0; - - &:last-child { - border: 0; - } - - .status__content { - flex: 1; - padding: 0; - } - - &-actions { - padding: 3px 10px; - margin-left: auto; - } - } -} - .logentry { padding: 15px; From 92053cefb0970367bbbf80f89839ca226e8b8fff Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 27 Nov 2022 13:23:43 -0600 Subject: [PATCH 2/4] Admin Report: use better icons for 'deactivate' and 'delete' --- app/soapbox/features/admin/components/report.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/soapbox/features/admin/components/report.tsx b/app/soapbox/features/admin/components/report.tsx index 605eea32c..09e111dc8 100644 --- a/app/soapbox/features/admin/components/report.tsx +++ b/app/soapbox/features/admin/components/report.tsx @@ -44,13 +44,14 @@ const Report: React.FC = ({ id }) => { const makeMenu = () => { return [{ - text: intl.formatMessage(messages.deactivateUser, { name: targetAccount.username as string }), + text: intl.formatMessage(messages.deactivateUser, { name: targetAccount.username }), action: handleDeactivateUser, - icon: require('@tabler/icons/user-off.svg'), + icon: require('@tabler/icons/hourglass-empty.svg'), }, { - text: intl.formatMessage(messages.deleteUser, { name: targetAccount.username as string }), + text: intl.formatMessage(messages.deleteUser, { name: targetAccount.username }), action: handleDeleteUser, - icon: require('@tabler/icons/user-minus.svg'), + icon: require('@tabler/icons/trash.svg'), + destructive: true, }]; }; From 946545f86921b88ecf26f5a2f8f95aae8b06836b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 27 Nov 2022 13:33:41 -0600 Subject: [PATCH 3/4] Admin Report: fix report flowing off screen on mobile --- app/soapbox/features/admin/components/report.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/soapbox/features/admin/components/report.tsx b/app/soapbox/features/admin/components/report.tsx index 09e111dc8..4669e4d34 100644 --- a/app/soapbox/features/admin/components/report.tsx +++ b/app/soapbox/features/admin/components/report.tsx @@ -91,7 +91,7 @@ const Report: React.FC = ({ id }) => { - + = ({ id }) => { - + From f87cf765b334eceb9c7278a4dfb8e52c9dc7cc05 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 28 Nov 2022 09:41:19 -0600 Subject: [PATCH 4/4] Admin Reports: fix overflow issues --- .../features/admin/components/report-status.tsx | 12 +++++++----- app/soapbox/features/admin/components/report.tsx | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/soapbox/features/admin/components/report-status.tsx b/app/soapbox/features/admin/components/report-status.tsx index d990d8e81..3caacd1a8 100644 --- a/app/soapbox/features/admin/components/report-status.tsx +++ b/app/soapbox/features/admin/components/report-status.tsx @@ -47,15 +47,17 @@ const ReportStatus: React.FC = ({ status }) => { return ( - + - +
+ +
); }; diff --git a/app/soapbox/features/admin/components/report.tsx b/app/soapbox/features/admin/components/report.tsx index 4669e4d34..3bf550419 100644 --- a/app/soapbox/features/admin/components/report.tsx +++ b/app/soapbox/features/admin/components/report.tsx @@ -90,7 +90,7 @@ const Report: React.FC = ({ id }) => { - +