Skip to content

Commit

Permalink
Merge pull request #4643 from CrocSwap/increase-chart-idle-timer-to-6…
Browse files Browse the repository at this point in the history
…0-min

increase timeout for chart display to 60 minutes
  • Loading branch information
benwolski authored Jan 15, 2025
2 parents 670625e + 5e9e602 commit e34e4f4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/contexts/AppStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface AppStateContextIF {
close: () => void;
};
isUserIdle: boolean;
isUserIdle40min: boolean;
isUserIdle60min: boolean;
activeNetwork: NetworkIF;
chooseNetwork: (network: NetworkIF) => void;
layout: {
Expand All @@ -65,7 +65,7 @@ export const AppStateContextProvider = (props: {
const [isChatEnabled, setIsChatEnabled] = useState(CHAT_ENABLED);
const [isUserOnline, setIsUserOnline] = useState(navigator.onLine);
const [isUserIdle, setIsUserIdle] = useState(false);
const [isUserIdle40min, setIsUserIdle40min] = useState(false);
const [isUserIdle60min, setIsUserIdle60min] = useState(false);

// layout---------------

Expand Down Expand Up @@ -141,13 +141,13 @@ export const AppStateContextProvider = (props: {
setIsUserIdle(true);
};

const onIdle40 = () => {
setIsUserIdle40min(true);
const onIdle60min = () => {
setIsUserIdle60min(true);
};

const onActive = () => {
setIsUserIdle(false);
setIsUserIdle40min(false);
setIsUserIdle60min(false);
};

// Custom visibility change handler to trigger onActive when the tab becomes visible
Expand Down Expand Up @@ -203,9 +203,9 @@ export const AppStateContextProvider = (props: {
});

useIdleTimer({
onIdle: onIdle40,
onIdle: onIdle60min,
onActive,
timeout: 1000 * 60 * 40, // set user to idle after 40 minutes
timeout: 1000 * 60 * 60, // set user to idle after 60 minutes
promptTimeout: 0,
events: [
'mousemove',
Expand Down Expand Up @@ -278,7 +278,7 @@ export const AppStateContextProvider = (props: {
server: { isEnabled: isServerEnabled },
isUserOnline,
isUserIdle,
isUserIdle40min,
isUserIdle60min,
subscriptions: { isEnabled: areSubscriptionsEnabled },
walletModal: {
isOpen: isGateWalletModalOpen,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/platformAmbient/Chart/Draw/Toolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function ChartToolbar() {

const [isHoveredUp, setIsHoveredUp] = useState(false);
const [isHoveredDown, setIsHoveredDown] = useState(false);
const { isUserIdle40min } = useContext(AppStateContext);
const { isUserIdle60min } = useContext(AppStateContext);

const [hoveredTool, setHoveredTool] = useState<string | undefined>(
undefined,
Expand Down Expand Up @@ -321,7 +321,7 @@ function ChartToolbar() {

return chartContainerOptions &&
chartContainerOptions.top !== 0 &&
!isUserIdle40min ? (
!isUserIdle60min ? (
<ToolbarContainer
isActive={isToolbarOpen}
isMobile={mobileView}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function TradeCandleStickChart(props: propsIF) {

const {
activeNetwork: { gridSize, poolIndex, chainId },
isUserIdle40min,
isUserIdle60min,
} = useContext(AppStateContext);

const { setMinRangePrice: setMinPrice, setMaxRangePrice: setMaxPrice } =
Expand Down Expand Up @@ -1131,7 +1131,7 @@ function TradeCandleStickChart(props: propsIF) {
</div>
</>
)}
{isOpenChart && !isUserIdle40min && (
{isOpenChart && !isUserIdle60min && (
<>
<ChartTooltip
currentData={currentData}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ function TradeCandleStickChart(props: propsIF) {
)}

{!(!isOpenChart || isCompletedFetchData) &&
isUserIdle40min &&
isUserIdle60min &&
skeletonChart}
</div>
</>
Expand Down

0 comments on commit e34e4f4

Please sign in to comment.