From 40376e4576e8f241dca87b254b72b62be98c554e Mon Sep 17 00:00:00 2001 From: mkljczk Date: Thu, 5 Dec 2024 14:10:17 +0100 Subject: [PATCH] pl-fe: add some feedback on deleted post, remove unused feature Signed-off-by: mkljczk --- packages/pl-fe/src/actions/statuses.ts | 8 +------ packages/pl-fe/src/components/account.tsx | 11 ---------- packages/pl-fe/src/components/status.tsx | 22 ++++++++----------- .../notifications/components/notification.tsx | 7 +----- .../status/components/thread-status.tsx | 15 +++++++++++++ packages/pl-fe/src/normalizers/status.ts | 1 + packages/pl-fe/src/reducers/statuses.ts | 8 +++++++ 7 files changed, 35 insertions(+), 37 deletions(-) diff --git a/packages/pl-fe/src/actions/statuses.ts b/packages/pl-fe/src/actions/statuses.ts index 7b9bf2817..882df2302 100644 --- a/packages/pl-fe/src/actions/statuses.ts +++ b/packages/pl-fe/src/actions/statuses.ts @@ -171,13 +171,7 @@ const unmuteStatus = (statusId: string) => }; const toggleMuteStatus = (status: Pick) => - (dispatch: AppDispatch) => { - if (status.muted) { - dispatch(unmuteStatus(status.id)); - } else { - dispatch(muteStatus(status.id)); - } - }; + status.muted ? unmuteStatus(status.id) : muteStatus(status.id); // let TRANSLATIONS_QUEUE: Set = new Set(); // let TRANSLATIONS_TIMEOUT: NodeJS.Timeout | null = null; diff --git a/packages/pl-fe/src/components/account.tsx b/packages/pl-fe/src/components/account.tsx index ba4434a90..c0cb0211b 100644 --- a/packages/pl-fe/src/components/account.tsx +++ b/packages/pl-fe/src/components/account.tsx @@ -85,7 +85,6 @@ interface IAccount { /** Override other actions for specificity like mute/unmute. */ actionType?: 'muting' | 'blocking' | 'follow_request' | 'biting'; avatarSize?: number; - hidden?: boolean; hideActions?: boolean; id?: string; onActionClick?: (account: AccountSchema) => void; @@ -115,7 +114,6 @@ const Account = ({ actionTitle, actionAlignment = 'center', avatarSize = 42, - hidden = false, hideActions = false, onActionClick, showAccountHoverCard = true, @@ -181,15 +179,6 @@ const Account = ({ return null; } - if (hidden) { - return ( - <> - {account.display_name} - {account.username} - - ); - } - if (withDate) timestamp = account.created_at; const LinkEl: any = withLinkToProfile ? Link : 'div'; diff --git a/packages/pl-fe/src/components/status.tsx b/packages/pl-fe/src/components/status.tsx index 2a0296326..234bf4517 100644 --- a/packages/pl-fe/src/components/status.tsx +++ b/packages/pl-fe/src/components/status.tsx @@ -29,6 +29,7 @@ import StatusLanguagePicker from './status-language-picker'; import StatusReactionsBar from './status-reactions-bar'; import StatusReplyMentions from './status-reply-mentions'; import StatusInfo from './statuses/status-info'; +import Tombstone from './tombstone'; const messages = defineMessages({ reblogged_by: { id: 'status.reblogged_by', defaultMessage: '{name} reposted' }, @@ -40,7 +41,6 @@ interface IStatus { status: SelectedStatus; onClick?: () => void; muted?: boolean; - hidden?: boolean; unread?: boolean; onMoveUp?: (statusId: string, featured?: boolean) => void; onMoveDown?: (statusId: string, featured?: boolean) => void; @@ -65,7 +65,6 @@ const Status: React.FC = (props) => { onMoveUp, onMoveDown, muted, - hidden, featured, unread, hideActionBar, @@ -95,7 +94,7 @@ const Status: React.FC = (props) => { // Track height changes we know about to compensate scrolling. useEffect(() => { - didShowCard.current = Boolean(!muted && !hidden && status?.card); + didShowCard.current = Boolean(!muted && status?.card); }, []); const handleClick = (e?: React.MouseEvent) => { @@ -299,16 +298,13 @@ const Status: React.FC = (props) => { if (!status) return null; - if (hidden) { - return ( -
- <> - {actualStatus.account.display_name || actualStatus.account.username} - {actualStatus.content} - -
- ); - } + if (status.deleted) return ( + + ); if (filtered && status.showFiltered !== false) { const minHandlers = muted ? undefined : { diff --git a/packages/pl-fe/src/features/notifications/components/notification.tsx b/packages/pl-fe/src/features/notifications/components/notification.tsx index eeea9071c..8241a2c43 100644 --- a/packages/pl-fe/src/features/notifications/components/notification.tsx +++ b/packages/pl-fe/src/features/notifications/components/notification.tsx @@ -181,7 +181,6 @@ const buildMessage = ( const avatarSize = 48; interface INotification { - hidden?: boolean; notification: NotificationGroup; onMoveUp?: (notificationId: string) => void; onMoveDown?: (notificationId: string) => void; @@ -196,7 +195,7 @@ const getNotificationStatus = (n: Pick & ({ status: S }; const Notification: React.FC = (props) => { - const { hidden = false, onMoveUp, onMoveDown } = props; + const { onMoveUp, onMoveDown } = props; const dispatch = useAppDispatch(); @@ -330,7 +329,6 @@ const Notification: React.FC = (props) => { return account && typeof account === 'object' ? (