Skip to content

Commit

Permalink
fix: pageloader wrapper error case logout button addition (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
Riddhiagrawal001 authored Jun 4, 2024
1 parent d34f858 commit 4347f8d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/entryPoints/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ let make = () => {
React.null
}
<>
<PageLoaderWrapper screenState={screenState} sectionHeight="!h-screen">
<PageLoaderWrapper screenState={screenState} sectionHeight="!h-screen" showLogoutButton=true>
<div>
{switch dashboardPageState {
| #POST_LOGIN_QUES_NOT_DONE => <PostLoginScreen />
Expand Down
18 changes: 17 additions & 1 deletion src/screens/Utils/DefaultLandingPage.res
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ let make = (
~onClickHandler=_ => (),
~overriddingStylesTitle="",
~overriddingStylesSubtitle="",
~showLogoutButton=false,
) => {
open UIUtils
let appliedWidth = width === "98%" ? "98%" : width
let appliedHeight = height === "100%" ? "100%" : height

let {setAuthStatus} = React.useContext(AuthInfoProvider.authStatusContext)

let onLogoutHandle = () => {
setAuthStatus(LoggedOut)
}

<div
style={ReactDOMStyle.make(~width=appliedWidth, ~height=appliedHeight, ())}
className={`m-5 bg-white dark:bg-jp-gray-lightgray_background dark:border-jp-gray-850 flex flex-col p-5 items-center justify-center ${customStyle}`}>
Expand All @@ -28,10 +36,18 @@ let make = (
</div>
</RenderIf>
<RenderIf condition={isButton}>
<div className="mt-7">
<div className="mt-7 flex gap-4">
<Button
text={buttonText} buttonSize={Large} onClick={_ => onClickHandler()} buttonType={Primary}
/>
<UIUtils.RenderIf condition={showLogoutButton}>
<Button
text={"Logout"}
buttonSize={Large}
onClick={_ => onLogoutHandle()}
buttonType={Secondary}
/>
</UIUtils.RenderIf>
</div>
</RenderIf>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/screens/Utils/PageLoaderWrapper.res
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ let make = (
~sectionHeight="h-80-vh",
~customStyleForDefaultLandingPage="",
~customLoader=?,
~showLogoutButton=false,
) => {
switch screenState {
| Loading =>
Expand All @@ -48,6 +49,7 @@ let make = (
subtitle="We apologize for the inconvenience, but it seems like we encountered a hiccup while processing your request."
onClickHandler={_ => Window.Location.hardReload(true)}
isButton=true
showLogoutButton
/>
| Success =>
switch children {
Expand Down

0 comments on commit 4347f8d

Please sign in to comment.