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: JSON Notifications #420

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

TacosTonight
Copy link
Contributor

@TacosTonight TacosTonight commented Jan 2, 2022

Fixes #372

Definition of Done:

  • Banner component is rendered in all app routes.
  • Banner supports 'info' | 'warning' | 'critical' states.
  • Banner displays the top most non-dismissed active message available.
  • Message can be dismissed by user to display next message.
  • Messages support markdown.

image

20Jan22 Update

Banner was converted from floating to occupying space in the DOM
image

Attempted to add more spacing to the banner, but some styling conflicts came up due to the side bar being in a fixed position. Requesting that the styling issue becomes a separate PR
image

Also attempted to hardcode the top position of the side bar, but scrolling down or dismissing messages leaves the side bar in an awkward position
image
image

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

@TacosTonight TacosTonight marked this pull request as draft January 2, 2022 09:21
@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

@TacosTonight TacosTonight marked this pull request as ready for review January 10, 2022 17:45
@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

src/client/components/common/Banner/index.tsx Outdated Show resolved Hide resolved
src/client/components/common/Banner/index.tsx Outdated Show resolved Hide resolved
src/client/components/common/Banner/index.tsx Outdated Show resolved Hide resolved
src/client/containers/NotificationBanner/index.tsx Outdated Show resolved Hide resolved
src/client/containers/NotificationBanner/index.tsx Outdated Show resolved Hide resolved
src/client/containers/NotificationBanner/index.tsx Outdated Show resolved Hide resolved
src/client/containers/NotificationBanner/index.tsx Outdated Show resolved Hide resolved
src/client/data/notificationMessages.json Outdated Show resolved Hide resolved
Copy link
Contributor

@xgambitox xgambitox left a comment

Choose a reason for hiding this comment

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

Made some comments, good overall!

If you can add some styling on the banner to git it more space would be better. Will ask if someone can help with designs.

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

children: React.ReactNode;
}

export const Banner: FC<BannerProps> = ({ children }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can probably remove this file since it does nothing

Copy link
Contributor

Choose a reason for hiding this comment

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

This component should be the presentational component. I suggest moving all the styling from NotificationBanner to this one. Banner should receive props like children and onClose.

src/client/data/notificationMessages.json Outdated Show resolved Hide resolved
src/core/frameworks/redux/index.ts Show resolved Hide resolved
messages: [],
dismissedMessageIds: [],
statusMap: {
getNotificationMessages: { ...initialStatus },
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can just do getNotificationMessages: initialStatus

state.messages = messages.filter((message) => {
return message.active === true;
});
state.statusMap.getNotificationMessages = {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be initialStatus now right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it does make sense to set it as initialStatus, since after the request is fulfilled, loading should be false and there shouldn't be an error.

I noticed in other reducers however that the .fulfilled is set to {}

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer being more explicit and having initialStatus too, but as you have it also works now since we dont have expressions like if(getNotificationMessages.loading === false) .... But we need to be careful of that.

@TacosTonight
Copy link
Contributor Author

Instead of having the Banner span the either width of the page, I tried moving the NotificationBanner inside in containers/Layout. It looks ok to me, and makes it so the fixed positioning of the side nav bar css doesn't have to be changed. The scrolling and dismissing issues that I brought up in the PR description also gets solved. What does everyone else think? @xgambitox @FiboApe

image

@xgambitox
Copy link
Contributor

xgambitox commented Jan 31, 2022

Instead of having the Banner span the either width of the page, I tried moving the NotificationBanner inside in containers/Layout. It looks ok to me, and makes it so the fixed positioning of the side nav bar css doesn't have to be changed. The scrolling and dismissing issues that I brought up in the PR description also gets solved. What does everyone else think? @xgambitox @FiboApe

image

Yeah, looks good to me :)

I would just place the close button at the right of the banner.

@turtlemoji
Copy link
Contributor

The thing having it there as an static thing, is that will cause ugly rerenders / resizing when you close it @TacosTonight @xgambitox
Can't we put it as position absolute/fixed at the top?

@FiboApe
Copy link
Collaborator

FiboApe commented Feb 2, 2022

So putting as position absolute is doable, but we'll have the same problem @TacosTonight was having before, where we need to push the navbars fixed position in the first render, and when the user scrolls down we need to revert that push, since the navbar will be pushed down but the notification banner not visible anymore.

As for position fixed, the issue there is that the notificationBanner will be above information that the user might want to see while scrolling through the page.

@FiboApe
Copy link
Collaborator

FiboApe commented Feb 2, 2022

Another option for this, is to have our main wrapper have an overflow hidden on the main wrapper of the app, and then on the body have an overflow scroll.

That will make it so the page always occupies the 100% of the screen, but the content can be scrolled.

So like this:
Screenshot 2022-02-02 at 11 09 08

…ner to Banner. left notificationMessages.json filled out for testing, but will delete in final merge

Signed-off-by: TacosTonight <[email protected]>
@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-420.d27dgpz01hmbvx.amplifyapp.com

return <StyledBanner>{children}</StyledBanner>;
}

let messageSymbol: React.FunctionComponent<React.SVGProps<SVGSVGElement> & { title?: string | undefined }>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could probably use InfoIcon | WarningFilledIcon | WarningIcon | InfoIcon instead of redefining ti as React.FC

src/client/components/common/Banner/index.tsx Outdated Show resolved Hide resolved
src/client/components/common/Banner/index.tsx Outdated Show resolved Hide resolved
src/client/components/common/Banner/index.tsx Outdated Show resolved Hide resolved
import { Banner } from '@components/common';

export const NotificationBanner: FC = () => {
const latestMessage = first(useAppSelector(NotificationsSelectors.selectActiveMessages));
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a reason we need a container component instead of just having this all on the banner component?

@FoxTheSin FoxTheSin requested a review from pentcle March 22, 2022 15:27
@FoxTheSin FoxTheSin changed the title Notification Banner [WEB-1032] feat: .json based notifications Apr 19, 2022
@turtlemoji turtlemoji changed the title feat: .json based notifications feat: JSON Notificationsn Apr 23, 2022
@turtlemoji turtlemoji changed the title feat: JSON Notificationsn feat: JSON Notifications Apr 23, 2022
@turtlemoji
Copy link
Contributor

turtlemoji commented Apr 23, 2022

Refactored style, fixes, layout, animation.
Still some changes to be made

@turtlemoji turtlemoji added the hold Hold pull request label Apr 23, 2022
@turtlemoji turtlemoji self-assigned this Apr 23, 2022
@turtlemoji turtlemoji removed their assignment Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hold Hold pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notification Banner [WEB-1032]
4 participants