Skip to content

feat(suite): use message system context and features in trading #19089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2025

Conversation

izmy
Copy link
Contributor

@izmy izmy commented May 21, 2025

Description

Integrate message system context and features in trading on the desktop.

Related Issue

Resolve #18806

Screenshots:

image image

🔍🖥️ Suite web test results: View in Currents

🔍🖥️ Suite desktop test results: View in Currents

🔍🖥️ Suite native android test results: View in Currents

@izmy izmy requested a review from rojcyk May 21, 2025 16:29
@izmy izmy self-assigned this May 21, 2025
@izmy izmy requested review from tomasklim and matejkriz as code owners May 21, 2025 16:29

export const TradingDisabled = ({ type }: TradingDisabledProps) => (
<Banner icon="warning" variant="warning">
{capitalize(type)} is currently disabled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has to be translatable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but maybe we want to use some message from the message system

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I know, but I'm not sure what content should be here, so I temporarily added the Banner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this for content from feature flags and also added a default translation string if the content is missing

@izmy izmy force-pushed the feat/message-system-context-in-trading branch from a03b0f1 to 644c119 Compare May 22, 2025 13:13
@izmy izmy requested review from MiroslavProchazka and a team as code owners May 22, 2025 13:13
@izmy izmy requested review from tomasklim and adderpositive May 22, 2025 13:13
Copy link
Member

@tomasklim tomasklim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, not tested

@izmy izmy force-pushed the feat/message-system-context-in-trading branch from 644c119 to 668912c Compare May 22, 2025 14:08
@trezor-bot
Copy link

trezor-bot bot commented May 22, 2025

✅ Previously successful run of [Test] PR Suite Desktop e2e tests workflow has been found.
⏭️ Skipping tests for this run.
💡 If you are unsure about your latest changes, please rerun the workflow manually. (Use the Re-run all jobs option)

Copy link
Contributor

@vytick vytick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mobile part looks good 💪. Thanks for aligning the name 🙇

Copy link
Contributor

@adderpositive adderpositive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like the renaming to exchange. I have just one thing to think about.

Comment on lines 16 to 19
const type: TradingType = 'buy';
const { isDisabled, content } = useMessageSystemTrading(type);

const tradingBuyContextValues = useTradingBuyForm({ selectedAccount });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
const type: TradingType = 'buy';
const { isDisabled, content } = useMessageSystemTrading(type);
const tradingBuyContextValues = useTradingBuyForm({ selectedAccount });
const tradingBuyContextValues = useTradingBuyForm({ selectedAccount });
const { isDisabled, content } = useMessageSystemTrading(tradingBuyContextValues.type);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more idea to think about.
const tradingBuyContextValues = useTradingBuyForm({ selectedAccount }); will initialize the buy context, and some necessary requests could be fired regardless disabled section. Maybe creating a new component with context initialization could solve the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reworked the components a bit. Every type now has three components - TradingXForm, TradingXFormWrapper, TradingXFormContent. I was thinking about some kind of abstraction, but I realized that would be more overengineering. So, what do you think of the current version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates

@izmy izmy force-pushed the feat/message-system-context-in-trading branch from 668912c to da9efc0 Compare May 23, 2025 17:03
@trezor-bot
Copy link

trezor-bot bot commented May 23, 2025

✅ Previously successful run of [Test] PR Suite Desktop e2e tests workflow has been found.
⏭️ Skipping tests for this run.
💡 If you are unsure about your latest changes, please rerun the workflow manually. (Use the Re-run all jobs option)

@izmy izmy requested a review from adderpositive May 23, 2025 17:09
@tomasklim tomasklim merged commit ad22696 into develop May 24, 2025
31 of 32 checks passed
@tomasklim tomasklim deleted the feat/message-system-context-in-trading branch May 24, 2025 18:29
@izmy
Copy link
Contributor Author

izmy commented May 26, 2025

config action:

{
            "conditions": [
                {
                    "environment": {
                        "desktop": "*",
                        "mobile": "!",
                        "web": "*"
                    }
                }
            ],
            "message": {
                "id": "ccfcf69b-e895-463c-8eeb-f210cc7683b0",
                "priority": 99,
                "dismissible": true,
                "variant": "info",
                "category": ["feature", "context"],
                "content": {
                    "en-GB": "Placeholder",
                    "en": "Placeholder",
                    "es": "Placeholder",
                    "cs": "Placeholder",
                    "de": "Placeholder",
                    "fr": "Placeholder",
                    "it": "Placeholder",
                    "pt": "Placeholder",
                    "tr": "Placeholder",
                    "ru": "Placeholder",
                    "ja": "Placeholder",
                    "uk": "Placeholder",
                    "hu": "Placeholder"
                },
                "cta": {
                    "action": "external-link",
                    "link": "https://blog.trezor.io/important-update-transitioning-from-coinjoin-in-trezor-suite-9dfc63d2662f",
                    "label": {
                        "en-GB": "Learn More",
                        "en": "Learn More",
                        "es": "Más Información",
                        "cs": "Více Informací",
                        "ru": "Подробнее",
                        "ja": "詳細はこちら",
                        "hu": "További Információ",
                        "it": "Scopri di Più",
                        "fr": "En Savoir Plus",
                        "de": "Mehr Erfahren",
                        "tr": "Daha Fazla Bilgi",
                        "pt": "Saiba Mais",
                        "uk": "Дізнатись більше"
                    }
                },
                "context": { "domain": "trading.buy" },
                "feature": [
                    {
                        "domain": "trading.buy",
                        "flag": true
                    },
                    {
                        "domain": "trading.sell",
                        "flag": false
                    },
                    {
                        "domain": "trading.exchange",
                        "flag": false
                    }
                ]
            }
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Message system context in trading
4 participants