Skip to content
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

feat(extension): add midnight pre-launch settings banner LW-10398 #1156

Merged

Conversation

DominikGuzei
Copy link
Member

@DominikGuzei DominikGuzei commented May 13, 2024

Checklist

  • JIRA
  • Screenshots added.

Proposed solution

Please note: the CTA buttons do not have any action defined yet (as per task requirement) and will be wired-up in later tasks.

  • Introduce a USE_MIDNIGHT_PRELAUNCH_EVENT feature flag to hide the midnight related UI elements behind
  • Implement the midnight pre-launch banner in @lace/core storybook
  • Add the pre-launch ui setting item in the settings list (in all views)
  • Integrate the pre-launch banner in the settings sidebar (in extended view)

Testing

  • Check that no pre-launch settings items are shown when feature flag is off
  • With feature flag on check that the pre-launch settings item is always visible and the sidebar banner is visible in extended view in all responsive screen sizes except the smallest one.

Screenshots

video of the responsive banner sidebar banner (please note that at time of recording the settings list item was not yet activated for extended view but is in latest version):

Bildschirmaufnahme.2024-05-13.um.14.51.12.mov

@DominikGuzei DominikGuzei added the browser Changes to the browser application. label May 13, 2024
@DominikGuzei DominikGuzei self-assigned this May 13, 2024
@github-actions github-actions bot removed the browser Changes to the browser application. label May 13, 2024
line-height: 24px;
font-weight: 500;
margin-bottom: 30px;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Please note that i tried to use @lace/ui typography here instead of defining it all in CSS which turned out to be more trouble than good as this text is not standard (e.g: it looks the same in both themes) and i ran into override issues when trying to change the color via css then.

return (
<Card.Outlined
className={styles.card}
style={{ '--midnight-pre-launch-banner-image': `url(${bannerImageUrl})` } as React.CSSProperties}
Copy link
Member Author

Choose a reason for hiding this comment

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

That was the only way I found to provide a background image via CSS variable to the component (since it didn't work to include the background-image in the compiled core component)

@DominikGuzei DominikGuzei force-pushed the feat/lw-10398-settings-sidebar-midnight-event-component branch from 9b7d0cc to 29283c3 Compare May 13, 2024 15:14
@DominikGuzei DominikGuzei added the browser Changes to the browser application. label May 13, 2024
Copy link

github-actions bot commented May 13, 2024

Allure Report

allure-report-publisher generated test report!

smokeTests: ✅ test report for 8b83c82e

passed failed skipped flaky total result
Total 30 0 0 0 30

@github-actions github-actions bot removed the browser Changes to the browser application. label May 13, 2024
@DominikGuzei DominikGuzei force-pushed the feat/lw-10398-settings-sidebar-midnight-event-component branch from 29283c3 to 4e25510 Compare May 13, 2024 15:55
@DominikGuzei DominikGuzei marked this pull request as ready for review May 13, 2024 15:55
@DominikGuzei DominikGuzei requested a review from a team as a code owner May 13, 2024 15:55
@DominikGuzei DominikGuzei force-pushed the feat/lw-10398-settings-sidebar-midnight-event-component branch from 4e25510 to 711980e Compare May 13, 2024 15:56
Copy link
Contributor

@VanessaPC VanessaPC left a comment

Choose a reason for hiding this comment

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

There is a small ts warning, but aside than that, this looks great to me!

@DominikGuzei
Copy link
Member Author

DominikGuzei commented May 14, 2024

There is a small ts warning, but aside than that, this looks great to me!

Hmm … that looks weird because i don't think this is caused by my changes in this PR?
image

import styles from './MidnightPreLaunchSettingsBanner.module.scss';

export const MidnightPreLaunchSettingsBanner = ({
bannerImageUrl,
Copy link
Contributor

Choose a reason for hiding this comment

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

I have mixed feelings about bannerImageUrl prop. In my opinion this prop would have more sense if this banner was generic one.

When I look at place where it is used I see this weird looking import import MidnightPreLaunchBannerImage from '../../../../../../../../packages/core/src/ui/assets/images/midnight-launch-event-sidebar-banner.png';

I would recommend removing this prop, or making this component generic like <SettingsBanner /> and place image in apps/browser-extension-wallet directory. The same for storybook.

Copy link
Contributor

Choose a reason for hiding this comment

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

The more I think about it, the more I like the idea of making this component generic one, especially that it's implementation is in core package. If we would like to keep this name MidnightPreLaunchSettingsBanner to me it would make more sense to have it in apps/browser-extension-wallet as this is not something generic and there is probably 0% chance we would like to reuse it somewhere else.

Copy link
Member Author

Choose a reason for hiding this comment

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

@pczeglik-iohk I had to introduce the prop because the image must be used as CSS background (so that the rounded corners of the banner are correctly respected) AND unfortunately our core package doesn't correctly bundle css images (the path is simply retained and then wrong when component is imported in the extension) - I can move the image to the extension package but then what should be shown in the core storybook (it also acts as an example)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @DominikGuzei I think the issue is on the way we have of working and exporting images from core which should be addressed. But I think the way it was set up it's consistent with how other components currently do it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@pczeglik-iohk sure, i can turn this into a generic component BUT it doesn't really make sense since the design is quite special in that it looks the same in light/dark theme (font colors). I'm not sure if it's the best case for a generic component tbh.


export const MidnightPreLaunchSettingsBanner = ({
bannerImageUrl,
onMoreDetailsClick
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we instead of onMoreDetailsClick use just onClick?

In case of button text change we won't need to change prop name to have consistency between what we see in UI and what we have in code.

Copy link
Member Author

Choose a reason for hiding this comment

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

what about onCtaButtonClick?

Copy link
Member Author

@DominikGuzei DominikGuzei May 15, 2024

Choose a reason for hiding this comment

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

@pczeglik-iohk renamed to onCtaButtonClick and updated PR

@@ -250,6 +250,9 @@
"core.infoWallet.addressCopied": "Address copied",
"core.infoWallet.copy": "Copy",
"core.infoWallet.handleCopied": "Handle copied",
"core.MidnightPreLaunchSettingsBanner.heading": "Midnight Pre-Launch Event",
Copy link
Contributor

Choose a reason for hiding this comment

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

If we decide to go with generic component translations should be in apps/browser-extension-wallet?

I would recommend creating dedicated namespace for all midnight related translations like browserView.midnight or just midnight.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@DominikGuzei DominikGuzei May 14, 2024

Choose a reason for hiding this comment

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

@pczeglik-iohk it's not a generic component, the only reason why we develop new components in core because we haven't been able to set up storybook correctly in the extension app package 😆 if you look around you will see plenty of non-generic components in core package. Only @lace/ui is truly generic.

In both cases i followed the existing naming scheme for translations in the app and core package. I'm not sure if introducing a dedicated namespace will make things clearer now.

btw. the way we handle translations will be changed dramatically anyway (moved into a dedicated package): #1154

Copy link
Contributor

@pczeglik-iohk pczeglik-iohk left a comment

Choose a reason for hiding this comment

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

Looks good @DominikGuzei, a few changes proposed.

Let me know what do you think :)

@DominikGuzei DominikGuzei force-pushed the feat/lw-10398-settings-sidebar-midnight-event-component branch from 711980e to c6bc842 Compare May 15, 2024 10:54
Copy link
Contributor

@pczeglik-iohk pczeglik-iohk left a comment

Choose a reason for hiding this comment

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

Not 100% happy, but I totally understand your arguments @DominikGuzei

Code approved! Thank you @DominikGuzei

@DominikGuzei DominikGuzei force-pushed the feat/lw-10398-settings-sidebar-midnight-event-component branch from c6bc842 to d0d7d92 Compare May 17, 2024 09:58
@DominikGuzei DominikGuzei requested a review from a team as a code owner May 17, 2024 09:58
@DominikGuzei DominikGuzei force-pushed the feat/lw-10398-settings-sidebar-midnight-event-component branch from d0d7d92 to 8db3c89 Compare May 21, 2024 10:14
@DominikGuzei DominikGuzei force-pushed the feat/lw-10398-settings-sidebar-midnight-event-component branch from 8db3c89 to 8b83c82 Compare May 21, 2024 16:31
Copy link

@DominikGuzei DominikGuzei merged commit ff562a0 into main May 21, 2024
12 checks passed
@DominikGuzei DominikGuzei deleted the feat/lw-10398-settings-sidebar-midnight-event-component branch May 21, 2024 17:24
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.

3 participants