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

[#2201] Toast Component added with locales #2210

Merged
merged 24 commits into from
Jan 7, 2023

Conversation

zeeshansarwar38
Copy link
Contributor

Description

  • Toast Component added
  • Existing 'alerts' partial view removed
  • Translation strings added for new aria-label message
  • [minor change] On signin page, converted 'Remember me' control's div to label

Corresponding Issue

(#2201)

Screenshots

toast

toast2


Reviewing this pull request? Check out our Code Review Practices guide if you haven't already!

@welcome
Copy link

welcome bot commented Dec 8, 2022

Thank you for opening this pull request with us! Be sure to follow our Pull Request Practices. Let us know if you have any questions on Slack.

@zeeshansarwar38 zeeshansarwar38 marked this pull request as draft December 8, 2022 10:06
Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Thanks so much for working on this 🎉 Let me know if you have any questions about the review :)

app/assets/stylesheets/core/margins.scss Outdated Show resolved Hide resolved
app/views/devise/sessions/new.html.erb Outdated Show resolved Hide resolved
client/app/components/Input/Input.scss Outdated Show resolved Hide resolved
client/app/components/Toast/Toast.scss Outdated Show resolved Hide resolved
client/app/components/Toast/Toast.scss Outdated Show resolved Hide resolved
client/app/components/Toast/Toast.scss Show resolved Hide resolved
client/app/components/Toast/index.jsx Show resolved Hide resolved
MuhammadAakash
MuhammadAakash approved these changes Dec 10, 2022
Copy link
Contributor

@MuhammadAakash MuhammadAakash left a comment

Choose a reason for hiding this comment

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

Thanks, @zeeshansarwar38 for contributing to if-me.
I think you haven't worked on this case when we log out, which means when we log out, this alert is shown there also.
Please made changes according to this too.

Copy link
Contributor

@MuhammadAakash MuhammadAakash left a comment

Choose a reason for hiding this comment

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

@zeeshansarwar38
Please add mentioned changes to PR

Copy link
Contributor

@MuhammadAakash MuhammadAakash left a comment

Choose a reason for hiding this comment

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

@zeeshansarwar38
Copy link
Contributor Author

https://www.awesomescreenshot.com/image/35214908?key=2f4ad31c0b5c17ed2ce45258526bc1f9 @zeeshansarwar38 screenshot of Log out screen

Thanks, @zeeshansarwar38 for contributing to if-me. I think you haven't worked on this case when we log out, which means when we log out, this alert is shown there also. Please made changes according to this too.

@MuhammadAakash have you tested these changes by pulling the code from my branch? I checked this on my local environment and it works fine for the logout scenario.
image

@MuhammadAakash
Copy link
Contributor

@zeeshansarwar38, Sure I will check this and let you know.

Copy link
Contributor

@MuhammadAakash MuhammadAakash left a comment

Choose a reason for hiding this comment

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

Thanks, @zeeshansarwar38.
Everything is working fine.
@julianguyen if there are no other changes required from your side then this branch is ready to merge.

Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Thanks for all the updates! Let me know if you have any questions :)


.clr-white {
color: $white;
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove this class? I don't see it being used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Acknowledged

client/app/components/Toast/Toast.scss Show resolved Hide resolved
}, 7000);
}
return (
<div>
Copy link
Member

Choose a reason for hiding this comment

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

We can use a Fragment here i.e. <> and </>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were using that fragment already but I didn't comprehend your last comment on this change so I converted that to a div, assuming that's what you want :)

client/app/components/Toast/index.jsx Outdated Show resolved Hide resolved
}
return (
<div>
<div id="toast-notice" aria-label={showNotice ? I18n.t('alert_auto_hide') : ''} style={{ visibility: showNotice ? 'visible' : 'hidden' }} role="region" aria-live="polite" aria-atomic="true" className={`${showNotice ? 'notice' : ''} ${css.toast} ${showNotice && (showAlert || appendDashboardClass) ? 'smallMarginBottom' : ''}`}>
Copy link
Member

Choose a reason for hiding this comment

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

Let's not do inline CSS here and use stylesheets via SCSS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Acknowledged

}
return (
<div>
<div id="toast-notice" aria-label={showNotice ? I18n.t('alert_auto_hide') : ''} style={{ visibility: showNotice ? 'visible' : 'hidden' }} role="region" aria-live="polite" aria-atomic="true" className={`${showNotice ? 'notice' : ''} ${css.toast} ${showNotice && (showAlert || appendDashboardClass) ? 'smallMarginBottom' : ''}`}>
Copy link
Member

Choose a reason for hiding this comment

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

I think you'll want to only render this entire element only if showNotice exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, we need to have these two divs #toast-notice and #toast-alert present in the DOM all the time because we are using aria-live and role=alert for screen-reader users. So it is a requirement that the element should be present in the page markup first. Please check these links for reference link link-2.

</>
)}
</div>
<div id="toast-alert" aria-label={showAlert ? I18n.t('alert_auto_hide') : ''} style={{ visibility: showAlert ? 'visible' : 'hidden' }} role="alert" aria-live="assertive" aria-atomic="true" className={`${showAlert ? 'alert' : ''} ${css.toast} ${showAlert && appendDashboardClass ? 'smallMarginBottom' : ''}`}>
Copy link
Member

Choose a reason for hiding this comment

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

You'll want to only render this entire element only if showAlert exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, we need to have these two divs #toast-notice and #toast-alert present in the DOM all the time because we are using aria-live and role=alert for screen-reader users. So it is a requirement that the element should be present in the page markup first. Please check these links for reference link link-2.

client/app/styles/_global.scss Outdated Show resolved Hide resolved
Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Thanks for getting through all these updates!!! I really appreciate it :)

Was finally able to fine more time pull down the changes and look through it more. Have some feedback we should address!

client/app/components/Toast/Toast.scss Outdated Show resolved Hide resolved
client/app/components/Toast/index.jsx Outdated Show resolved Hide resolved
client/app/styles/_global.scss Outdated Show resolved Hide resolved
client/app/components/Toast/index.jsx Outdated Show resolved Hide resolved
Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Fantastic work! Thanks for working so diligently through the review process, it's so much appreciated 👏 🎉

@julianguyen julianguyen merged commit e171b11 into ifmeorg:main Jan 7, 2023
@welcome
Copy link

welcome bot commented Jan 7, 2023

Thank you for merging this pull request with us! If you haven't already, in another pull request, please add yourself to our About page.

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