Compare commits
	
		
			10 Commits
		
	
	
		
			feat/wasm-
			...
			feat/persi
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					810d3b2524 | ||
| 
						 | 
					a3393ded1e | ||
| 
						 | 
					17ede265b1 | ||
| 
						 | 
					629070edad | ||
| 
						 | 
					cc83924c27 | ||
| 
						 | 
					e3e964f72a | ||
| 
						 | 
					bdb2c0cf8f | ||
| 
						 | 
					eddf228283 | ||
| 
						 | 
					f9d617efdc | ||
| 
						 | 
					43796021da | 
@@ -173,7 +173,7 @@ const HooksEditor = () => {
 | 
			
		||||
                    fontFamily: "$monospace",
 | 
			
		||||
                  }}
 | 
			
		||||
                >
 | 
			
		||||
                  Click the link above to create a your file
 | 
			
		||||
                  Click the link above to create your file
 | 
			
		||||
                </Text>
 | 
			
		||||
              </Box>
 | 
			
		||||
            </Box>
 | 
			
		||||
 
 | 
			
		||||
@@ -312,7 +312,7 @@ const Navigation = () => {
 | 
			
		||||
                        href={`/develop/${templateFileIds.peggy}`}
 | 
			
		||||
                      >
 | 
			
		||||
                        <Heading>Peggy</Heading>
 | 
			
		||||
                        <Text>An oracle based stabe coin hook</Text>
 | 
			
		||||
                        <Text>An oracle based stable coin hook</Text>
 | 
			
		||||
                      </PanelBox>
 | 
			
		||||
                    </Flex>
 | 
			
		||||
                  </Flex>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
import React from "react";
 | 
			
		||||
import dynamic from "next/dynamic";
 | 
			
		||||
import React from "react";
 | 
			
		||||
import Split from "react-split";
 | 
			
		||||
import { useSnapshot } from "valtio";
 | 
			
		||||
import state from "../../state";
 | 
			
		||||
import Split from "react-split";
 | 
			
		||||
import { getSplit, saveSplit } from "../../state/actions/persistSplits";
 | 
			
		||||
 | 
			
		||||
const DeployEditor = dynamic(() => import("../../components/DeployEditor"), {
 | 
			
		||||
  ssr: false,
 | 
			
		||||
@@ -17,21 +18,22 @@ const LogBox = dynamic(() => import("../../components/LogBox"), {
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const Deploy = () => {
 | 
			
		||||
  const snap = useSnapshot(state);
 | 
			
		||||
  const { deployLogs } = useSnapshot(state);
 | 
			
		||||
  return (
 | 
			
		||||
    <Split
 | 
			
		||||
      direction="vertical"
 | 
			
		||||
      gutterSize={4}
 | 
			
		||||
      gutterAlign="center"
 | 
			
		||||
      sizes={[40, 60]}
 | 
			
		||||
      sizes={getSplit("deployVertical") || [40, 60]}
 | 
			
		||||
      style={{ height: "calc(100vh - 60px)" }}
 | 
			
		||||
      onDragEnd={(e) => saveSplit("deployVertical", e)}
 | 
			
		||||
    >
 | 
			
		||||
      <main style={{ display: "flex", flex: 1, position: "relative" }}>
 | 
			
		||||
        <DeployEditor />
 | 
			
		||||
      </main>
 | 
			
		||||
      <Split
 | 
			
		||||
        direction="horizontal"
 | 
			
		||||
        sizes={[50, 50]}
 | 
			
		||||
        sizes={getSplit("deployHorizontal") || [50, 50]}
 | 
			
		||||
        minSize={[320, 160]}
 | 
			
		||||
        gutterSize={4}
 | 
			
		||||
        gutterAlign="center"
 | 
			
		||||
@@ -41,6 +43,7 @@ const Deploy = () => {
 | 
			
		||||
          width: "100%",
 | 
			
		||||
          height: "100%",
 | 
			
		||||
        }}
 | 
			
		||||
        onDragEnd={(e) => saveSplit("deployHorizontal", e)}
 | 
			
		||||
      >
 | 
			
		||||
        <div style={{ alignItems: "stretch", display: "flex" }}>
 | 
			
		||||
          <Accounts />
 | 
			
		||||
@@ -48,7 +51,7 @@ const Deploy = () => {
 | 
			
		||||
        <div>
 | 
			
		||||
          <LogBox
 | 
			
		||||
            title="Deploy Log"
 | 
			
		||||
            logs={snap.deployLogs}
 | 
			
		||||
            logs={deployLogs}
 | 
			
		||||
            clearLog={() => (state.deployLogs = [])}
 | 
			
		||||
          />
 | 
			
		||||
        </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,15 @@
 | 
			
		||||
import dynamic from "next/dynamic";
 | 
			
		||||
import { useSnapshot } from "valtio";
 | 
			
		||||
import Hotkeys from "react-hot-keys";
 | 
			
		||||
import { Play } from "phosphor-react";
 | 
			
		||||
import Split from "react-split";
 | 
			
		||||
 | 
			
		||||
import type { NextPage } from "next";
 | 
			
		||||
import { compileCode } from "../../state/actions";
 | 
			
		||||
import state from "../../state";
 | 
			
		||||
import Button from "../../components/Button";
 | 
			
		||||
import dynamic from "next/dynamic";
 | 
			
		||||
import { Play } from "phosphor-react";
 | 
			
		||||
import Hotkeys from "react-hot-keys";
 | 
			
		||||
import Split from "react-split";
 | 
			
		||||
import { useSnapshot } from "valtio";
 | 
			
		||||
import Box from "../../components/Box";
 | 
			
		||||
import Button from "../../components/Button";
 | 
			
		||||
import state from "../../state";
 | 
			
		||||
import { compileCode } from "../../state/actions";
 | 
			
		||||
import { getSplit, saveSplit } from "../../state/actions/persistSplits";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const HooksEditor = dynamic(() => import("../../components/HooksEditor"), {
 | 
			
		||||
  ssr: false,
 | 
			
		||||
@@ -24,11 +25,12 @@ const Home: NextPage = () => {
 | 
			
		||||
  return (
 | 
			
		||||
    <Split
 | 
			
		||||
      direction="vertical"
 | 
			
		||||
      sizes={[70, 30]}
 | 
			
		||||
      sizes={getSplit("developVertical") || [70, 30]}
 | 
			
		||||
      minSize={[100, 100]}
 | 
			
		||||
      gutterAlign="center"
 | 
			
		||||
      gutterSize={4}
 | 
			
		||||
      style={{ height: "calc(100vh - 60px)" }}
 | 
			
		||||
      onDragEnd={(e) => saveSplit("developVertical", e)}
 | 
			
		||||
    >
 | 
			
		||||
      <main style={{ display: "flex", flex: 1, position: "relative" }}>
 | 
			
		||||
        <HooksEditor />
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +1,17 @@
 | 
			
		||||
import {
 | 
			
		||||
  Container,
 | 
			
		||||
  Flex,
 | 
			
		||||
  Box,
 | 
			
		||||
  Tabs,
 | 
			
		||||
  Tab,
 | 
			
		||||
  Input,
 | 
			
		||||
  Select,
 | 
			
		||||
  Text,
 | 
			
		||||
  Button,
 | 
			
		||||
} from "../../components";
 | 
			
		||||
import { Play } from "phosphor-react";
 | 
			
		||||
import dynamic from "next/dynamic";
 | 
			
		||||
import { useSnapshot } from "valtio";
 | 
			
		||||
import { Play } from "phosphor-react";
 | 
			
		||||
import { FC, useCallback, useEffect, useState } from "react";
 | 
			
		||||
import Split from "react-split";
 | 
			
		||||
import { useSnapshot } from "valtio";
 | 
			
		||||
import {
 | 
			
		||||
  Box, Button, Container,
 | 
			
		||||
  Flex, Input,
 | 
			
		||||
  Select, Tab, Tabs, Text
 | 
			
		||||
} from "../../components";
 | 
			
		||||
import transactionsData from "../../content/transactions.json";
 | 
			
		||||
import state from "../../state";
 | 
			
		||||
import { sendTransaction } from "../../state/actions";
 | 
			
		||||
import { useCallback, useEffect, useState, FC } from "react";
 | 
			
		||||
import transactionsData from "../../content/transactions.json";
 | 
			
		||||
import { getSplit, saveSplit } from "../../state/actions/persistSplits";
 | 
			
		||||
 | 
			
		||||
const DebugStream = dynamic(() => import("../../components/DebugStream"), {
 | 
			
		||||
  ssr: false,
 | 
			
		||||
@@ -349,16 +344,17 @@ const Transaction: FC<Props> = ({ header, ...props }) => {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const Test = () => {
 | 
			
		||||
  const snap = useSnapshot(state);
 | 
			
		||||
  const { transactionLogs } = useSnapshot(state);
 | 
			
		||||
  const [tabHeaders, setTabHeaders] = useState<string[]>(["test1.json"]);
 | 
			
		||||
  return (
 | 
			
		||||
    <Container css={{ px: 0 }}>
 | 
			
		||||
      <Split
 | 
			
		||||
        direction="vertical"
 | 
			
		||||
        sizes={[50, 50]}
 | 
			
		||||
        sizes={getSplit("testVertical") || [50, 50]}
 | 
			
		||||
        gutterSize={4}
 | 
			
		||||
        gutterAlign="center"
 | 
			
		||||
        style={{ height: "calc(100vh - 60px)" }}
 | 
			
		||||
        onDragEnd={(e) => saveSplit("testVertical", e)}
 | 
			
		||||
      >
 | 
			
		||||
        <Flex
 | 
			
		||||
          row
 | 
			
		||||
@@ -370,7 +366,7 @@ const Test = () => {
 | 
			
		||||
        >
 | 
			
		||||
          <Split
 | 
			
		||||
            direction="horizontal"
 | 
			
		||||
            sizes={[50, 50]}
 | 
			
		||||
            sizes={getSplit("testHorizontal") || [50, 50]}
 | 
			
		||||
            minSize={[180, 320]}
 | 
			
		||||
            gutterSize={4}
 | 
			
		||||
            gutterAlign="center"
 | 
			
		||||
@@ -380,6 +376,7 @@ const Test = () => {
 | 
			
		||||
              width: "100%",
 | 
			
		||||
              height: "100%",
 | 
			
		||||
            }}
 | 
			
		||||
            onDragEnd={(e) => saveSplit("testHorizontal", e)}
 | 
			
		||||
          >
 | 
			
		||||
            <Box css={{ width: "55%", px: "$2" }}>
 | 
			
		||||
              <Tabs
 | 
			
		||||
@@ -428,7 +425,7 @@ const Test = () => {
 | 
			
		||||
            >
 | 
			
		||||
              <LogBox
 | 
			
		||||
                title="Development Log"
 | 
			
		||||
                logs={snap.transactionLogs}
 | 
			
		||||
                logs={transactionLogs}
 | 
			
		||||
                clearLog={() => (state.transactionLogs = [])}
 | 
			
		||||
              />
 | 
			
		||||
            </Box>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								state/actions/persistSplits.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								state/actions/persistSplits.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
import { snapshot } from "valtio"
 | 
			
		||||
import state from ".."
 | 
			
		||||
 | 
			
		||||
export type SplitSize = number[]
 | 
			
		||||
 | 
			
		||||
export const saveSplit = (splitId: string, event: SplitSize) => {
 | 
			
		||||
  state.splits[splitId] = event
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const getSplit = (splitId: string): SplitSize | null => {
 | 
			
		||||
  const { splits } = snapshot(state)
 | 
			
		||||
  const split = splits[splitId]
 | 
			
		||||
  return split ? split : null
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
import { proxy, ref, subscribe } from "valtio";
 | 
			
		||||
import { devtools } from 'valtio/utils'
 | 
			
		||||
import type monaco from "monaco-editor";
 | 
			
		||||
import { proxy, ref, subscribe } from "valtio";
 | 
			
		||||
import { devtools } from 'valtio/utils';
 | 
			
		||||
import { XrplClient } from "xrpl-client";
 | 
			
		||||
import { SplitSize } from "./actions/persistSplits";
 | 
			
		||||
 | 
			
		||||
export interface IFile {
 | 
			
		||||
  name: string;
 | 
			
		||||
@@ -55,6 +56,9 @@ export interface IState {
 | 
			
		||||
  editorSettings: {
 | 
			
		||||
    tabSize: number;
 | 
			
		||||
  };
 | 
			
		||||
  splits: {
 | 
			
		||||
    [id: string]: SplitSize
 | 
			
		||||
  };
 | 
			
		||||
  client: XrplClient | null;
 | 
			
		||||
  clientStatus: "offline" | "online";
 | 
			
		||||
  mainModalOpen: boolean;
 | 
			
		||||
@@ -83,6 +87,7 @@ let initialState: IState = {
 | 
			
		||||
  editorSettings: {
 | 
			
		||||
    tabSize: 2,
 | 
			
		||||
  },
 | 
			
		||||
  splits: {},
 | 
			
		||||
  client: null,
 | 
			
		||||
  clientStatus: "offline" as "offline",
 | 
			
		||||
  mainModalOpen: false,
 | 
			
		||||
@@ -91,6 +96,9 @@ let initialState: IState = {
 | 
			
		||||
 | 
			
		||||
let localStorageAccounts: string | null = null;
 | 
			
		||||
let initialAccounts: IAccount[] = [];
 | 
			
		||||
 | 
			
		||||
// TODO: What exactly should we store in localStorage? editorSettings, splits, accounts?
 | 
			
		||||
 | 
			
		||||
// Check if there's a persited accounts in localStorage
 | 
			
		||||
if (typeof window !== "undefined") {
 | 
			
		||||
  try {
 | 
			
		||||
@@ -139,4 +147,4 @@ if (typeof window !== "undefined") {
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
export default state
 | 
			
		||||
export default state
 | 
			
		||||
 
 | 
			
		||||
@@ -39,3 +39,14 @@ html.light .gutter-vertical:hover {
 | 
			
		||||
html.light .gutter-horizontal:hover {
 | 
			
		||||
  background-color: rgba(0, 0, 0, 0.25);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Adjust Monaco tooltip stylings */
 | 
			
		||||
.markdown-hover h3 {
 | 
			
		||||
  margin: 0;
 | 
			
		||||
}
 | 
			
		||||
.monaco-editor .monaco-hover hr {
 | 
			
		||||
  margin: 8px 0;
 | 
			
		||||
}
 | 
			
		||||
.monaco-editor .monaco-hover {
 | 
			
		||||
  z-index: 9999;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user