Skip to content

Commit

Permalink
Merge branch 'develop' into rearrange-landing-sections-largedevices
Browse files Browse the repository at this point in the history
  • Loading branch information
benwolski authored Jan 15, 2025
2 parents 6a37b51 + 3533284 commit c854710
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 319 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ambient-ts-app",
"version": "3.1.12",
"version": "3.1.13",
"private": true,
"type": "module",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/ambient-utils/constants/networks/scrollMainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export const scrollMainnet: NetworkIF = {
topPools: [
new TopPool(scrollETH, scrollUSDC, chainSpecFromSDK.poolIndex),
new TopPool(scrollUSDT, scrollUSDC, chainSpecFromSDK.poolIndex),
new TopPool(scrollETH, scrollUSDT, chainSpecFromSDK.poolIndex),
new TopPool(scrollSCR, scrollETH, chainSpecFromSDK.poolIndex),
new TopPool(scrollETH, scrollUSDT, chainSpecFromSDK.poolIndex),
new TopPool(scrollETH, scrollWBTC, chainSpecFromSDK.poolIndex),
],
getGasPriceInGwei: async (provider?: Provider) => {
Expand Down
6 changes: 3 additions & 3 deletions src/ambient-utils/constants/networks/swellMainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Provider } from 'ethers';
import { NetworkIF } from '../../types/NetworkIF';
import {
swellETH,
swellEZETH,
swellRSETH,
swellRSWETH,
swellSWELL,
swellUSDE,
Expand Down Expand Up @@ -60,9 +60,9 @@ export const swellMainnet: NetworkIF = {
topPools: [
new TopPool(swellETH, swellUSDE, chainSpecFromSDK.poolIndex),
new TopPool(swellWEETH, swellRSWETH, chainSpecFromSDK.poolIndex),
new TopPool(swellEZETH, swellETH, chainSpecFromSDK.poolIndex),
new TopPool(swellRSWETH, swellETH, chainSpecFromSDK.poolIndex),
new TopPool(swellRSETH, swellWEETH, chainSpecFromSDK.poolIndex),
new TopPool(swellETH, swellSWELL, chainSpecFromSDK.poolIndex),
new TopPool(swellRSWETH, swellETH, chainSpecFromSDK.poolIndex),
],
getGasPriceInGwei: async (provider?: Provider) => {
if (!provider) return 0;
Expand Down
21 changes: 21 additions & 0 deletions src/components/Global/TabComponent/TabComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,27 @@ export default function TabComponent(props: TabPropsIF) {
if (tradeTableState === 'Collapsed') toggleTradeTable();
}

useEffect(() => {
const currentTabData = data.find(
(item) => item.label === selectedTab.label,
);
if (currentTabData) {
setSelectedTab(currentTabData);
if (
[
'transactions',
'limits',
'liquidity',
'wallet balances',
'exchange balances',
'dex balances',
].includes(currentTabData.label.toLowerCase())
) {
setActiveTradeTab(currentTabData.label.toLowerCase());
}
}
}, [data, selectedTab.label]);

function handleOutside2() {
if (!outsideControl) {
return;
Expand Down
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
Loading

0 comments on commit c854710

Please sign in to comment.