better (less annoying) colors + default editor state is error-free

This commit is contained in:
Joeri Exelmans 2025-11-15 13:34:47 +01:00
parent 8b0726ef01
commit 456b85bf8f
5 changed files with 25 additions and 13 deletions

View file

@ -15,7 +15,7 @@ import { useEditor } from "./hooks/useEditor";
import { useSimulator } from "./hooks/useSimulator";
import { useUrlHashState } from "../hooks/useUrlHashState";
import { plants } from "./plants";
import { emptyState } from "@/statecharts/concrete_syntax";
import { initialEditorState } from "@/statecharts/concrete_syntax";
import { ModalOverlay } from "./Overlays/ModalOverlay";
import { FindReplace } from "./BottomPanel/FindReplace";
import { useCustomMemo } from "@/hooks/useCustomMemo";
@ -89,7 +89,7 @@ export function App() {
const persist = useUrlHashState<VisualEditorState | AppState & {editorState: VisualEditorState}>(
recoveredState => {
if (recoveredState === null) {
setEditHistory(() => ({current: emptyState, history: [], future: []}));
setEditHistory(() => ({current: initialEditorState, history: [], future: []}));
}
// we support two formats
// @ts-ignore

View file

@ -21,7 +21,7 @@
.greeter {
/* border-top: 1px var(--separator-color) solid; */
background-color: var(--statusbar-bg-color);
background-color: var(--background-color);
}
.bottom {

View file

@ -13,10 +13,10 @@ import gitRev from "@/git-rev.txt";
export function BottomPanel(props: {errors: TraceableError[], setEditorState: Dispatch<(state: VisualEditorState) => VisualEditorState>} & AppState & Setters<AppState>) {
const [greeting, setGreeting] = useState(
<div className="greeter" style={{textAlign:'center'}}>
<div className="greeter" style={{textAlign:'center'}} onClick={() => setGreeting(<></>)}>
<span style={{fontSize: 18, fontStyle: 'italic'}}>
Welcome to
<Logo width={300} height="auto" style={{verticalAlign: 'middle'}}/>
<Logo width={250} height="auto" style={{verticalAlign: 'middle'}}/>
</span>
</div>);
@ -45,18 +45,15 @@ export function BottomPanel(props: {errors: TraceableError[], setEditorState: Di
</div>
</PersistentDetailsLocalStorage>
</div>
{/* <div ></div> */}
<div>
<div style={{display: 'flex', alignItems: 'center'}}>
switch to&nbsp;
{location.host === "localhost:3000" ?
<a href={`https://deemz.org/public/statebuddy/${location.hash}`}>production</a>
: <a href={`http://localhost:3000/${location.hash}`}>development</a>
}
&nbsp;mode
</div>
&nbsp;|&nbsp;
<div>
Rev: <a title={"git"} href={`https://deemz.org/git/research/statebuddy/commit/${gitRev}`}>{gitRev.slice(0,8)}</a>
Rev:&nbsp;<a title={"git"} href={`https://deemz.org/git/research/statebuddy/commit/${gitRev}`}>{gitRev.slice(0,8)}</a>
</div>
</div>
</div>;

View file

@ -17,7 +17,7 @@ html, body {
--accent-border-color: light-dark(blue, rgb(64, 185, 255));
--accent-opaque-color: light-dark(#ccccff, #305b73);
--statusbar-bg-color: light-dark(rgb(157, 200, 255), rgb(48, 48, 68));
--statusbar-bg-color: light-dark(rgb(225, 229, 235), rgb(48, 48, 68));
--statusbar-fg-color: light-dark(rgb(0, 0, 0), white);
--statusbar-error-bg-color: light-dark(rgb(163, 0, 0), rgb(255, 82, 82));
--statusbar-error-fg-color: light-dark(white, black);

View file

@ -40,8 +40,23 @@ export type ConcreteSyntax = {
export type RectSide = "left" | "top" | "right" | "bottom";
export type ArrowPart = "start" | "end";
export const emptyState: VisualEditorState = {
rountangles: [], texts: [], arrows: [], diamonds: [], history: [], nextID: 0, selection: [],
export const initialEditorState: VisualEditorState = {
rountangles: [{
uid:"0",
topLeft:{x:76.25,y:122.5},
size:{x:133.75,y:103.75},
kind:"and"
}],
diamonds:[],
history:[],
arrows:[{
uid:"39",
start:{x:85,y:67.5},
end:{x:116.25,y:116.25}
}],
texts:[],
nextID: 1,
selection: [],
};
// used to find which rountangle an arrow connects to (src/tgt)