Update deploy and develope pages
This commit is contained in:
@@ -1,8 +1,37 @@
|
|||||||
import Container from "../../components/Container";
|
import React from "react";
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
|
import Flex from "../../components/Flex";
|
||||||
|
import { useSnapshot } from "valtio";
|
||||||
|
import { state } from "../../state";
|
||||||
|
|
||||||
|
const DeployEditor = dynamic(() => import("../../components/DeployEditor"), {
|
||||||
|
ssr: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const Accounts = dynamic(() => import("../../components/Accounts"), {
|
||||||
|
ssr: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const LogBox = dynamic(() => import("../../components/LogBox"), {
|
||||||
|
ssr: false,
|
||||||
|
});
|
||||||
|
|
||||||
const Deploy = () => {
|
const Deploy = () => {
|
||||||
|
const snap = useSnapshot(state);
|
||||||
return (
|
return (
|
||||||
<Container css={{ py: "$10" }}>This will be the deploy page</Container>
|
<>
|
||||||
|
<main style={{ display: "flex", flex: 1 }}>
|
||||||
|
<DeployEditor />
|
||||||
|
</main>
|
||||||
|
<Flex css={{ flexDirection: "row", width: "100%" }}>
|
||||||
|
<Accounts />
|
||||||
|
<LogBox
|
||||||
|
title="Deploy Log"
|
||||||
|
logs={snap.deployLogs}
|
||||||
|
clearLog={() => (state.deployLogs = [])}
|
||||||
|
/>
|
||||||
|
</Flex>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,69 @@
|
|||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
|
import { useSnapshot } from "valtio";
|
||||||
|
import Hotkeys from "react-hot-keys";
|
||||||
|
import { Play } from "phosphor-react";
|
||||||
|
|
||||||
import type { NextPage } from "next";
|
import type { NextPage } from "next";
|
||||||
|
import { compileCode, state } from "../../state";
|
||||||
|
import Button from "../../components/Button";
|
||||||
|
import Box from "../../components/Box";
|
||||||
|
|
||||||
const HooksEditor = dynamic(() => import("../../components/HooksEditor"), {
|
const HooksEditor = dynamic(() => import("../../components/HooksEditor"), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const Footer = dynamic(() => import("../../components/Footer"), {
|
const LogBox = dynamic(() => import("../../components/LogBox"), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const Home: NextPage = () => {
|
const Home: NextPage = () => {
|
||||||
|
const snap = useSnapshot(state);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<main style={{ display: "flex", flex: 1 }}>
|
<main style={{ display: "flex", flex: 1, position: "relative" }}>
|
||||||
<HooksEditor />
|
<HooksEditor />
|
||||||
|
{snap.files[snap.active]?.name?.split(".")?.[1].toLowerCase() ===
|
||||||
|
"c" && (
|
||||||
|
<Hotkeys
|
||||||
|
keyName="command+b,ctrl+b"
|
||||||
|
onKeyDown={() =>
|
||||||
|
!snap.compiling && snap.files.length && compileCode(snap.active)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
variant="primary"
|
||||||
|
uppercase
|
||||||
|
disabled={!snap.files.length}
|
||||||
|
isLoading={snap.compiling}
|
||||||
|
onClick={() => compileCode(snap.active)}
|
||||||
|
css={{
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "$4",
|
||||||
|
left: "$4",
|
||||||
|
alignItems: "center",
|
||||||
|
display: "flex",
|
||||||
|
cursor: "pointer",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Play weight="bold" size="16px" />
|
||||||
|
Compile to Wasm
|
||||||
|
</Button>
|
||||||
|
</Hotkeys>
|
||||||
|
)}
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Box
|
||||||
|
css={{
|
||||||
|
display: "flex",
|
||||||
|
background: "$mauve1",
|
||||||
|
position: "relative",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LogBox
|
||||||
|
title="Development Log"
|
||||||
|
clearLog={() => (state.logs = [])}
|
||||||
|
logs={snap.logs}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user