Merge pull request #49 from bunny-lab-io:codex/adjust-layout-and-spacing-of-variables-section-8bchj2

Refine variable editor row layout
This commit is contained in:
2025-10-03 17:05:46 -06:00
committed by GitHub
3 changed files with 237 additions and 213 deletions

View File

@@ -1,5 +0,0 @@
# Define the file path
$filePath = "C:\Canary.txt"
# Write some content into the file
"SYSTEM Canary is alive." | Out-File -FilePath $filePath -Encoding UTF8

View File

@@ -66,26 +66,29 @@ const INPUT_BASE_SX = {
"&:hover fieldset": { borderColor: "#3a4657" },
"&.Mui-focused fieldset": { borderColor: "#58a6ff" }
},
"& .MuiOutlinedInput-input": {
padding: "9px 12px",
fontSize: "0.95rem"
fontSize: "0.95rem",
lineHeight: 1.4
},
"& .MuiOutlinedInput-inputMultiline": {
padding: "9px 12px"
},
"& .MuiInputLabel-root": { color: "#9ba3b4" },
"& .MuiInputLabel-root": {
color: "#9ba3b4",
transform: "translate(12px, 11px) scale(0.8)" // label at rest (inside field)
},
"& .MuiInputLabel-root.Mui-focused": { color: "#58a6ff" },
"& input[type=number]": {
MozAppearance: "textfield"
"& .MuiInputLabel-root.MuiInputLabel-shrink": {
transform: "translate(12px, -6px) scale(0.75)" // floated label position
},
"& input[type=number]::-webkit-outer-spin-button": {
WebkitAppearance: "none",
margin: 0
},
"& input[type=number]::-webkit-inner-spin-button": {
WebkitAppearance: "none",
margin: 0
}
"& input[type=number]": { MozAppearance: "textfield" },
"& input[type=number]::-webkit-outer-spin-button": { WebkitAppearance: "none", margin: 0 },
"& input[type=number]::-webkit-inner-spin-button": { WebkitAppearance: "none", margin: 0 }
};
const SELECT_BASE_SX = {
@@ -621,44 +624,33 @@ export default function AssemblyEditor({
flex: 1,
height: "100%",
overflow: "hidden",
ml: -0.95,
mt: -0.95,
bgcolor: PAGE_BACKGROUND
}}
>
<Box sx={{ flex: 1, overflow: "auto", p: { xs: 2, md: 3 } }}>
<Paper sx={{ p: { xs: 2.5, md: 3 }, ...SECTION_CARD_SX, minHeight: "100%" }} elevation={0}>
<Box sx={{ mb: 3 }}>
<Typography variant="h5" sx={{ color: "#58a6ff", fontWeight: 500, mb: 0.5 }}>
Assembly Editor
</Typography>
<Typography variant="body2" sx={{ color: "#9ba3b4" }}>
Create and edit variables, scripts, and other fields related to assemblies.
</Typography>
</Box>
<Box
sx={{
display: "flex",
alignItems: "flex-start",
justifyContent: "space-between",
gap: 2,
mb: 0,
flexWrap: "wrap"
}}
>
<Box sx={{ flex: "1 1 auto", minWidth: 120 }}>
<Typography variant="caption" sx={SECTION_TITLE_SX}>
Overview
</Typography>
<Grid container alignItems="center" justifyContent="space-between" sx={{ mb: 3 }}>
{/* Left half */}
<Grid item xs={12} sm={6}>
<Box>
<Typography variant="h6" sx={{ color: '#58a6ff', mb: 0 }}>Assembly Editor</Typography>
<Typography variant="body2" sx={{ color: '#aaa' }}>Create and edit variables, scripts, and other fields related to assemblies.</Typography>
</Box>
</Grid>
{/* Right half */}
<Grid item xs={12} sm={6}>
<Box
sx={{
display: "flex",
alignItems: "center",
gap: 1.5,
flexWrap: "wrap",
justifyContent: "flex-end",
ml: { xs: 0, sm: "auto" },
alignSelf: "flex-start"
justifyContent: { xs: "flex-start", sm: "flex-end" },
mt: { xs: 2, sm: 0 }
}}
>
{currentPath ? (
@@ -707,6 +699,25 @@ export default function AssemblyEditor({
{saving ? "Saving..." : "Save Assembly"}
</Button>
</Box>
</Grid>
</Grid>
<Box
sx={{
display: "flex",
alignItems: "flex-start",
justifyContent: "space-between",
gap: 2,
mb: 0,
flexWrap: "wrap"
}}
>
<Box sx={{ flex: "1 1 auto", minWidth: 120 }}>
<Typography variant="caption" sx={SECTION_TITLE_SX}>
Overview
</Typography>
</Box>
</Box>
<Grid container spacing={2}>
@@ -902,18 +913,19 @@ export default function AssemblyEditor({
key={variable.id}
sx={{ p: 2, bgcolor: BACKGROUND_COLORS.field, border: "1px solid #2b3544", borderRadius: 1 }}
>
<Box sx={{ display: "flex", flexDirection: "column", gap: { xs: 2, lg: 1.5 } }}>
<Box
sx={{
display: "flex",
flexWrap: "wrap",
alignItems: "stretch",
alignItems: "center",
gap: { xs: 2, lg: 1.5 },
pt: 1
pt: 0.5
}}
>
<Box sx={{ flex: { xs: "1 1 100%", lg: "0 1 30%" }, minWidth: { lg: 220 } }}>
<Box sx={{ flex: { xs: "1 1 100%", lg: "0 1 28%" }, minWidth: { lg: 220 } }}>
<Tooltip
title="This is the name of the variable you will be referencing inside of the script. Within the script you will reference this variable with $env:<variable>."
title="This is the name of the variable you will be referencing inside of the script via $env:<variable>."
arrow
placement="top-start"
>
@@ -943,7 +955,8 @@ export default function AssemblyEditor({
/>
</Tooltip>
</Box>
<Box sx={{ flex: { xs: "1 1 100%", lg: "0 1 22%" }, minWidth: { lg: 160 } }}>
<Box sx={{ flex: { xs: "1 1 100%", lg: "0 1 18%" }, minWidth: { lg: 160 } }}>
<Tooltip
title="This defines the type of variable data the script should expect."
arrow
@@ -966,7 +979,7 @@ export default function AssemblyEditor({
</Box>
<Box
sx={{
flex: { xs: "1 1 100%", lg: "0 1 40%" },
flex: { xs: "1 1 100%", lg: "0 1 24%" },
minWidth: { lg: 220 },
display: "flex",
alignItems: "center"
@@ -1011,28 +1024,7 @@ export default function AssemblyEditor({
</Tooltip>
)}
</Box>
<Box
sx={{
flex: { xs: "1 1 100%", lg: "0 0 100px" },
minWidth: { lg: 100 },
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
gap: 0.5
}}
>
<Typography variant="caption" sx={{ color: "#9ba3b4", fontSize: "0.75rem" }}>
Required
</Typography>
<Checkbox
checked={Boolean(variable.required)}
onChange={(e) => updateVariable(variable.id, { required: e.target.checked })}
sx={{ color: "#58a6ff", p: 0.5 }}
inputProps={{ "aria-label": "Required" }}
/>
</Box>
<Box sx={{ flex: { xs: "1 1 100%", lg: "1 1 0%" }, minWidth: { lg: 220 } }}>
<Box sx={{ flex: { xs: "1 1 100%", lg: "0 1 28%" }, minWidth: { lg: 220 } }}>
<Tooltip
title="Instruct the operator in why this variable exists and how to set it appropriately."
arrow
@@ -1064,6 +1056,42 @@ export default function AssemblyEditor({
</Tooltip>
</Box>
</Box>
<Box
sx={{
display: "flex",
flexWrap: "wrap",
gap: { xs: 2, lg: 1.5 }
}}
>
<Box
sx={{
flex: { xs: "1 1 100%", lg: "0 1 50%" },
minWidth: { lg: 220 },
display: "flex",
alignItems: "center",
gap: 1.5
}}
>
<Typography
variant="caption"
sx={{ color: "#9ba3b4", fontSize: "0.75rem", ml: 0.5}} /* Left-Hand Spacing for the "Required" label to the left of the checkbox */
>
Required
</Typography>
<Checkbox
checked={Boolean(variable.required)}
onChange={(e) =>
updateVariable(variable.id, { required: e.target.checked })
}
sx={{
color: "#58a6ff",
p: 0.5,
}}
inputProps={{ "aria-label": "Required" }}
/>
</Box>
</Box>
</Box>
</Paper>
))}
</Box>
@@ -1117,6 +1145,7 @@ export default function AssemblyEditor({
No files uploaded yet.
</Typography>
)}
<Button
component="label"
startIcon={<UploadFileIcon />}