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

Removed front-end of saved list feature #2085

Merged
merged 2 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/components/benefit_card_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe("BenefitCard", () => {

it("Clicking the See More button expands the BenefitExpansion component", () => {
mountedBenefitCard()
.find("HeaderButton")
.find("BenefitExpansion")
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 seems to have never been fixed when the See More button was changed to a toggle. The "HeaderButton" should have been replaced with "BenefitExpansion." This whole time, the test was picking up the HeaderButton from the saved list button on the benefit card.

.at(0)
.simulate("click");
expect(mountedBenefitCard().find("BenefitExpansion").length).toEqual(1);
Expand Down
20 changes: 10 additions & 10 deletions __tests__/components/sticky_header_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ describe("StickyHeader", () => {
expect(await axe(html)).toHaveNoViolations();
});

it("contains saved list text that displays the number of saved list items", async () => {
expect(
mount(<StickyHeader {...props} />)
.find("#savedBenefits")
.first()
.find("span")
.first()
.text()
).toContain("0");
});
// it("contains saved list text that displays the number of saved list items", async () => {
// expect(
// mount(<StickyHeader {...props} />)
// .find("#savedBenefits")
// .first()
// .find("span")
// .first()
// .text()
// ).toContain("0");
// });

// it("contains edit selections link", () => {
// expect(
Expand Down
18 changes: 9 additions & 9 deletions components/benefit_cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component } from "react";
import PropTypes from "prop-types";
import { Grid } from "@material-ui/core";
import Highlighter from "react-highlight-words";
import FavouriteButton from "./favourite_button";
//import FavouriteButton from "./favourite_button";
import Paper from "./paper";
import { connect } from "react-redux";
import NeedTag from "./need_tag";
Expand Down Expand Up @@ -59,10 +59,10 @@ const flex = css`
display: flex;
}
`;
const floatRight = css`
margin-left: auto;
order: 2;
`;
// const floatRight = css`
// margin-left: auto;
// order: 2;
// `;

const tagStyle = css`
font-size: 12px !important;
Expand Down Expand Up @@ -109,15 +109,15 @@ export class BenefitCard extends Component {
: benefit.vacNameFr
}
/>
{this.props.savedList === false ? (
{/* {this.props.savedList === false ? (
<FavouriteButton
benefit={benefit}
toggleOpenState={() => {}}
store={store}
t={t}
icon={true}
/>
) : null}
) : null} */}
</Header>
<div css={padding}>
{needsMet.length > 0 ? <Tag css={tagStyle} /> : null}
Expand Down Expand Up @@ -157,7 +157,7 @@ export class BenefitCard extends Component {
<Grid item xs={12}>
<div css={flex}>
<LearnMoreButton benefit={benefit} t={t} />
<div css={floatRight}>
{/* <div css={floatRight}>
{this.props.savedList ? (
<FavouriteButton
benefit={benefit}
Expand All @@ -166,7 +166,7 @@ export class BenefitCard extends Component {
t={t}
/>
) : null}
</div>
</div> */}
</div>
</Grid>
</Grid>
Expand Down
68 changes: 34 additions & 34 deletions components/sticky_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import PropTypes from "prop-types";
import { Grid } from "@material-ui/core";
import ShareBox from "../components/share_box";
//import EditIcon from "./icons/Edit";
import HeaderLink from "./header_link";
import SaveChecked from "./icons/SaveChecked";
// import HeaderLink from "./header_link";
// import SaveChecked from "./icons/SaveChecked";
/** @jsx jsx */
import { css, jsx } from "@emotion/core";
import { globalTheme } from "../theme";
Expand All @@ -20,30 +20,30 @@ const sticky = css`
`;

// if screen size is max.sm or smaller, hide long text
const longText = css`
@media only screen and (max-width: ${globalTheme.max.sm}) {
display: none !important;
}
`;
// const longText = css`
// @media only screen and (max-width: ${globalTheme.max.sm}) {
// display: none !important;
// }
// `;
// if screen size is min.sm or larger, hide short text
const shortText = css`
@media only screen and (min-width: ${globalTheme.min.sm}) {
display: none !important;
}
`;
// const shortText = css`
// @media only screen and (min-width: ${globalTheme.min.sm}) {
// display: none !important;
// }
// `;
const alignRight = css`
text-align: right;
`;
const savedListStyle = css`
margin-left: 50px;
padding: 0px;
font-size: 20px;
color: ${globalTheme.colour.navy};
@media only screen and (max-width: ${globalTheme.max.sm}) {
font-size: 12px !important;
margin-left: 25px;
}
`;
// const savedListStyle = css`
// margin-left: 50px;
// padding: 0px;
// font-size: 20px;
// color: ${globalTheme.colour.navy};
// @media only screen and (max-width: ${globalTheme.max.sm}) {
// font-size: 12px !important;
// margin-left: 25px;
// }
// `;
/*
const editStyle = css`
padding: 0;
Expand All @@ -56,14 +56,14 @@ const editStyle = css`
*/
export class StickyHeader extends Component {
render() {
const { t, url, favouriteBenefits, showShareLink } = this.props;
const { t, url, /*favouriteBenefits,*/ showShareLink } = this.props;

const longFavouritesText = t("favourites.saved_benefits", {
x: favouriteBenefits.length
});
const shortFavouritesText = t("favourites.saved_benefits_mobile", {
x: favouriteBenefits.length
});
// const longFavouritesText = t("favourites.saved_benefits", {
// x: favouriteBenefits.length
// });
// const shortFavouritesText = t("favourites.saved_benefits_mobile", {
// x: favouriteBenefits.length
// });

return (
<Grid item xs={12} css={sticky}>
Expand All @@ -88,15 +88,15 @@ export class StickyHeader extends Component {
{t("directory.edit_selections_mobile")}
</span>
</HeaderLink> */}
<HeaderLink
{/* <HeaderLink
css={savedListStyle}
id="savedBenefits"
href={this.props.favouritesUrl}
>
<SaveChecked />
<span css={longText}>{longFavouritesText}</span>
<span css={shortText}>{shortFavouritesText}</span>
</HeaderLink>
</HeaderLink> */}
</Grid>
</Grid>
</Grid>
Expand All @@ -106,7 +106,7 @@ export class StickyHeader extends Component {

const mapStateToProps = (reduxState, props) => {
return {
favouriteBenefits: reduxState.favouriteBenefits,
// favouriteBenefits: reduxState.favouriteBenefits,
favouritesUrl: getFavouritesUrl(reduxState, props),
summaryUrl: getSummaryUrl(reduxState, props)
};
Expand All @@ -119,8 +119,8 @@ StickyHeader.propTypes = {
printUrl: PropTypes.string.isRequired,
t: PropTypes.func.isRequired,
store: PropTypes.object,
showShareLink: PropTypes.bool,
favouriteBenefits: PropTypes.array.isRequired
showShareLink: PropTypes.bool
// favouriteBenefits: PropTypes.array.isRequired
};

export default connect(mapStateToProps)(StickyHeader);
4 changes: 4 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ Promise.resolve(getAllData()).then(allData => {
res
.status(404)
.send("The Data Validation page only exists on the staging app.");
} else if (req.url.includes("favourites") && !staging) {
res
.status(404)
.send("The Favourites page only exists on the staging app.");
} else {
const favouriteBenefits = new Cookies(req.headers.cookie).get(
"favouriteBenefits"
Expand Down