@@ -2,17 +2,16 @@ import React, { useEffect, useState } from "react";
22import { useTradeStore } from "@/stores/tradeStore" ;
33import { useClientStore } from "@/stores/clientStore" ;
44import { BottomSheetHeader } from "@/components/ui/bottom-sheet-header" ;
5- import { useDeviceDetection } from "@/hooks/useDeviceDetection" ;
65import { useBottomSheetStore } from "@/stores/bottomSheetStore" ;
76import { useDebounce } from "@/hooks/useDebounce" ;
87import { StakeInputLayout } from "./components/StakeInputLayout" ;
98import { PrimaryButton } from "@/components/ui/primary-button" ;
109import { parseStakeAmount , STAKE_CONFIG } from "@/config/stake" ;
11- import { DesktopTradeFieldCard } from "@/components/ui/desktop-trade-field-card" ;
1210import { validateStake } from "./utils/validation" ;
1311import { parseDuration , formatDuration } from "@/utils/duration" ;
1412import { createSSEConnection } from "@/services/api/sse/createSSEConnection" ;
1513import { tradeTypeConfigs } from "@/config/tradeTypes" ;
14+ import { useOrientationStore } from "@/stores/orientationStore" ;
1615
1716interface ButtonState {
1817 loading : boolean ;
@@ -28,7 +27,7 @@ interface StakeControllerProps {}
2827export const StakeController : React . FC < StakeControllerProps > = ( ) => {
2928 const { stake, setStake, trade_type, duration, payouts, setPayouts } = useTradeStore ( ) ;
3029 const { currency, token } = useClientStore ( ) ;
31- const { isDesktop } = useDeviceDetection ( ) ;
30+ const { isLandscape } = useOrientationStore ( ) ;
3231 const { setBottomSheet } = useBottomSheetStore ( ) ;
3332
3433 const [ localStake , setLocalStake ] = React . useState ( stake ) ;
@@ -184,7 +183,7 @@ export const StakeController: React.FC<StakeControllerProps> = () => {
184183 const handleStakeChange = ( value : string ) => {
185184 if ( preventExceedingMax ( value ) ) return ;
186185
187- if ( isDesktop ) {
186+ if ( isLandscape ) {
188187 setLocalStake ( value ) ;
189188 validateStakeOnly ( value ) ;
190189 return ;
@@ -195,18 +194,18 @@ export const StakeController: React.FC<StakeControllerProps> = () => {
195194 } ;
196195
197196 useEffect ( ( ) => {
198- if ( ! isDesktop ) return ;
197+ if ( ! isLandscape ) return ;
199198
200199 if ( debouncedStake !== stake ) {
201200 const validation = validateStakeOnly ( debouncedStake ) ;
202201 if ( ! validation . error ) {
203202 setStake ( debouncedStake ) ;
204203 }
205204 }
206- } , [ isDesktop , debouncedStake , stake ] ) ;
205+ } , [ isLandscape , debouncedStake , stake ] ) ;
207206
208207 const handleSave = ( ) => {
209- if ( isDesktop ) return ;
208+ if ( isLandscape ) return ;
210209
211210 const validation = validateAndUpdateStake ( localStake ) ;
212211 if ( validation . error ) return ;
@@ -217,7 +216,7 @@ export const StakeController: React.FC<StakeControllerProps> = () => {
217216
218217 const content = (
219218 < >
220- { ! isDesktop && < BottomSheetHeader title = "Stake" /> }
219+ { ! isLandscape && < BottomSheetHeader title = "Stake" /> }
221220 < div className = "flex flex-col justify-between flex-grow px-6" >
222221 < StakeInputLayout
223222 value = { localStake }
@@ -226,15 +225,15 @@ export const StakeController: React.FC<StakeControllerProps> = () => {
226225 errorMessage = { errorMessage }
227226 maxPayout = { payouts . max }
228227 payoutValues = { payouts . values }
229- isDesktop = { isDesktop }
228+ isDesktop = { isLandscape }
230229 loading = { Object . values ( buttonStates ) . some ( state => state . loading ) }
231230 loadingStates = { Object . keys ( buttonStates ) . reduce ( ( acc , key ) => ( {
232231 ...acc ,
233232 [ key ] : buttonStates [ key ] . loading
234233 } ) , { } ) }
235234 />
236235 </ div >
237- { ! isDesktop && (
236+ { ! isLandscape && (
238237 < div className = "w-full py-6 px-3" >
239238 < PrimaryButton
240239 className = "rounded-3xl"
@@ -248,7 +247,7 @@ export const StakeController: React.FC<StakeControllerProps> = () => {
248247 </ >
249248 ) ;
250249
251- if ( isDesktop ) {
250+ if ( isLandscape ) {
252251 return (
253252 < div className = "w-[480px]" > { content } </ div >
254253 ) ;
0 commit comments