fixed layout

This commit is contained in:
yoshi 2025-05-08 10:34:43 -07:00
parent cfcd91bf3d
commit caa21472ba
3 changed files with 26 additions and 25 deletions

View file

@ -8,7 +8,7 @@ export default function EditorPanel({ code, onChange }) {
border: '1px solid #444', border: '1px solid #444',
borderRadius: '8px', borderRadius: '8px',
backgroundColor: '#1e1e1e', backgroundColor: '#1e1e1e',
height: '80%', height: '70vh',
boxShadow: '0 0 10px rgba(255, 0, 255, 0.2)', boxShadow: '0 0 10px rgba(255, 0, 255, 0.2)',
overflow: 'hidden' overflow: 'hidden'
}}> }}>

View file

@ -25,7 +25,9 @@ export default function PreviewPanel({ code }) {
color: '#eee', color: '#eee',
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
boxSizing: 'border-box' boxSizing: 'border-box',
height: '67vh',
marginBorder : '1.5rem',
}}> }}>
<div style={{ <div style={{
backgroundColor: '#d300c5', backgroundColor: '#d300c5',
@ -47,7 +49,7 @@ export default function PreviewPanel({ code }) {
background: 'rgba(255,255,255,0.05)', background: 'rgba(255,255,255,0.05)',
border: '1px solid #ff2a6d', border: '1px solid #ff2a6d',
borderRadius: '8px', borderRadius: '8px',
padding: '1rem', padding: '0.2rem',
marginBottom: '1rem' marginBottom: '1rem'
}}> }}>
<input <input
@ -57,13 +59,14 @@ export default function PreviewPanel({ code }) {
onChange={e => { setGameId(e.target.value.trim()); setSubmitted(false); }} onChange={e => { setGameId(e.target.value.trim()); setSubmitted(false); }}
style={{ style={{
width: '100%', width: '100%',
padding: '0.5rem', textAlign: 'center',
marginBottom: '0.75rem', padding: '0.2rem',
marginBottom: '0.25rem',
border: 'none', border: 'none',
borderRadius: 4, borderRadius: 4,
background: 'transparent', background: 'transparent',
color: '#fff', color: '#fff',
outline: 'none' outline: 'none',
}} }}
/> />
{!isValid && gameId && ( {!isValid && gameId && (
@ -93,7 +96,8 @@ export default function PreviewPanel({ code }) {
<div style={{ <div style={{
flex: 1, flex: 1,
overflow: 'hidden', overflow: 'hidden',
borderRadius: '8px' borderRadius: '8px',
height: '100vh',
}}> }}>
{submitted && ( {submitted && (
<iframe <iframe

View file

@ -1,16 +1,13 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useLocation } from "react-router-dom"; import { useParams } from "react-router-dom";
import EditorPanel from "../components/EditorPanel"; import EditorPanel from "../components/EditorPanel";
import PreviewPanel from "../components/PreviewPanel"; import PreviewPanel from "../components/PreviewPanel";
const ASSIGNMENT_BASE = "http://localhost:8082"; const ASSIGNMENT_BASE = "http://localhost:8082";
export default function PageCodeEditor() { export default function PageCodeEditor() {
const { qrCodeNumber: routeId } = useParams();
const location = useLocation(); const qrCodeNumber = routeId || "6656";
const qrCodeNumber = location.state?.qrCodeNumber;
console.log("QR Code Number:", qrCodeNumber);
const [appName, setAppName] = useState(""); const [appName, setAppName] = useState("");
const [code, setCode] = useState("# NOW LOADING"); const [code, setCode] = useState("# NOW LOADING");
@ -87,13 +84,14 @@ export default function PageCodeEditor() {
}; };
return ( return (
<main className="code-editor-page" style={{ paddingTop: "35px" }}> <main className="code-editor-page" style={{ paddingTop: "35px", width: "100vw" }}>
<div <div
className="editor-page-layout" className="editor-page-layout"
style={{ style={{
display: "flex", display: "grid",
gap: "1rem", gridTemplateColumns: '1fr 0.8fr',
width: "120rem", //gap: "1rem",
width: "100%",
padding: "1rem", padding: "1rem",
fontFamily: "'Fira Code', 'Courier New', monospace" fontFamily: "'Fira Code', 'Courier New', monospace"
}} }}
@ -107,7 +105,7 @@ export default function PageCodeEditor() {
borderRadius: "10px", borderRadius: "10px",
padding: "1rem", padding: "1rem",
color: "#eee", color: "#eee",
minHeight: "80vh", minHeight: "30vh",
overflow: "auto" overflow: "auto"
}} }}
> >
@ -123,14 +121,13 @@ export default function PageCodeEditor() {
🐍 Snake Brain (Python) 🐍 Snake Brain (Python)
</h3> </h3>
<EditorPanel code={code} onChange={setCode} /> <EditorPanel code={code} onChange={setCode} />
<div style={{ marginTop: "1rem", display: "flex" }}> <div style={{ marginTop: "1rem", display: "flex", flexDirection: "flex-end" }}>
<button <button
onClick={handleSave} onClick={handleSave}
disabled={isSaving} disabled={isSaving}
style={{ style={{
backgroundColor: "#ff2a6d", backgroundColor: "#ff2a6d",
color: "#fff", color: "#fff",
marginLeft: "50rem",
padding: "0.5rem 2rem", padding: "0.5rem 2rem",
border: "none", border: "none",
borderRadius: "20px", borderRadius: "20px",
@ -168,9 +165,9 @@ export default function PageCodeEditor() {
flex: 1, flex: 1,
background: "#1a1a1a", background: "#1a1a1a",
borderRadius: "12px", borderRadius: "12px",
padding: "1rem", padding: "0.8rem",
color: "#eee", color: "#eee",
minHeight: "80vh" minHeight: "20vh"
}} }}
> >
<h3 <h3
@ -178,10 +175,10 @@ export default function PageCodeEditor() {
fontSize: "1.2rem", fontSize: "1.2rem",
color: "#d300c5", color: "#d300c5",
textShadow: "0 0 5px #d300c5", textShadow: "0 0 5px #d300c5",
marginBottom: "1rem", marginBottom: "0.8rem",
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
gap: "0.5rem" gap: "0.8rem"
}} }}
> >
🎯 Live Arena Output 🎯 Live Arena Output
@ -190,7 +187,7 @@ export default function PageCodeEditor() {
style={{ style={{
color: "#fff", color: "#fff",
textAlign: "center", textAlign: "center",
marginBottom: "1rem" marginBottom: "0.8rem"
}} }}
> >
Battlesnake Preview Battlesnake Preview