App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Tweak UI for deleted message and expense

Open dubielzyk-expensify opened this issue 11 months ago • 23 comments

Problem

Today when you delete a message or expense with threads, the chat message gets replaced with [Deleted message] or [Deleted expense]. This feels a bit unpolished:

CleanShot 2024-12-05 at 13 59 52@2x

Solution

Let's spruce up the UI and reuse our attachement when showing a deleted message or expense:

CleanShot 2024-12-09 at 10 24 35@2x

For the receipt deleted we should use the icon already in our repo (App/assets/images/receipt-slash.svg). For the comment deleted, we should use this new icon: chatbubble-slash.svg.zip

cc @Expensify/design @JmillsExpensify @saracouto

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021864619157987293637
  • Upwork Job ID: 1864619157987293637
  • Last Price Increase: 2024-12-05
Issue OwnerCurrent Issue Owner: @shubham1206agra

dubielzyk-expensify avatar Dec 05 '24 04:12 dubielzyk-expensify

Auto-assigning issues to engineers is no longer supported. If you think this issue should receive engineering attention, please raise it in #whatsnext.

melvin-bot[bot] avatar Dec 05 '24 04:12 melvin-bot[bot]

Edited by proposal-police: This proposal was edited at 2024-12-05 05:53:14 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Tweak UI for deleted message and expense

What is the root cause of that problem?

Improvement

What changes do you think we should make in order to solve the problem?

  • First we should create a custom rendered in HTMLEngineProviderComponentList, we can call it 'deleted-action': DeletedActionRenderer,. https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/components/HTMLEngineProvider/HTMLRenderers/index.ts#L17-L34
  • Create a new component DeletedActionRenderer.
import React from 'react';
import {View} from 'react-native';
import type {CustomRendererProps, TPhrasing, TText} from 'react-native-render-html';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';

function DeletedActionRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) {
    const styles = useThemeStyles();
    const theme = useTheme();
    const {translate} = useLocalize();

    const actionTypes = Object.values(CONST.REPORT.ACTION_TYPE);
    const action = tnode.attributes.action;
    let translation = action;

    if (actionTypes.some((e) => e === action)) {
        translation = translate(`parentReportAction.${action}` as TranslationPaths);
    }

    Object.values(CONST.REPORT.ACTION_TYPE);

    const getIcon = () => {
        // This needs to be updated with new icons
        switch (action) {
            case CONST.REPORT.ACTION_TYPE.DELETED_MESSAGE:
                return {icon: Expensicons.ReceiptSlash, width: 18, height: 18};
            case CONST.REPORT.ACTION_TYPE.DELETED_EXPENSE:
                return {icon: Expensicons.ReceiptSlash, width: 18, height: 18};
            case CONST.REPORT.ACTION_TYPE.DELETED_REPORT:
                return {icon: Expensicons.ReceiptSlash, width: 18, height: 18};
            case CONST.REPORT.ACTION_TYPE.DELETED_TASK:
                return {icon: Expensicons.ReceiptSlash, width: 18, height: 18};
            case CONST.REPORT.ACTION_TYPE.HIDDEN_MESSAGE:
                return {icon: Expensicons.ReceiptSlash, width: 18, height: 18};
            case CONST.REPORT.ACTION_TYPE.REVERSED_TRANSACTION:
                return {icon: Expensicons.ReceiptSlash, width: 18, height: 18};
            default:
                return {icon: Expensicons.ReceiptSlash, width: 18, height: 18};
        }
    };

    const icon = getIcon();
    return (
        <View style={[styles.p4, styles.mt1, styles.border, {borderColor: theme.border}, styles.flexRow, styles.justifyContentCenter, styles.alignItemsCenter, styles.gap2]}>
            <Icon
                width={icon.height}
                height={icon.width}
                fill={theme.icon}
                src={icon.icon}
            />
            <Text style={(styles.textLabelSupporting, styles.textStrong)}>{translation}</Text>
        </View>
    );
}

DeletedActionRenderer.displayName = 'DeletedActionRenderer';

export default DeletedActionRenderer;

  • Add the icons in @components/Icon/Expensicons.
  • From everywhere we are using these values of parentReportAction, we should check if it is being used to render <RenderHTML html={and replace it with<RenderHTML html={<deleted-action action="${CONST.REPORT.ACTION_TYPE.DELETED_MESSAGE}"></deleted-action>} />`. https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/languages/en.ts#L4775-L4782 https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/components/ReportActionItem/MoneyRequestAction.tsx#L114-L122 https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/components/ReportActionItem/TaskPreview.tsx#L88-L90 https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/pages/home/report/ReportActionItem.tsx#L569-L571 https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/pages/home/report/ReportActionItemContentCreated.tsx#L85-L89 https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/pages/home/report/ReportActionItemContentCreated.tsx#L134 https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/pages/home/report/ReportActionItemFragment.tsx#L108-L113
  • Add the customHTMLElementModel for deleted-action in BaseHTMLEngineProvider it will look similar to alert-text. https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx#L24-L39
  • Create actions types in CONST file.
        ACTION_TYPE: {
            DELETED_MESSAGE: 'deletedMessage',
            DELETED_REPORT: 'deletedReport',
            DELETED_EXPENSE: 'deletedExpense',
            REVERSED_TRANSACTION: 'reversedTransaction',
            DELETED_TASK: 'deletedTask',
            HIDDEN_MESSAGE: 'hiddenMessage',
        },

TEST BRANCH

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?


What alternative solutions did you explore? (Optional)

Krishna2323 avatar Dec 05 '24 05:12 Krishna2323

@dubielzyk-expensify, these messages are also shown in similar way, do we want to update these too?

https://github.com/Expensify/App/blob/e25e3fa13b678cf733cd64ab734d73355fc726b8/src/languages/en.ts#L4775-L4782

NOTE: I have hidden my proposal for now, will bring back when we are ready with the designs and this issue is made external.

Krishna2323 avatar Dec 05 '24 05:12 Krishna2323

Job added to Upwork: https://www.upwork.com/jobs/~021864619157987293637

melvin-bot[bot] avatar Dec 05 '24 10:12 melvin-bot[bot]

Triggered auto assignment to @MitchExpensify (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Dec 05 '24 10:12 melvin-bot[bot]

:warning: It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time :warning:

melvin-bot[bot] avatar Dec 05 '24 10:12 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)

melvin-bot[bot] avatar Dec 05 '24 10:12 melvin-bot[bot]

Triggered auto assignment to Design team member for new feature review - @dannymcclain (NewFeature)

melvin-bot[bot] avatar Dec 05 '24 10:12 melvin-bot[bot]

Added the labels to get this one going.

JmillsExpensify avatar Dec 05 '24 10:12 JmillsExpensify

@dubielzyk-expensify, these messages are also shown in similar way, do we want to update these too?

I'd say yes, such that the design is consistent across them all.

trjExpensify avatar Dec 05 '24 10:12 trjExpensify

@Krishna2323 , there is pending action on the PR:

  • https://github.com/Expensify/App/pull/52164

Please complete pending work before posting on new issues :))

allgandalf avatar Dec 05 '24 12:12 allgandalf

@allgandalf, I don’t think I need to wait to close all my PRs before posting proposals, especially when I’m actively working on them. Yesterday, I provided as many updates as I could, and the last question was posted 12 hours ago. Do I need to resolve those instantly every time?

As you can see, I have no open assigned issues at the moment. I always try to complete issues before posting proposals, but it’s not entirely within my control since most of the time, we go through discussions.

Krishna2323 avatar Dec 05 '24 12:12 Krishna2323

That PR is high priority, so prioritizing accordingly :)

allgandalf avatar Dec 05 '24 12:12 allgandalf

That PR is high priority, so prioritizing accordingly :)

Thanks for reminding😄. I know that's a high priority that's why I kept that updated whenever possible.

I will provide an update on that in a hour or two.

Krishna2323 avatar Dec 05 '24 12:12 Krishna2323

@dubielzyk-expensify We already have a different Receipt Slash icon in the system, do we want to go with that one or replace it with the one you've made? I don't really think we need two.

CleanShot 2024-12-05 at 08 08 40@2x

dannymcclain avatar Dec 05 '24 14:12 dannymcclain

Oh good catch Danny, definitely agree we should consolidate.

shawnborton avatar Dec 05 '24 19:12 shawnborton

Yeah that sounds good Danny! Missed that one

dubielzyk-expensify avatar Dec 06 '24 04:12 dubielzyk-expensify

Right on!

Ok so for the deleted expense version we can just use this existing icon: App/assets/images/receipt-slash.svg

dannymcclain avatar Dec 06 '24 14:12 dannymcclain

It sounds like we're aligned; @dubielzyk-expensify, can you update the OP so we can label this "help wanted," please?

MitchExpensify avatar Dec 07 '24 16:12 MitchExpensify

What do you mean "update the OP so we can label this help wanted"?

dubielzyk-expensify avatar Dec 09 '24 00:12 dubielzyk-expensify

@dannymcclain, @MitchExpensify, @shubham1206agra Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 09 '24 09:12 melvin-bot[bot]

@dubielzyk-expensify We made a decision "for the deleted expense version we can just use this existing icon: App/assets/images/receipt-slash.svg", and I'm wondering if the original post (OP) needs to be updated to reflect that decision before we label the issue "help wanted" as a next step

MitchExpensify avatar Dec 10 '24 00:12 MitchExpensify

Ahh, I've updated it already 👍

dubielzyk-expensify avatar Dec 10 '24 01:12 dubielzyk-expensify

Perfect @dubielzyk-expensify ! 🙇

MitchExpensify avatar Dec 10 '24 03:12 MitchExpensify

@dubielzyk-expensify giving you the assignment on this one since you've done all the work 😄

dannymcclain avatar Dec 10 '24 15:12 dannymcclain

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 12 '24 16:12 melvin-bot[bot]

@MitchExpensify, @shubham1206agra, @dubielzyk-expensify Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Dec 16 '24 09:12 melvin-bot[bot]

Waiting for updated UI.

shubham1206agra avatar Dec 16 '24 13:12 shubham1206agra

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 19 '24 16:12 melvin-bot[bot]

Waiting for updated UI.

shubham1206agra avatar Dec 20 '24 09:12 shubham1206agra