about summary refs log tree commit diff
path: root/src/platform
diff options
context:
space:
mode:
authorBryan Lee <38807139+liby@users.noreply.github.com>2023-09-29 03:47:34 +0800
committerGitHub <noreply@github.com>2023-09-28 12:47:34 -0700
commit2aae37d67bfd387802724a2a94825716746389a4 (patch)
tree77996db11ec9459b7f57bdfa18bac5aefba5f333 /src/platform
parent2e5f73ff6149f9ac2834b0417c84b76763ef5ee2 (diff)
downloadvoidsky-2aae37d67bfd387802724a2a94825716746389a4.tar.zst
Improve Device Detection For Better Responsiveness (#1512)
* Refactor `useOnMainScroll` function to use responsive device detection

- Replace static `isDesktopWeb` with `useWebMediaQueries` hook to enable dynamic device type detection.
- Create `useDeviceLimits` hook to dynamically determine `DY_LIMIT_UP` and `DY_LIMIT_DOWN` based on device type.
- Update dependency arrays for the `useCallback` hooks to include new dynamic variables.

* Refactor styles to be responsive to device type

- Create `useStyles` hook that generates styles object based on device type detected from `useWebMediaQueries`.
- Replace static styles object with dynamic styles object generated from `useStyles` hook in components.
- This allows `paddingLeft` values for 'ul' and 'ol' styles to adapt to device type dynamically.
- This allows `maxWidth` values for 'metaItem'' styles to adapt to device type dynamically.

* Remove `isDesktopWeb` in favor of `useWebMediaQueries().isDesktop`

* Refactor `SplashScreen` component for responsive design

* Revision based on review results

* Fix isNative check

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/detection.ts1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/platform/detection.ts b/src/platform/detection.ts
index d414b008c..f4f7be240 100644
--- a/src/platform/detection.ts
+++ b/src/platform/detection.ts
@@ -12,7 +12,6 @@ export const isMobileWeb =
   isWeb &&
   // @ts-ignore we know window exists -prf
   global.window.matchMedia(isMobileWebMediaQuery)?.matches
-export const isDesktopWeb = isWeb && !isMobileWeb
 
 export const deviceLocales = dedupArray(
   getLocales?.().map?.(locale => locale.languageCode),