Compare commits
1 Commits
fix/do-not
...
fix/sample
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f8f47cb14 |
@@ -15,6 +15,7 @@ import state from "../state";
|
|||||||
|
|
||||||
import TimeAgo from "javascript-time-ago";
|
import TimeAgo from "javascript-time-ago";
|
||||||
import en from "javascript-time-ago/locale/en.json";
|
import en from "javascript-time-ago/locale/en.json";
|
||||||
|
import { useSnapshot } from "valtio";
|
||||||
TimeAgo.addDefaultLocale(en);
|
TimeAgo.addDefaultLocale(en);
|
||||||
|
|
||||||
function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
|
function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
|
||||||
@@ -25,15 +26,29 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
|
|||||||
const origin = "https://xrpl-hooks-ide.vercel.app"; // TODO: Change when site is deployed
|
const origin = "https://xrpl-hooks-ide.vercel.app"; // TODO: Change when site is deployed
|
||||||
const shareImg = "/share-image.png";
|
const shareImg = "/share-image.png";
|
||||||
|
|
||||||
|
const snap = useSnapshot(state);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (gistId && router.isReady) {
|
if (gistId && router.isReady) {
|
||||||
fetchFiles(gistId);
|
fetchFiles(gistId);
|
||||||
} else {
|
} else {
|
||||||
if (!gistId && router.isReady && !router.pathname.includes("/sign-in")) {
|
if (
|
||||||
|
!gistId &&
|
||||||
|
router.isReady &&
|
||||||
|
!router.pathname.includes("/sign-in") &&
|
||||||
|
!snap.files.length &&
|
||||||
|
!snap.mainModalShowed
|
||||||
|
) {
|
||||||
state.mainModalOpen = true;
|
state.mainModalOpen = true;
|
||||||
|
state.mainModalShowed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [gistId, router.isReady, router.pathname]);
|
}, [
|
||||||
|
gistId,
|
||||||
|
router.isReady,
|
||||||
|
router.pathname,
|
||||||
|
snap.files,
|
||||||
|
snap.mainModalShowed,
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ export interface IState {
|
|||||||
client: XrplClient | null;
|
client: XrplClient | null;
|
||||||
clientStatus: "offline" | "online";
|
clientStatus: "offline" | "online";
|
||||||
mainModalOpen: boolean;
|
mainModalOpen: boolean;
|
||||||
|
mainModalShowed: boolean;
|
||||||
accounts: IAccount[];
|
accounts: IAccount[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@ let initialState: IState = {
|
|||||||
client: null,
|
client: null,
|
||||||
clientStatus: "offline" as "offline",
|
clientStatus: "offline" as "offline",
|
||||||
mainModalOpen: false,
|
mainModalOpen: false,
|
||||||
|
mainModalShowed: false,
|
||||||
accounts: [],
|
accounts: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user