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: Newsletter Banner #601

Merged
merged 9 commits into from
Jul 6, 2023
Merged

feat: Newsletter Banner #601

merged 9 commits into from
Jul 6, 2023

Conversation

ashin-czi
Copy link
Contributor

@ashin-czi ashin-czi commented May 3, 2023

Reason for Change

  • #4453

Readability: @prathapsridharan
Functionality: @atarashansky

Changes

  • add
    • Adding new Newsletter component banner
  • remove
  • modify

Testing steps

  1. Navigate to Explorer
  2. Click "subscribe" button in the banner to open the modal and ensure modal opens with content and logo
  3. Enter an invalid and/or valid email address in the email input box
  4. Press "subscribe" button
  5. If an invalid email was entered, you should see an error message underneath the input box
  6. If a valid email was entered, ensure you see "Thanks for subscribing!" text after submission
  7. Click the X button to close out the modal
  8. Refresh the page to reset the newsletter banner to input an email again

Notes for Reviewer

Implementation is almost exactly how Napari Hub integrates with Hubspot in order to prevent saving cookies. Their PR for integrating with Hubspot can be viewed here: https://github.com/chanzuckerberg/napari-hub/pull/661/files

explorer.newsletter.changes.mov

Note that the header/nav bar, breadcrumbs, graphs, and gene sets are placeholder values to mimic how actual Explorer would look from DP and to demonstrate scrolling of the left/right sidebars

id="hubspot-js"
type="text/javascript"
src="https://js.hsforms.net/forms/v2.js"
></script>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to use Hubspot's JS file to embed their form and submit the email to their API

@@ -96,9 +95,6 @@ class App extends React.Component<Props> {
viewportRef={viewportRef}
key={graphRenderCounter}
/>
<Controls bottom={0}>
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're moving the breadcrumbs into the component for finer control of the styling based on if the banner is open or not

@ashin-czi
Copy link
Contributor Author

ashin-czi commented May 3, 2023

Example:

explorer.newsletter.changes.mov

Note that the header/nav bar, breadcrumbs, graphs, and gene sets are placeholder values to mimic how actual Explorer would look from DP and to demonstrate scrolling of the left/right sidebars

@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Merging #601 (b5c0212) into main (202a90f) will not change coverage.
The diff coverage is n/a.

❗ Current head b5c0212 differs from pull request most recent head e1fb3ef. Consider uploading reports for the commit e1fb3ef to get more accurate results

@@           Coverage Diff           @@
##             main     #601   +/-   ##
=======================================
  Coverage   77.67%   77.67%           
=======================================
  Files          88       88           
  Lines        6754     6754           
=======================================
  Hits         5246     5246           
  Misses       1508     1508           
Flag Coverage Δ
frontend 77.67% <ø> (ø)
javascript 77.67% <ø> (ø)
smokeTest ?
unitTest 77.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be ignored, just configuring types from the Hubspot JS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be ignored, just styling for the newsletter modal and banner

globals.rightSidebarWidth + 1
}px [right-sidebar-end]
`,
[left-sidebar-start] ${globals.leftSidebarWidth + 1}px
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just indent changes

@@ -57,6 +62,7 @@ const Layout: React.FC<Props> = (props) => {
position: "relative",
height: "inherit",
overflowY: "auto",
paddingBottom: isBannerOpen ? `${BANNER_HEIGHT_PX}px` : 0,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

add padding to bottom to account for banner height

@@ -57,6 +62,7 @@ const Layout: React.FC<Props> = (props) => {
position: "relative",
height: "inherit",
overflowY: "auto",
paddingBottom: isBannerOpen ? `${BANNER_HEIGHT_PX}px` : 0, // add padding to bottom to account for banner height
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sidebar, adding padding to bottom to account for banner height so that banner doesn't cover scrollbar

</div>
<div
style={{
gridArea: "top / right-sidebar-start / bottom / right-sidebar-end",
position: "relative",
height: "inherit",
overflowY: "auto",
paddingBottom: isBannerOpen ? `${BANNER_HEIGHT_PX}px` : 0, // add padding to bottom to account for banner height
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sidebar, adding padding to bottom to account for banner height so that banner doesn't cover scrollbar

@@ -73,18 +79,26 @@ const Layout: React.FC<Props> = (props) => {
}}
>
{graphComponent}
<Controls bottom={isBannerOpen ? BANNER_HEIGHT_PX : 0}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving breadcrumbs here for finer control of styling so that the banner doesn't cover the breadcrumbs

}}
>
{/* The below conditional is required because the right sidebar initializes as function for some reason...*/}
{!(rightSidebar instanceof Function) && rightSidebar}
</div>
<BottomBanner
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the new Banner Component

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ashin-czi ashin-czi marked this pull request as ready for review May 3, 2023 20:03

interface Props {
includeSurveyLink: boolean;
setIsBannerOpen: React.Dispatch<React.SetStateAction<boolean>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for modifying the height/padding of the graph and sidebars to account for the banner height

<>
<HeaderContainer>
<img alt="CELLxGENE Logo" src={cellxgeneLogoSvg} />
<Button
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 are on an older SDS version and ButtonIcon/IconButton does not have sdsStyle="xMark", so we are just using a button with "X" text. Slightly different than the close button on DP

</>
)}
</div>
) as unknown as string // For some reason setting the "text" prop overwrites the child, so we have to set the element in the text prop but it only takes a string as the type
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This div is a child for StyledBanner in DP, but Explorer has an older SDS version so we have to include the element as a text prop, but the text prop only accepts type string

Copy link
Contributor

@atarashansky atarashansky left a comment

Choose a reason for hiding this comment

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

LGTM!

@ashin-czi ashin-czi enabled auto-merge (squash) July 6, 2023 21:14
@ashin-czi ashin-czi merged commit d99f066 into main Jul 6, 2023
@ashin-czi ashin-czi deleted the ashin-czi/newsletter-banner branch July 6, 2023 22:20
Bento007 added a commit that referenced this pull request Jul 11, 2023
* feat: Newsletter Banner (#601)

* feat: Newsletter Banner

* fix: Allow Connection to Hubspot (#633)

* fix: Allow Connection to Hubspot

* moving to default-src

* adding form-action

* fix: Modify CSP to Allow Hubspot (#634)

---------

Co-authored-by: Andrew Shin <109984998+ashin-czi@users.noreply.github.com>
Bento007 added a commit that referenced this pull request Jul 13, 2023
* feat: Newsletter Banner (#601)

* feat: Newsletter Banner

* fix: Allow Connection to Hubspot (#633)

* fix: Allow Connection to Hubspot

* moving to default-src

* adding form-action

* fix: Modify CSP to Allow Hubspot (#634)

---------

Co-authored-by: Andrew Shin <109984998+ashin-czi@users.noreply.github.com>
atarashansky added a commit that referenced this pull request Jul 19, 2023
atarashansky added a commit that referenced this pull request Jul 19, 2023
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.

2 participants