Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

refactor(app): show report answers as a timeline, tidy the page

Hampusa81069d10caa
diff --git a/fluxer_app/src/features/moderation/components/pages/ReportPage.tsx b/fluxer_app/src/features/moderation/components/pages/ReportPage.tsx
index 17c17f0fc..efaf85c47 100644
--- a/fluxer_app/src/features/moderation/components/pages/ReportPage.tsx
+++ b/fluxer_app/src/features/moderation/components/pages/ReportPage.tsx
@@ -119,7 +119,7 @@ const THE_VERIFICATION_CODE_IS_INVALID_OR_EXPIRED_DESCRIPTOR = msg({
comment: 'Inline error on the verification step of the DSA report flow when the entered code is rejected.',
});
const YOU_MUST_VERIFY_YOUR_EMAIL_BEFORE_SENDING_A_DESCRIPTOR = msg({
- message: 'You must verify your email before sending a report.',
+ message: 'You must confirm your email before sending a report.',
comment:
'Inline error on the details step of the DSA report flow when the user has not completed email verification.',
});
@@ -751,7 +751,7 @@ export const ReportPage = observer(() => {
)}
</div>
);
- if (RuntimeConfig.usesUsernameSignIn) {
+ if (!RuntimeConfig.emailsEnabled) {
return (
<div className={styles.page} dir={getLocaleDirection(locale)} data-flx="moderation.report-page.page">
<div className={styles.mainColumn} data-flx="moderation.report-page.main-column">
diff --git a/fluxer_app/src/features/moderation/components/report/ReportStepSelection.tsx b/fluxer_app/src/features/moderation/components/report/ReportStepSelection.tsx
index 0914f3ad2..322cc0be0 100644
--- a/fluxer_app/src/features/moderation/components/report/ReportStepSelection.tsx
+++ b/fluxer_app/src/features/moderation/components/report/ReportStepSelection.tsx
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
-import {getLocaleDirection} from '@app/features/i18n/utils/LocaleDirection';
import styles from '@app/features/moderation/components/pages/ReportPage.module.css';
import type {ReportType} from '@app/features/moderation/components/report/ReportTypes';
import type {RadioOption} from '@app/features/ui/radio_group/RadioGroup';
@@ -41,7 +40,6 @@ export const ReportStepSelection: React.FC<Props> = ({reportTypeOptions, selecte
options={reportTypeOptions}
value={selectedType}
onChange={onSelect}
- dir={getLocaleDirection(i18n.locale)}
aria-label={i18n._(REPORT_TYPE_DESCRIPTOR)}
data-flx="moderation.report.report-step-selection.radio-group.select"
/>
diff --git a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.module.css b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.module.css
index eed438694..7db86214a 100644
--- a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.module.css
+++ b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.module.css
@@ -66,10 +66,6 @@
color: var(--text-primary-muted);
}
-[dir='rtl'] .chevron {
- transform: scaleX(-1);
-}
-
.srOnly {
position: absolute;
width: 0.0625rem;
diff --git a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.tsx b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.tsx
index c72cea6f3..309ea2160 100644
--- a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.tsx
+++ b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowOptionList.tsx
@@ -4,10 +4,10 @@ import {OPENS_IN_NEW_TAB_DESCRIPTOR} from '@app/features/moderation/components/r
import styles from '@app/features/moderation/components/report_flow/ReportFlowOptionList.module.css';
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
import FocusRing from '@app/features/ui/focus_ring/FocusRing';
+import {CaretRightIcon} from '@app/features/ui/icons/DirectionalIcons';
import type {ReportFlowOption} from '@fluxer/schema/src/domains/report/ReportFlowSchemas';
import {useLingui} from '@lingui/react/macro';
-import {ArrowSquareOutIcon, CaretRightIcon} from '@phosphor-icons/react';
-import clsx from 'clsx';
+import {ArrowSquareOutIcon} from '@phosphor-icons/react';
import type React from 'react';
interface ReportFlowOptionListProps {
@@ -50,7 +50,7 @@ export const ReportFlowOptionList: React.FC<ReportFlowOptionListProps> = ({optio
</>
) : (
<CaretRightIcon
- className={clsx(styles.icon, styles.chevron)}
+ className={styles.icon}
weight="bold"
size={remFromPx(18)}
aria-hidden={true}
diff --git a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.module.css b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.module.css
index 6ce083777..977272d95 100644
--- a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.module.css
+++ b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.module.css
@@ -26,54 +26,3 @@
font-weight: 600;
line-height: 1.25rem;
}
-
-.answers {
- display: flex;
- flex-direction: column;
- gap: 0.5rem;
- margin: 0;
- padding: 0;
- list-style: none;
-}
-
-.answer {
- position: relative;
- display: flex;
- padding-inline-start: 1rem;
- color: var(--text-primary);
- font-size: 0.875rem;
- line-height: 1.25rem;
-}
-
-.answer::before {
- position: absolute;
- top: 0.5rem;
- inset-inline-start: 0.125rem;
- width: 0.375rem;
- height: 0.375rem;
- border-radius: var(--radius-full);
- background-color: var(--brand-primary-light);
- content: '';
-}
-
-:global(.theme-light) .answer::before {
- background-color: var(--brand-primary);
-}
-
-.answer:not(:last-child)::after {
- position: absolute;
- top: 0.875rem;
- bottom: -0.625rem;
- inset-inline-start: 0.25rem;
- width: 0.125rem;
- border-radius: var(--radius-full);
- background-color: var(--background-header-secondary);
- content: '';
-}
-
-.answerText {
- display: -webkit-box;
- overflow: hidden;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
-}
diff --git a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.tsx b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.tsx
index e97906079..a8b20ca6e 100644
--- a/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.tsx
+++ b/fluxer_app/src/features/moderation/components/report_flow/ReportFlowSummary.tsx
@@ -8,6 +8,7 @@ import {
} from '@app/features/moderation/components/report_flow/ReportFlowCopy';
import styles from '@app/features/moderation/components/report_flow/ReportFlowSummary.module.css';
import {getReportFlowAnswerLabels} from '@app/features/moderation/components/report_flow/ReportFlowWalk';
+import {TimelineList} from '@app/features/ui/timeline_list/TimelineList';
import type {ReportFlowResponse, ReportFlowStep} from '@fluxer/schema/src/domains/report/ReportFlowSchemas';
import {Trans, useLingui} from '@lingui/react/macro';
import type React from 'react';
@@ -24,22 +25,12 @@ export const ReportFlowAnswerList: React.FC<{flow: ReportFlowResponse; steps: Re
flow,
steps,
}) => (
- <ol className={styles.answers} data-flx="moderation.report-flow.report-flow-summary.report-flow-answer-list.answers">
- {getReportFlowAnswerLabels(flow, steps).map((label, index) => (
- <li
- key={`${index}:${label}`}
- className={styles.answer}
- data-flx="moderation.report-flow.report-flow-summary.report-flow-answer-list.answer"
- >
- <span
- className={styles.answerText}
- data-flx="moderation.report-flow.report-flow-summary.report-flow-answer-list.answer-text"
- >
- {label}
- </span>
- </li>
- ))}
- </ol>
+ <TimelineList
+ ordered
+ clampLines
+ items={getReportFlowAnswerLabels(flow, steps).map((label, index) => ({key: `${index}:${label}`, content: label}))}
+ data-flx="moderation.report-flow.report-flow-summary.report-flow-answer-list.answers"
+ />
);
export const ReportFlowSummary: React.FC<ReportFlowSummaryProps> = ({flow, steps, urgent, previewHeading, preview}) => {
@@ -52,7 +43,7 @@ export const ReportFlowSummary: React.FC<ReportFlowSummaryProps> = ({flow, steps
<Trans comment="Report flow: good-faith statement on the summary screen. The linked text opens the community guidelines.">
Only report what you honestly believe breaks the rules. Misusing reports goes against our{' '}
<ExternalLink href={guidelinesUrl} data-flx="moderation.report-flow.report-flow-summary.external-link">
- Community Guidelines
+ community guidelines
</ExternalLink>
.
</Trans>
diff --git a/fluxer_app/src/features/ui/timeline_list/TimelineList.module.css b/fluxer_app/src/features/ui/timeline_list/TimelineList.module.css
new file mode 100644
index 000000000..33c1f0458
--- /dev/null
+++ b/fluxer_app/src/features/ui/timeline_list/TimelineList.module.css
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: AGPL-3.0-or-later */
+
+.list {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.item {
+ position: relative;
+ display: flex;
+ padding-inline-start: 1rem;
+ color: var(--text-primary);
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+}
+
+.item::before {
+ position: absolute;
+ top: 0.5rem;
+ inset-inline-start: 0.125rem;
+ width: 0.375rem;
+ height: 0.375rem;
+ border-radius: var(--radius-full);
+ background-color: var(--brand-primary-light);
+ content: '';
+}
+
+:global(.theme-light) .item::before {
+ background-color: var(--brand-primary);
+}
+
+.item:not(:last-child)::after {
+ position: absolute;
+ top: 0.875rem;
+ bottom: -0.625rem;
+ inset-inline-start: 0.25rem;
+ width: 0.125rem;
+ border-radius: var(--radius-full);
+ background-color: var(--background-header-secondary);
+ content: '';
+}
+
+.text {
+ min-width: 0;
+}
+
+.clamped {
+ display: -webkit-box;
+ overflow: hidden;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+}
diff --git a/fluxer_app/src/features/ui/timeline_list/TimelineList.tsx b/fluxer_app/src/features/ui/timeline_list/TimelineList.tsx
new file mode 100644
index 000000000..5e4254078
--- /dev/null
+++ b/fluxer_app/src/features/ui/timeline_list/TimelineList.tsx
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import styles from '@app/features/ui/timeline_list/TimelineList.module.css';
+import {clsx} from 'clsx';
+import type React from 'react';
+
+interface TimelineListItem {
+ key: string;
+ content: React.ReactNode;
+}
+
+interface TimelineListProps {
+ items: ReadonlyArray<TimelineListItem>;
+ ordered?: boolean;
+ clampLines?: boolean;
+ className?: string;
+ 'data-flx'?: string;
+}
+
+export const TimelineList: React.FC<TimelineListProps> = ({
+ items,
+ ordered = false,
+ clampLines = false,
+ className,
+ 'data-flx': dataFlx,
+}) => {
+ const List = ordered ? 'ol' : 'ul';
+ return (
+ <List className={clsx(styles.list, className)} data-flx={dataFlx ?? 'ui.timeline-list.timeline-list.list'}>
+ {items.map((item) => (
+ <li key={item.key} className={styles.item} data-flx="ui.timeline-list.timeline-list.item">
+ <span
+ className={clsx(styles.text, clampLines && styles.clamped)}
+ data-flx="ui.timeline-list.timeline-list.text"
+ >
+ {item.content}
+ </span>
+ </li>
+ ))}
+ </List>
+ );
+};