Add public mode
This commit is contained in:
@@ -13,8 +13,10 @@ import { fmtDateFromTime, time } from "../utils/DateUtils";
|
||||
import { AmountWidget } from "../widgets/AmountWidget";
|
||||
import { AsyncWidget } from "../widgets/AsyncWidget";
|
||||
import { MoneyMgrWebRouteContainer } from "../widgets/MoneyMgrWebRouteContainer";
|
||||
import { usePublicMode } from "../hooks/context_providers/PublicModeProvider";
|
||||
|
||||
export function HomeRoute(): React.ReactElement {
|
||||
const publicMode = usePublicMode().enabled;
|
||||
const account = useAccounts();
|
||||
|
||||
const loadKey = React.useRef(1);
|
||||
@@ -62,13 +64,28 @@ export function HomeRoute(): React.ReactElement {
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
<AsyncWidget
|
||||
ready={global !== undefined}
|
||||
loadKey={loadKey.current}
|
||||
load={load}
|
||||
errMsg="Failed to load statistics!"
|
||||
build={() => <StatsDashboard global={global!} lastYear={lastYear!} />}
|
||||
/>
|
||||
{publicMode ? (
|
||||
<Typography
|
||||
variant="body1"
|
||||
style={{
|
||||
textAlign: "center",
|
||||
flex: 1,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
Dasbhoard is hidden when public mode is enabled.
|
||||
</Typography>
|
||||
) : (
|
||||
<AsyncWidget
|
||||
ready={global !== undefined}
|
||||
loadKey={loadKey.current}
|
||||
load={load}
|
||||
errMsg="Failed to load statistics!"
|
||||
build={() => <StatsDashboard global={global!} lastYear={lastYear!} />}
|
||||
/>
|
||||
)}
|
||||
</MoneyMgrWebRouteContainer>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user