kopia lustrzana https://github.com/bugout-dev/moonstream
cleanup
rodzic
0915d363e9
commit
c3b481b042
|
@ -1,4 +1,10 @@
|
|||
import React, { useEffect, Suspense, useContext, useState } from "react";
|
||||
import React, {
|
||||
useLayoutEffect,
|
||||
useEffect,
|
||||
Suspense,
|
||||
useContext,
|
||||
useState,
|
||||
} from "react";
|
||||
import {
|
||||
Flex,
|
||||
Heading,
|
||||
|
@ -83,23 +89,12 @@ const Homepage = () => {
|
|||
assets["background3840"] = `${AWS_PATH}/background3840.png`;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(
|
||||
"isLargerChanged, ",
|
||||
isLargerThan720px,
|
||||
isLargerThan1920px,
|
||||
isLargerThan2880px,
|
||||
isLargerThan3840px,
|
||||
backgroundLoaded720,
|
||||
backgroundLoaded1920,
|
||||
backgroundLoaded2880,
|
||||
backgroundLoaded3840
|
||||
);
|
||||
if (isLargerThan3840px && backgroundLoaded3840) {
|
||||
useLayoutEffect(() => {
|
||||
if (backgroundLoaded3840) {
|
||||
setBackground("background3840");
|
||||
} else if (isLargerThan2880px && backgroundLoaded2880) {
|
||||
} else if (backgroundLoaded2880) {
|
||||
setBackground("background2880");
|
||||
} else if (isLargerThan1920px && backgroundLoaded1920) {
|
||||
} else if (backgroundLoaded1920) {
|
||||
setBackground("background1920");
|
||||
} else {
|
||||
setBackground("background720");
|
||||
|
@ -127,26 +122,32 @@ const Homepage = () => {
|
|||
}
|
||||
}, [isInit, router]);
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
console.log("rerender check");
|
||||
const imageLoader720 = new Image();
|
||||
imageLoader720.src = `${AWS_PATH}/background720.png`;
|
||||
imageLoader720.onload = () => {
|
||||
setBackgroundLoaded720(true);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const imageLoader1920 = new Image();
|
||||
imageLoader1920.src = `${AWS_PATH}/background1920.png`;
|
||||
imageLoader1920.onload = () => {
|
||||
setBackgroundLoaded1920(true);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const imageLoader2880 = new Image();
|
||||
imageLoader2880.src = `${AWS_PATH}/background2880.png`;
|
||||
imageLoader2880.onload = () => {
|
||||
setBackgroundLoaded2880(true);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const imageLoader3840 = new Image();
|
||||
imageLoader3840.src = `${AWS_PATH}/background3840.png`;
|
||||
imageLoader3840.onload = () => {
|
||||
|
@ -154,7 +155,6 @@ const Homepage = () => {
|
|||
};
|
||||
}, []);
|
||||
|
||||
console.log("backgroundLoaded", background);
|
||||
|
||||
return (
|
||||
<Fade in>
|
||||
|
@ -191,16 +191,18 @@ const Homepage = () => {
|
|||
minH="100vh"
|
||||
// bgColor="primary.1200"
|
||||
>
|
||||
<chakra.header boxSize="full">
|
||||
<chakra.header boxSize="full" minH="100vh">
|
||||
<Box
|
||||
// h="100%"
|
||||
// w="full"
|
||||
// transition=""
|
||||
// bgPos={["initial", "initial", "center", null, "center"]}
|
||||
bgPos="bottom"
|
||||
bgColor="transparent"
|
||||
backgroundImage={`url(${assets[`${background}`]})`}
|
||||
bgSize="cover"
|
||||
boxSize="full"
|
||||
minH="100vh"
|
||||
// bgP
|
||||
// h="container.sm"
|
||||
// h={backgroundH}
|
||||
|
|
|
@ -63,7 +63,7 @@ const EntriesNavigation = () => {
|
|||
const ui = useContext(UIContext);
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const { subscriptionsCache } = useSubscriptions();
|
||||
const [newFilterState, _setNewFilterState] = useState([
|
||||
const [newFilterState, setNewFilterState] = useState([
|
||||
{
|
||||
type: FILTER_TYPES.ADDRESS,
|
||||
direction: DIRECTIONS.SOURCE,
|
||||
|
@ -73,17 +73,6 @@ const EntriesNavigation = () => {
|
|||
]);
|
||||
const [filterState, setFilterState] = useState([]);
|
||||
|
||||
const setNewFilterState = useCallback(
|
||||
(props) => {
|
||||
console.log(
|
||||
"setNewFilterState",
|
||||
props,
|
||||
subscriptionsCache.data.subscriptions[0].id
|
||||
);
|
||||
_setNewFilterState(props);
|
||||
},
|
||||
[subscriptionsCache?.data?.subscriptions]
|
||||
);
|
||||
const loadMoreButtonRef = useRef(null);
|
||||
|
||||
const { fetchMore, isFetchingMore, canFetchMore, EntriesPages, isLoading } =
|
||||
|
|
|
@ -7,7 +7,7 @@ const Scrollable = (props) => {
|
|||
const [path, setPath] = useState();
|
||||
|
||||
const [scrollDepth, setScrollDepth] = useState(0);
|
||||
const { mixpanel } = useAnalytics();
|
||||
const { mixpanel, isLoaded } = useAnalytics();
|
||||
|
||||
const getScrollPrecent = ({ currentTarget }) => {
|
||||
const scroll_level =
|
||||
|
@ -21,9 +21,10 @@ const Scrollable = (props) => {
|
|||
if (currentScroll > scrollDepth) {
|
||||
// withTracking(
|
||||
setScrollDepth(currentScroll);
|
||||
mixpanel.people.increment({
|
||||
[`Scroll depth at: ${router.nextRouter.pathname}`]: currentScroll,
|
||||
});
|
||||
isLoaded &&
|
||||
mixpanel.people.increment({
|
||||
[`Scroll depth at: ${router.nextRouter.pathname}`]: currentScroll,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -35,14 +35,6 @@ const AnalyticsProvider = ({ children }) => {
|
|||
}, [isLoaded]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isLoaded) {
|
||||
console.log(
|
||||
"track:",
|
||||
router.nextRouter.pathname,
|
||||
router.query,
|
||||
router.params
|
||||
);
|
||||
}
|
||||
isLoaded &&
|
||||
mixpanel.track(MIXPANEL_EVENTS.PAGEVIEW, {
|
||||
url: router.nextRouter.pathname,
|
||||
|
|
Ładowanie…
Reference in New Issue