-
Notifications
You must be signed in to change notification settings - Fork 26
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
add portfolio filter info alert on overview map #744
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f97e3b9
add react-select package
austensen 5665f10
add react-relect (wip)
austensen 623bb31
add back placeholder styles
austensen 819cef2
separated selected values working
austensen 62a5ae5
add more/less selections
austensen d6f2549
custom close icon for selected values
austensen 01c44c4
replace old multiselect, new functional, styled for desktop
austensen e5ad5f2
fix multiselect error placement and input border
austensen d864725
fix info-alert styles
austensen f6ce0fa
multiselect mobile styles, start refactoring filter styles
austensen 3608053
separate out MinMaxSelect component
austensen e160550
separate out MinMaxSelect styles
austensen 909a533
fix up alert styles for no-close, align apply buttons
austensen c59cf10
finish styles refactor, fix multiselect apply move
austensen 05cee1a
fix primary button letter spacing (from #738)
austensen ff20821
Merge 'filters' into multiselect-screen-reader
austensen b4a563f
reduce font weight for table body (except firefox)
austensen 04c10c2
remove old styles mistakenly adding in 'filters' merge
austensen 0176fdb
fix min-max label font styles & "to" -> "and"
austensen 752f464
delete old multiselect styles file
austensen 5afdd2c
"Zip Code" (fix capitalization)
austensen f2db0b4
add portfolio filter info alert on overview map, update big portfolio…
austensen 57bf5ca
adjust down firefox font-weight in minmax- & multi-select components
austensen 623503d
fix multiselect filename
austensen cfc797f
adjust desktop filter dropdowns for scrollbars on windows
austensen 6715daa
add aria labels for multiselect buttons & description on input
austensen fa6a0dd
Merge in 'multiselect-rewrite' changes
austensen 0497012
keep portfolio alerts closed for session
austensen 10b2563
Merge branch 'filters' into overview-filter-alert
austensen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { Trans } from "@lingui/macro"; | ||
import classNames from "classnames"; | ||
import { Link, useLocation } from "react-router-dom"; | ||
import networkDiagram from "../assets/img/network-diagram.png"; | ||
import { AddressPageRoutes } from "../routes"; | ||
import { Alert, AlertProps } from "./Alert"; | ||
import { logAmplitudeEvent } from "./Amplitude"; | ||
import Modal from "./Modal"; | ||
import { isLegacyPath } from "./WowzaToggle"; | ||
|
||
export const BIG_PORTFOLIO_THRESHOLD = 300; | ||
export const FILTER_PORTFOLIO_THRESHOLD = 15; | ||
|
||
type PortfolioAlertProps = Omit<AlertProps, "children"> & { | ||
portfolioSize: number; | ||
}; | ||
|
||
type FilterPortfolioAlertProps = PortfolioAlertProps & { | ||
addressPageRoutes: AddressPageRoutes; | ||
}; | ||
|
||
export const BigPortfolioAlert = ({ portfolioSize, className, ...props }: PortfolioAlertProps) => { | ||
const [isLearnMoreModalVisible, setModalVisibility] = useState(false); | ||
const { pathname } = useLocation(); | ||
|
||
// Preload modal image when BigPortfolioBanner mounts: | ||
useEffect(() => { | ||
new Image().src = networkDiagram; | ||
}, []); | ||
|
||
return !isLegacyPath(pathname) && portfolioSize > BIG_PORTFOLIO_THRESHOLD ? ( | ||
<Alert | ||
className={classNames("big-portfolio-alert", className)} | ||
variant="secondary" | ||
type="info" | ||
{...props} | ||
> | ||
<> | ||
<Trans>Why am I seeing such a big portfolio?</Trans>{" "} | ||
<button | ||
className="button is-text" | ||
onClick={() => { | ||
logAmplitudeEvent("learnWhyPortfolioSoBig"); | ||
window.gtag("event", "learn-why-portfolio-so-big"); | ||
setModalVisibility(true); | ||
}} | ||
> | ||
<Trans>Learn more.</Trans> | ||
</button> | ||
<Modal showModal={isLearnMoreModalVisible} onClose={() => setModalVisibility(false)}> | ||
<h5 className="first-header"> | ||
<Trans>Why am I seeing such a big portfolio?</Trans> | ||
</h5> | ||
<p> | ||
<Trans> | ||
When two parties share the same business address, we group them as part of the same | ||
portfolio. | ||
</Trans> | ||
</p> | ||
<p className="is-marginless"> | ||
<Trans> | ||
Some large corporations, however, are a bit more complicated and may share personnel | ||
and financial stake with other related companies, which all will show up on Who Owns | ||
What as one large portfolio. | ||
</Trans> | ||
</p> | ||
<br /> | ||
<img className="img-responsive" src={networkDiagram} alt="" /> | ||
<br /> | ||
<p> | ||
<Trans> | ||
We’ve improved Who Owns What to dig deeper into the data and offer you a more complete | ||
picture of buildings associated with your landlord.{" "} | ||
<a | ||
href="https://medium.com/justfixorg/untangling-nycs-web-of-real-estate-who-owns-what-s-latest-release-b22aac917617" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Read more in our methodology article | ||
</a> | ||
</Trans> | ||
</p> | ||
</Modal> | ||
</> | ||
</Alert> | ||
) : ( | ||
<></> | ||
); | ||
}; | ||
|
||
export const FilterPortfolioAlert = ({ | ||
portfolioSize, | ||
className, | ||
addressPageRoutes, | ||
...props | ||
}: FilterPortfolioAlertProps) => { | ||
const { pathname } = useLocation(); | ||
|
||
return !isLegacyPath(pathname) && portfolioSize >= FILTER_PORTFOLIO_THRESHOLD ? ( | ||
<Alert | ||
className={classNames("big-portfolio-alert", className)} | ||
variant="secondary" | ||
type="info" | ||
{...props} | ||
> | ||
<Trans> | ||
Filter through this portfolio in{" "} | ||
<Link | ||
to={addressPageRoutes.portfolio} | ||
onClick={() => { | ||
logAmplitudeEvent("alertToFilterPortfolio", { portfolioSize }); | ||
window.gtag("event", "alert-topfilter-portfolio", { portfolioSize }); | ||
}} | ||
> | ||
the Portfolio tab. | ||
</Link> | ||
</Trans> | ||
</Alert> | ||
) : ( | ||
<></> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alerts would be an excellent candidate for making into a reusable class component in storybook later! esp since these exact patterns also exist in LOC rebrand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah for sure! That was the next one I was hoping to add, it should be mostly ready to copy over from here and just the styles need to be updated.