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

1322 add bookmark UI #1346

Merged
merged 21 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1a4eb70
1331 Implement search by location
schroerbrian Apr 15, 2024
64b54ce
1326 Misc search enhancements including ability to expand/collapse re…
schroerbrian Apr 17, 2024
f514492
1326 PR clean up
schroerbrian Apr 18, 2024
38a165e
Merge branch 'master' of https://github.com/ShelterTechSF/askdarcel-w…
schroerbrian Apr 22, 2024
6bdf4e8
1322 Add bookmark button element and styling
schroerbrian Apr 22, 2024
5ad7a2f
1324 Desktop and mobile styling of collapsed state of advanced search…
schroerbrian Apr 24, 2024
c69c96f
1324 Implement mobile styles and search functionality
schroerbrian Apr 25, 2024
3a729f0
Prettier
schroerbrian Apr 25, 2024
e52cf1f
Merge branch 'master' of https://github.com/ShelterTechSF/askdarcel-w…
schroerbrian Apr 30, 2024
7339d6c
1324 Add category filters to Advanced Search component
schroerbrian May 1, 2024
1f95e62
1324 Add category refinements
schroerbrian May 1, 2024
db9a495
1324 Add eligibility filter dropdowns to Advanced Search
schroerbrian May 3, 2024
aa0162b
1324 PR cleaenup and prettier
schroerbrian May 3, 2024
21336a3
Merge branch '1324-advanced-search-category-filters' into 1322-add-bo…
schroerbrian May 6, 2024
a52c80f
Merge branch 'master' of https://github.com/ShelterTechSF/askdarcel-w…
schroerbrian May 7, 2024
67698af
1322 Create add bookmark modal and functionality
schroerbrian May 9, 2024
15f16f4
1322 Hide bookmark button from un-authed users
schroerbrian May 9, 2024
6c6bcb4
1322 Fix weird merge issues and clean up PR
schroerbrian May 10, 2024
a62c9b2
1322 Small fix
schroerbrian May 10, 2024
e3680bb
1322 Initial PR feedback fixes
schroerbrian May 14, 2024
c2ee4d1
1322 More PR fixes and TODO comments
schroerbrian May 14, 2024
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
14 changes: 14 additions & 0 deletions app/components/search/SearchResults/SearchResults.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
}

.sideLinks {
display: grid;
font-weight: bold;
font-size: 18px;
color: $color-brand;
Expand Down Expand Up @@ -216,6 +217,19 @@
overflow: auto;
}

.bookmarkButton {
align-self: end;
justify-self: left;
white-space: nowrap;
@media screen and (min-width: $break-desktop) and (max-width: $break-desktop-l) {
// Positioning for small sliver of screensizes where the button can overflow
// its grid boundaries. This allows the button to overflow yet without abutting
// against content in the grid column next to it
position: relative;
right: 2px;
}
}

@media print {
// This below styles are for printing out the results on our service/search results page.

Expand Down
135 changes: 79 additions & 56 deletions app/components/search/SearchResults/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
connectStateResults,
SearchResults as SearchResultsProps,
} from "react-instantsearch/connectors";
import { whiteLabel } from "utils";
import { useAppContext, whiteLabel } from "utils";
import { CATEGORIES } from "pages/ServiceDiscoveryForm/constants";
import { SearchMap } from "components/search/SearchMap/SearchMap";
import ResultsPagination from "components/search/Pagination/ResultsPagination";
Expand All @@ -14,6 +14,7 @@ import { Texting } from "components/Texting";
import { ClinicianActions } from "components/ucsf/ClinicianActions/ClinicianActions";
import { ClientHandouts } from "components/ui/ClientHandoutsModal/ClientHandouts";
import { TextListing } from "components/Texting/Texting";
import { BookmarkModal } from "components/ui/BookmarkModal/BookmarkModal";
import { Button } from "components/ui/inline/Button/Button";
import { SearchHit, transformHits } from "../../../models/SearchHits";
import { icon } from "../../../assets";
Expand Down Expand Up @@ -183,9 +184,11 @@ const SearchResult = ({
expanded: boolean;
onToggle: () => void;
}) => {
const { authState } = useAppContext();
const [textingIsOpen, setTextingIsOpen] = useState(false);
const [clinicianActionsIsOpen, setClinicianActionsIsOpen] = useState(false);
const [handoutModalIsOpen, setHandoutModalIsOpen] = useState(false);
const [bookmarkModalIsOpen, setBookmarkModalIsOpen] = useState(false);

type HandoutLanguage = "es" | "tl" | "zh-TW" | "vi" | "ru" | "ar";
const handoutUrl = (hitId: number, language: HandoutLanguage | null) => {
Expand Down Expand Up @@ -215,6 +218,10 @@ const SearchResult = ({
}

const toggleTextingModal = () => setTextingIsOpen(!textingIsOpen);
// TODO: this bookmarkAdded boolean should be set in accordance with the value of the bookmark model
// returned by the API. Fetching the model from the API will need to be done in such a way that it does not
// block the rendering of the search results and yet does not cause the button to flash in a distracting manner
const bookmarkAdded = false;

const texting = (
<div
Expand All @@ -236,6 +243,7 @@ const SearchResult = ({
const toggleClinicianActionsModal = () => {
setClinicianActionsIsOpen(!clinicianActionsIsOpen);
};

const toggleHandoutModal = () => {
setHandoutModalIsOpen(!handoutModalIsOpen);
};
Expand Down Expand Up @@ -419,62 +427,77 @@ const SearchResult = ({
)}
</div>

<div className={styles.sideLinks}>
{expanded && (
<>
<div
className={
showDischargeSidelinks ? "" : styles.hideDischargeSidelinks
}
>
{hit.type === "service" &&
!!hit.instructions?.length &&
clinicianActionsLink}
{handoutsLink}
</div>
<div
className={
showDischargeSidelinks ? styles.deemphasizeSideLinks : ""
}
>
{phoneNumber && (
<div
className={`${styles.sideLink} ${styles.showInPrintView}`}
{expanded && (
<div className={styles.sideLinks}>
<div
className={
showDischargeSidelinks ? "" : styles.hideDischargeSidelinks
}
>
{hit.type === "service" &&
!!hit.instructions?.length &&
clinicianActionsLink}
{handoutsLink}
</div>
<div
className={
showDischargeSidelinks ? styles.deemphasizeSideLinks : ""
}
>
{phoneNumber && (
<div className={`${styles.sideLink} ${styles.showInPrintView}`}>
<img
src={icon("phone-blue")}
alt="phone"
className={styles.sideLinkIcon}
/>
<a
href={`tel:${phoneNumber}`}
className={styles.sideLinkText}
>{`Call ${formatPhoneNumber(phoneNumber)}`}</a>
</div>
)}
<div />
{url && (
<div className={styles.sideLink}>
<img
src={icon("popout-blue")}
alt="website"
className={styles.sideLinkIcon}
/>
<a
target="_blank"
rel="noopener noreferrer"
href={url}
className={styles.sideLinkText}
>
<img
src={icon("phone-blue")}
alt="phone"
className={styles.sideLinkIcon}
/>
<a
href={`tel:${phoneNumber}`}
className={styles.sideLinkText}
>{`Call ${formatPhoneNumber(phoneNumber)}`}</a>
</div>
)}
<div />
{url && (
<div className={styles.sideLink}>
<img
src={icon("popout-blue")}
alt="website"
className={styles.sideLinkIcon}
/>
<a
target="_blank"
rel="noopener noreferrer"
href={url}
className={styles.sideLinkText}
>
Go to website
</a>
</div>
)}
{texting}
</div>
</>
)}
</div>
Go to website
</a>
</div>
)}
{texting}
</div>

{authState && (
<>
<Button
onClick={() => {
setBookmarkModalIsOpen(true);
}}
addClass={styles.bookmarkButton}
styleType={bookmarkAdded ? "default" : "transparent"}
>
{bookmarkAdded ? "Bookmark Added" : "Add Bookmark"}
</Button>
<BookmarkModal
isOpen={bookmarkModalIsOpen}
setIsOpen={setBookmarkModalIsOpen}
hit={hit}
/>
</>
)}
</div>
)}
</div>
</div>
);
Expand Down
190 changes: 190 additions & 0 deletions app/components/ui/BookmarkModal/BookmarkModal.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
@import "~styles/utils/_helpers.scss";

.bookmarkModal {
width: 600px;
padding: 33px;
@media screen and (max-width: $break-tablet-s) {
max-width: 600px;
width: 100vw;
schroerbrian marked this conversation as resolved.
Show resolved Hide resolved
padding: 20px 0 0;
}
}

.title {
font-size: 40px;
font-weight: 700;
line-height: 1;
text-align: center;
color: #000;
margin-bottom: 20px;
@media screen and (max-width: $break-tablet-s) {
font-size: 28px;
}
}

.modalContent {
display: grid;
gap: 35px;
padding: 35px;
background-color: #f5f5f5;
@media screen and (max-width: $break-tablet-s) {
padding: 20px 0;
}
}

.bookmarkDescription {
border-radius: 8px;
background-color: #fff;
display: grid;
grid-template-areas:
"icon name"
"icon url";
grid-template-columns: 60px auto;
column-gap: 20px;
padding: 15px;
.bookmarkIcon {
// Nested style to override default material-icons styles
grid-area: icon;
width: 60px;
height: auto;
font-size: 60px;
color: $color-brand;
align-self: center;
}
}

.clearBookmarkButton {
background-color: transparent;
padding: 0;
height: auto;
align-self: start;
&:hover,
&:focus {
box-shadow: none;
border: 0;
opacity: 0.7;
}
}

.clearBookmarkText {
cursor: pointer;
color: #636363;
}

.bookmarkNameContainer {
grid-area: name;
display: flex;
gap: 10px;
}

.bookmarkName {
background-color: #fff;
height: 35px;
border: none;
padding: 3px 3px 10px;
font-size: 16px;
&:hover,
&:focus {
box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
}
}

.bookmarkUrl {
border-top: solid 1px #f5f5f5;
grid-area: url;
height: 35px;
padding-top: 10px;
display: flex;
align-items: center;
cursor: default;
}

.selectFolderContainer {
border-radius: 8px;
background-color: #fff;
position: relative;
z-index: 1;
}

.selectFolder {
cursor: default;
display: flex;
justify-content: space-between;
padding: 13px 18px 8px;
}

.placeholder {
color: #aaa;
}

.bookmarkFoldersList {
display: flex;
flex-direction: column;
max-height: 110px;
overflow-y: scroll;
position: absolute;
right: 0;
left: 0;
background: #fff;
}

.folderListItem {
cursor: pointer;
display: flex;
align-items: center;
gap: 18px;
padding: 5px 8px;
.folderIcon {
color: #d1d1d1;
}
&:hover {
background-color: #edf5fed9;
}
}

.addFolderItem {
padding: 0 10px;
border-top: solid 1px #f5f5f5;
cursor: default;
gap: 5px;
&:hover {
background-color: inherit;
}
}

.addFolderLabel {
width: 21px;
height: 21px;
border-radius: 4px;
background-color: #d1d1d1;
color: #fff;
font-weight: 500;
text-align: center;
}

.addFolderInput {
padding: 6px 14px;
background-color: #fff;
border: none;
font-size: 16px;

&:hover,
&:focus {
box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
}
}

.label {
color: $color-grey5;
text-transform: uppercase;
margin: 30px 3px 5px;
}

.buttonBar {
display: flex;
justify-content: center;
}

.addBookmarkBtn {
width: 200px;
}
Loading
Loading