mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Remove unused services and refactor SDK structure
Deleted outdated SDKs and services, including DocumentService and markdown-sdk. Consolidated and relocated SDKs into a unified "providers" structure to improve maintainability. Updated imports and adjusted utils naming for consistency.
This commit is contained in:

committed by
Geoff Seemueller

parent
ceeefeff14
commit
fc22278b58
@@ -1,6 +1,7 @@
|
||||
import { Flex } from "@chakra-ui/react";
|
||||
import React from "react";
|
||||
import { useIsMobile } from "../components/contexts/MobileContext";
|
||||
|
||||
function Content({ children }) {
|
||||
const isMobile = useIsMobile();
|
||||
return (
|
||||
|
@@ -1,19 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useMediaQuery } from "@chakra-ui/react";
|
||||
|
||||
// Only use this when it is necessary to style responsively outside a MobileProvider.
|
||||
export function useIsMobile() {
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
const [isFallbackMobile] = useMediaQuery("(max-width: 768px)");
|
||||
|
||||
useEffect(() => {
|
||||
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
||||
const mobile =
|
||||
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(
|
||||
userAgent.toLowerCase(),
|
||||
);
|
||||
setIsMobile(mobile);
|
||||
}, []);
|
||||
|
||||
return isMobile || isFallbackMobile;
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useIsMobile } from "../components/contexts/MobileContext";
|
||||
|
||||
export const useMaxWidth = () => {
|
||||
const isMobile = useIsMobile();
|
||||
const [maxWidth, setMaxWidth] = useState("600px");
|
||||
|
||||
const calculateMaxWidth = () => {
|
||||
if (isMobile) {
|
||||
setMaxWidth("800px");
|
||||
} else if (window.innerWidth < 1024) {
|
||||
setMaxWidth("500px");
|
||||
} else {
|
||||
setMaxWidth("800px");
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
calculateMaxWidth();
|
||||
|
||||
const handleResize = () => {
|
||||
calculateMaxWidth();
|
||||
};
|
||||
|
||||
window.addEventListener("resize", handleResize);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("resize", handleResize);
|
||||
};
|
||||
}, [isMobile]);
|
||||
|
||||
return maxWidth;
|
||||
};
|
@@ -1,26 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const usePageLoaded = (callback: () => void) => {
|
||||
const [isLoaded, setIsLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handlePageLoad = () => {
|
||||
setIsLoaded(true);
|
||||
callback();
|
||||
};
|
||||
|
||||
if (document.readyState === "complete") {
|
||||
// Page is already fully loaded
|
||||
handlePageLoad();
|
||||
} else {
|
||||
// Wait for the page to load
|
||||
window.addEventListener("load", handlePageLoad);
|
||||
}
|
||||
|
||||
return () => window.removeEventListener("load", handlePageLoad);
|
||||
}, [callback]);
|
||||
|
||||
return isLoaded;
|
||||
};
|
||||
|
||||
export default usePageLoaded;
|
Reference in New Issue
Block a user