diff --git a/components/Accounts.tsx b/components/Accounts.tsx index 9a15472..ea60a4c 100644 --- a/components/Accounts.tsx +++ b/components/Accounts.tsx @@ -186,7 +186,7 @@ const AccountDialog = ({ diff --git a/components/Button.tsx b/components/Button.tsx index f982942..d975f51 100644 --- a/components/Button.tsx +++ b/components/Button.tsx @@ -91,26 +91,26 @@ export const StyledButton = styled("button", { }, }, primary: { - backgroundColor: `$pink9`, - boxShadow: "inset 0 0 0 1px $colors$pink9", + backgroundColor: `$accent`, + boxShadow: "inset 0 0 0 1px $colors$purple9", color: "$white", "@hover": { "&:hover": { - backgroundColor: "$pink10", - boxShadow: "inset 0 0 0 1px $colors$pink11", + backgroundColor: "$purple10", + boxShadow: "inset 0 0 0 1px $colors$purple11", }, }, "&:active": { - backgroundColor: "$pink8", - boxShadow: "inset 0 0 0 1px $colors$pink8", + backgroundColor: "$purple8", + boxShadow: "inset 0 0 0 1px $colors$purple8", }, "&:focus": { - boxShadow: "inset 0 0 0 2px $colors$pink12", + boxShadow: "inset 0 0 0 2px $colors$purple12", }, '&[data-radix-popover-trigger][data-state="open"], &[data-radix-dropdown-menu-trigger][data-state="open"]': { backgroundColor: "$mauve4", - boxShadow: "inset 0 0 0 1px $colors$pink8", + boxShadow: "inset 0 0 0 1px $colors$purple8", }, }, secondary: { diff --git a/components/DeployEditor.tsx b/components/DeployEditor.tsx index c658f8f..80906ab 100644 --- a/components/DeployEditor.tsx +++ b/components/DeployEditor.tsx @@ -34,7 +34,7 @@ const DeployEditor = () => { display: "flex", position: "relative", flexDirection: "column", - backgroundColor: "$mauve3", + backgroundColor: "$mauve2", width: "100%", }} > diff --git a/components/DropdownMenu.tsx b/components/DropdownMenu.tsx index 26adfc3..329c6a7 100644 --- a/components/DropdownMenu.tsx +++ b/components/DropdownMenu.tsx @@ -71,7 +71,7 @@ const itemStyles = { }, "&:focus": { - backgroundColor: "$pink9", + backgroundColor: "$purple9", color: "$white", }, }; @@ -85,8 +85,8 @@ const StyledRadioItem = styled(DropdownMenuPrimitive.RadioItem, { }); const StyledTriggerItem = styled(DropdownMenuPrimitive.TriggerItem, { '&[data-state="open"]': { - backgroundColor: "$pink9", - color: "$pink9", + backgroundColor: "$purple9", + color: "$purple9", }, ...itemStyles, }); diff --git a/components/EditorNavigation.tsx b/components/EditorNavigation.tsx index 270548d..d7e20cd 100644 --- a/components/EditorNavigation.tsx +++ b/components/EditorNavigation.tsx @@ -26,7 +26,12 @@ import NewWindow from "react-new-window"; import { signOut, useSession } from "next-auth/react"; import { useSnapshot } from "valtio"; -import { createNewFile, syncToGist, updateEditorSettings, downloadAsZip } from "../state/actions"; +import { + createNewFile, + syncToGist, + updateEditorSettings, + downloadAsZip, +} from "../state/actions"; import state from "../state"; import Box from "./Box"; import Button from "./Button"; @@ -57,7 +62,7 @@ import { styled } from "../stitches.config"; const DEFAULT_EXTENSION = ".c"; const ErrorText = styled(Text, { - color: "$red9", + color: "$crimson9", mt: "$1", display: "block", }); @@ -85,7 +90,7 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { const validateFilename = useCallback( (filename: string): { error: string | null } => { - if (snap.files.find(file => file.name === filename)) { + if (snap.files.find((file) => file.name === filename)) { return { error: "Filename already exists." }; } // More checks in future @@ -95,7 +100,9 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { ); const handleConfirm = useCallback(() => { // add default extension in case omitted - let _filename = filename.includes(".") ? filename : filename + DEFAULT_EXTENSION; + let _filename = filename.includes(".") + ? filename + : filename + DEFAULT_EXTENSION; const chk = validateFilename(_filename); if (chk.error) { setNewfileError(`Error: ${chk.error}`); @@ -139,7 +146,9 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { return ( @@ -196,8 +214,8 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { setFilename(e.target.value)} - onKeyPress={e => { + onChange={(e) => setFilename(e.target.value)} + onKeyPress={(e) => { if (e.key === "Enter") { handleConfirm(); } @@ -216,10 +234,7 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { - @@ -237,11 +252,13 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { - + {status === "authenticated" ? ( @@ -274,10 +291,15 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { signOut()}> - {session?.user?.username} ({session?.user.name}) + {session?.user?.username} ( + {session?.user.name}) window.open(`http://gist.github.com/${session?.user.username}`)} + onClick={() => + window.open( + `http://gist.github.com/${session?.user.username}` + ) + } > Go to your Gist @@ -291,7 +313,12 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { ) : ( - )} @@ -330,7 +357,13 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { }, }} > - - + Download as ZIP { Copy share link to clipboard { syncToGist(session); }} @@ -409,15 +449,21 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { - {popup && !session ? : null} + {popup && !session ? ( + + ) : null} - setCreateNewAlertOpen(value)}> + setCreateNewAlertOpen(value)} + > Are you sure? - This action will create new public Github Gist from your current saved - files. You can delete gist anytime from your GitHub Gists page. + This action will create new public Github Gist from + your current saved files. You can delete gist anytime from your + GitHub Gists page. @@ -451,8 +497,8 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { type="number" min="1" value={editorSettings.tabSize} - onChange={e => - setEditorSettings(curr => ({ + onChange={(e) => + setEditorSettings((curr) => ({ ...curr, tabSize: Number(e.target.value), })) @@ -462,12 +508,18 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => { - - diff --git a/components/HooksEditor.tsx b/components/HooksEditor.tsx index bc46f4e..2a990cc 100644 --- a/components/HooksEditor.tsx +++ b/components/HooksEditor.tsx @@ -29,7 +29,7 @@ loader.config({ const validateWritability = (editor: monaco.editor.IStandaloneCodeEditor) => { const currPath = editor.getModel()?.uri.path; - if (apiHeaderFiles.find(h => currPath?.endsWith(h))) { + if (apiHeaderFiles.find((h) => currPath?.endsWith(h))) { editor.updateOptions({ readOnly: true }); } else { editor.updateOptions({ readOnly: false }); @@ -60,7 +60,7 @@ const HooksEditor = () => { display: "flex", position: "relative", flexDirection: "column", - backgroundColor: "$mauve3", + backgroundColor: "$mauve2", width: "100%", }} > @@ -73,9 +73,9 @@ const HooksEditor = () => { language={snap.files?.[snap.active]?.language} path={`file:///work/c/${snap.files?.[snap.active]?.name}`} defaultValue={snap.files?.[snap.active]?.content} - beforeMount={monaco => { + beforeMount={(monaco) => { if (!snap.editorCtx) { - snap.files.forEach(file => + snap.files.forEach((file) => monaco.editor.createModel( file.content, file.language, @@ -100,7 +100,7 @@ const HooksEditor = () => { // listen when the web socket is opened listen({ webSocket: webSocket as WebSocket, - onConnection: connection => { + onConnection: (connection) => { // create and start the language client const languageClient = createLanguageClient(connection); const disposable = languageClient.start(); @@ -139,10 +139,13 @@ const HooksEditor = () => { enabled: true, }, }); - editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => { - saveFile(); - }); - validateWritability(editor) + editor.addCommand( + monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, + () => { + saveFile(); + } + ); + validateWritability(editor); }} theme={theme === "dark" ? "dark" : "light"} /> @@ -160,7 +163,9 @@ const HooksEditor = () => { - + - ); diff --git a/components/Navigation.tsx b/components/Navigation.tsx index 8e9dbdd..3aabe72 100644 --- a/components/Navigation.tsx +++ b/components/Navigation.tsx @@ -40,6 +40,7 @@ const Navigation = () => { as="nav" css={{ display: "flex", + backgroundColor: "$mauve1", borderBottom: "1px solid $mauve6", position: "relative", zIndex: 2003, @@ -61,7 +62,7 @@ const Navigation = () => { pr: "$4", }} > - + { color: "$textColor", }} > - + { css={{ fontSize: "$xs", color: "$mauve10", lineHeight: 1 }} > {snap.files.length > 0 ? "Gist: " : "Playground"} - - {snap.files.length > 0 && - `${snap.gistOwner || "-"}/${truncate(snap.gistId || "")}`} - + {snap.files.length > 0 && ( + + + {`${snap.gistOwner || "-"}/${truncate( + snap.gistId || "" + )}`} + + + )} )} @@ -138,10 +154,12 @@ const Navigation = () => { flexDirection: "column", p: "$7", height: "100%", + backgroundColor: "$mauve2", "@md": { width: "30%", + maxWidth: "300px", borderBottom: "0px", - borderRight: "1px solid $colors$mauve5", + borderRight: "1px solid $colors$mauve6", }, }} > @@ -152,9 +170,11 @@ const Navigation = () => { alignItems: "center", gap: "$3", fontSize: "$xl", + lineHeight: "$one", + fontWeight: "$bold", }} > - XRPL Hooks Editor + XRPL Hooks Builder { display: "inline-flex", alignItems: "center", gap: "$3", - color: "$green9", + color: "$purple10", "&:hover": { - color: "$green11 !important", + color: "$purple11", }, "&:focus": { outline: 0, @@ -189,7 +209,7 @@ const Navigation = () => { target="_blank" href="https://github.com/XRPL-Labs/xrpld-hooks" > - Developing Hooks + Hooks Github { display: "inline-flex", alignItems: "center", gap: "$3", - color: "$green9", + color: "$purple10", "&:hover": { - color: "$green11 !important", + color: "$purple11", }, "&:focus": { outline: 0, @@ -217,9 +237,9 @@ const Navigation = () => { display: "inline-flex", alignItems: "center", gap: "$3", - color: "$green9", + color: "$purple10", "&:hover": { - color: "$green11 !important", + color: "$purple11", }, "&:focus": { outline: 0, @@ -246,9 +266,7 @@ const Navigation = () => { gap: "$3", alignItems: "flex-start", flexWrap: "wrap", - backgroundImage: `url('/pattern.svg'), url('/pattern-2.svg')`, - backgroundRepeat: "no-repeat", - backgroundPosition: "bottom left, top right", + backgroundColor: "$mauve1", "@md": { gridTemplateColumns: "1fr 1fr 1fr", gridTemplateRows: "max-content", @@ -391,9 +409,13 @@ const Navigation = () => { - + + + + + diff --git a/components/PanelBox.tsx b/components/PanelBox.tsx index c33e9a1..544c927 100644 --- a/components/PanelBox.tsx +++ b/components/PanelBox.tsx @@ -5,8 +5,8 @@ import Text from "./Text"; const PanelBox = styled("div", { display: "flex", flexDirection: "column", - border: "1px solid $colors$mauve5", - backgroundColor: "$mauve1", + border: "1px solid $colors$mauve6", + backgroundColor: "$mauve2", padding: "$3", borderRadius: "$sm", fontWeight: "lighter", diff --git a/components/Tabs.tsx b/components/Tabs.tsx index 0620341..7b66b05 100644 --- a/components/Tabs.tsx +++ b/components/Tabs.tsx @@ -1,4 +1,10 @@ -import React, { useEffect, useState, Fragment, isValidElement, useCallback } from "react"; +import React, { + useEffect, + useState, + Fragment, + isValidElement, + useCallback, +} from "react"; import type { ReactNode, ReactElement } from "react"; import { Box, Button, Flex, Input, Stack, Text } from "."; import { @@ -13,7 +19,7 @@ import { Plus, X } from "phosphor-react"; import { styled } from "../stitches.config"; const ErrorText = styled(Text, { - color: "$red9", + color: "$crimson9", mt: "$1", display: "block", }); @@ -50,7 +56,7 @@ export const Tabs = ({ forceDefaultExtension, }: Props) => { const [active, setActive] = useState(activeIndex || 0); - const tabs: TabProps[] = children.map(elem => elem.props); + const tabs: TabProps[] = children.map((elem) => elem.props); const [isNewtabDialogOpen, setIsNewtabDialogOpen] = useState(false); const [tabname, setTabname] = useState(""); @@ -62,7 +68,7 @@ export const Tabs = ({ useEffect(() => { if (activeHeader) { - const idx = tabs.findIndex(tab => tab.header === activeHeader); + const idx = tabs.findIndex((tab) => tab.header === activeHeader); setActive(idx); } }, [activeHeader, tabs]); @@ -74,7 +80,7 @@ export const Tabs = ({ const validateTabname = useCallback( (tabname: string): { error: string | null } => { - if (tabs.find(tab => tab.header === tabname)) { + if (tabs.find((tab) => tab.header === tabname)) { return { error: "Name already exists." }; } return { error: null }; @@ -170,9 +176,16 @@ export const Tabs = ({ ))} {onCreateNewTab && ( - + - @@ -182,8 +195,8 @@ export const Tabs = ({ setTabname(e.target.value)} - onKeyPress={e => { + onChange={(e) => setTabname(e.target.value)} + onKeyPress={(e) => { if (e.key === "Enter") { handleCreateTab(); } @@ -235,7 +248,9 @@ export const Tabs = ({ ); }) ) : ( - {tabs[active].children} + + {tabs[active].children} + )} ); diff --git a/pages/_app.tsx b/pages/_app.tsx index 8a96417..3771fe0 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -18,6 +18,9 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) { const slug = router.query?.slug; const gistId = (Array.isArray(slug) && slug[0]) ?? null; + const origin = "https://xrpl-hooks-ide.vercel.app"; // TODO: Change when site is deployed + const shareImg = "/share-image.png"; + useEffect(() => { if (gistId && router.isReady) { fetchFiles(gistId); @@ -31,7 +34,73 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) { return ( <> - XRPL Hooks Playground + + + + + + XRPL Hooks Editor + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/_document.tsx b/pages/_document.tsx index 2c27dc4..42fbba9 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -16,21 +16,10 @@ class MyDocument extends Document { } render() { globalStyles(); + return ( - - - - -