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

fix: start profiling previous button #79

Merged
Merged
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
20 changes: 13 additions & 7 deletions apps/eo_web/src/screens/UserRolSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const UserRolSelector = () => {
const [searchParams] = useSearchParams();
const [selectedValue, setSelectedValue] = useState<Type>(null);
const origin = searchParams.get("origin") ?? "localhost:5173";
const channel = searchParams.get("channel") as Channel;
const symptoms = searchParams.get("symptoms") ?? "";

const {
setChannel,
Expand All @@ -28,10 +30,8 @@ export const UserRolSelector = () => {
resetProfilingStore,
setOrigin,
} = useProfilingStore((state) => state);
const redirectForm = (type: Type) => {
const channel = searchParams.get("channel") as Channel;
const symptoms = searchParams.get("symptoms") ?? "";

const redirectForm = (type: Type) => {
setOrigin(origin);
setSymptoms(symptoms.split(","));
setChannel(channel);
Expand Down Expand Up @@ -62,7 +62,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 @@ -94,7 +94,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 @@ -133,9 +133,15 @@ export const UserRolSelector = () => {
size="lg"
onClick={() => {
if (window.data.isMarketingSite(origin)) {
window.location.href = `https://${window.location.host}/pilot#how-eo-care-plans-works`;
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}/cancer-pilot#how-eo-care-plans-works`;
window.location.href = `https://${window.location.host}/pilot#how-eo-care-plans-works`;
} else {
history.back();
}
Expand Down