Skip to content

Commit

Permalink
[FEATURE][CU-86dthjgaw] Previous button in profiling takes user to Pi…
Browse files Browse the repository at this point in the history
…lot page, instead of the real origin (#150)

* fix: fixing redirect back in the user rol selector view

* review: implement changes from code review
  • Loading branch information
cgarcia-lightit authored May 21, 2024
1 parent d42f48c commit e7399ae
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 43 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/eo_web/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"src": "../../packages/ui/src/assets/avatar.svg"
},
"src/main.css": {
"file": "assets/main-d7736eba.css",
"file": "assets/main-5bde4681.css",
"src": "src/main.css"
},
"src/main.tsx": {
"assets": [
"assets/UploadFile-694e44b5.svg"
],
"css": [
"assets/main-d7736eba.css"
"assets/main-5bde4681.css"
],
"file": "assets/main-c20ddb11.js",
"file": "assets/main-0aaa9b52.js",
"isEntry": true,
"src": "src/main.tsx"
}
Expand Down
57 changes: 28 additions & 29 deletions apps/eo_web/src/screens/UserRolSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { useMount } from "~/hooks/useMount";
import { LayoutDefault } from "~/layouts";
import { ROUTES } from "~/router";
import {
Flows,
useProfilingStore,
type Channel,
type FlowType,
type Type,
Flows,
} from "~/stores/useProfilingStore";


Expand All @@ -26,6 +26,8 @@ export const UserRolSelector = () => {
const flow: FlowType =
(searchParams.get("flow") as FlowType) ?? Flows.marketing_site;

const URL = localStorage.getItem("redirect_back_origin");

const {
setChannel,
setType,
Expand Down Expand Up @@ -53,6 +55,10 @@ export const UserRolSelector = () => {
: setUsePayment(true);
});

const redirectBack = () => {
if (URL) window.location.href = URL;
};

return (
<LayoutDefault>
<div className="flex h-full w-full items-center justify-center bg-opacity-50 ">
Expand All @@ -68,7 +74,7 @@ export const UserRolSelector = () => {
className={tw(
"flex h-12 items-center justify-start gap-2 rounded border border-solid border-gray-800 px-[15px] py-[9px] font-nunito text-gray-800 lg:w-1/2",
selectedValue === "Patient" &&
"border-[#5AADFD] bg-[#5AADFD] bg-opacity-20",
"border-[#5AADFD] bg-[#5AADFD] bg-opacity-20",
)}
onClick={() => setSelectedValue("Patient")}
>
Expand Down Expand Up @@ -100,7 +106,7 @@ export const UserRolSelector = () => {
className={tw(
"flex h-12 items-center justify-start gap-2 rounded border border-solid border-gray-800 px-[15px] py-[9px] font-nunito text-gray-800 lg:w-1/2",
selectedValue === "Caregiver" &&
"border-[#5AADFD] bg-[#5AADFD] bg-opacity-20",
"border-[#5AADFD] bg-[#5AADFD] bg-opacity-20",
)}
onClick={() => setSelectedValue("Caregiver")}
>
Expand Down Expand Up @@ -132,33 +138,26 @@ export const UserRolSelector = () => {
</button>
</div>
</div>
<section className="flex h-[53px] items-center justify-between rounded-b-md bg-black pb-[19px] pt-4 md:w-full ">
<Button
className="click:border-0 focus:ring-outline-0 rounded-none hover:outline-0 focus:ring-0"
variant="black"
size="lg"
onClick={() => {
if (window.data.isMarketingSite(origin)) {
if (channel === "senior") {
window.location.href = `https://${window.location.host}/you/seniors-careplan#seniors-panel`;
} else if (channel === "cancer") {
window.location.href = `https://${window.location.host}/you/cancer-careplan#cancer-panel`;
} else {
history.back();
}
} else if (window.data.isPartnerSite(origin)) {
window.location.href = `https://${window.location.host}/pilot#how-eo-care-plans-works`;
} else {
history.back();
<section
className={tw(
"flex h-[53px] items-center justify-between rounded-b-md bg-black pb-[19px] pt-4 md:w-full",
!URL && "justify-end",
)}
>
{URL && (
<Button
className="click:border-0 focus:ring-outline-0 rounded-none hover:outline-0 focus:ring-0"
variant="black"
size="lg"
onClick={redirectBack}
disabled={!URL}
left={
<icons.RightArrow className="h-6 w-6 rotate-180 text-gray-300" />
}
}}
left={
<icons.RightArrow className="h-6 w-6 rotate-180 text-gray-300" />
}
>
<span className="hidden text-gray-300 lg:flex">PREVIOUS</span>
</Button>

>
<span className="hidden text-gray-300 lg:flex">PREVIOUS</span>
</Button>
)}
<Button
className="click:border-0 focus:ring-outline-0 hidden rounded-none hover:outline-0 focus:ring-0 lg:flex"
variant="black"
Expand Down

0 comments on commit e7399ae

Please sign in to comment.