feat: Add simulation dashboard functionality and styles
- Implemented helper functions for retrieving and updating block and element styles. - Added handlers for background color and alpha changes. - Created a function to resolve element values based on data bindings. - Introduced a data model update function for managing simulation data. - Developed a comprehensive CSS stylesheet for the simulation dashboard layout and components. - Integrated the DashboardEditor component into the MainScene for enhanced user interaction. - Updated Tools component to support new drawing tools and functionalities. - Defined new TypeScript types for better type safety in the simulation dashboard.
This commit is contained in:
@@ -0,0 +1,466 @@
|
||||
.dashboard-editor {
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
max-height: 100vh;
|
||||
width: 100vw;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
// background-image:
|
||||
// linear-gradient(45deg, #2d2d2d 25%, transparent 25%),
|
||||
// linear-gradient(-45deg, #2d2d2d 25%, transparent 25%),
|
||||
// linear-gradient(45deg, transparent 75%, #2d2d2d 75%),
|
||||
// linear-gradient(-45deg, transparent 75%, #2d2d2d 75%);
|
||||
// background-size: 20px 20px;
|
||||
// background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
|
||||
z-index: 100;
|
||||
background: transparent;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
.control-panel {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.control-button {
|
||||
padding: 8px 16px;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
backdrop-filter: blur(10px);
|
||||
transition: background-color 0.2s ease;
|
||||
|
||||
&:not(.edit-mode-active) {
|
||||
background-color: #4caf50;
|
||||
}
|
||||
|
||||
&.edit-mode-active {
|
||||
background-color: #ff4444;
|
||||
}
|
||||
|
||||
&.primary {
|
||||
background-color: rgba(33, 150, 243, 0.8);
|
||||
}
|
||||
|
||||
&.secondary {
|
||||
background-color: rgba(156, 39, 176, 0.8);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.block-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
margin-top: 20px;
|
||||
max-height: calc(100vh - 100px);
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
|
||||
.block {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||
transition: all 0.3s ease;
|
||||
z-index: 1;
|
||||
resize: none;
|
||||
overflow: hidden;
|
||||
background-color: rgba(50, 50, 50, 0.8);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
min-height: 200px;
|
||||
min-width: 300px;
|
||||
|
||||
&.selected {
|
||||
border: 2px solid #4caf50;
|
||||
box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
|
||||
}
|
||||
|
||||
&.edit-mode {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.draggable {
|
||||
cursor: move;
|
||||
|
||||
&:hover .drag-handle {
|
||||
background-color: rgba(33, 150, 243, 1);
|
||||
}
|
||||
|
||||
.drag-handle {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-color: rgba(33, 150, 243, 0.8);
|
||||
border-radius: 4px;
|
||||
cursor: move;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
|
||||
.add-element-button {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
background: rgba(33, 150, 243, 0.9);
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
padding: 6px 12px;
|
||||
cursor: pointer;
|
||||
z-index: 10;
|
||||
backdrop-filter: blur(5px);
|
||||
transition: background-color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: rgba(33, 150, 243, 1);
|
||||
}
|
||||
}
|
||||
|
||||
.resize-handle {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-color: rgba(76, 175, 80, 0.8);
|
||||
border-radius: 3px;
|
||||
position: absolute;
|
||||
bottom: 2px;
|
||||
right: 2px;
|
||||
cursor: nwse-resize;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
&.selected .resize-handle {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.element {
|
||||
margin: 5px;
|
||||
border-radius: 4px;
|
||||
padding: 8px;
|
||||
transition: all 0.2s ease;
|
||||
user-select: none;
|
||||
border: 1px solid transparent;
|
||||
|
||||
&.absolute {
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
border: 2px solid #ff9800;
|
||||
background-color: rgba(255, 152, 0, 0.1);
|
||||
}
|
||||
|
||||
&.swap-source {
|
||||
border: 2px solid #4caf50;
|
||||
background-color: rgba(76, 175, 80, 0.1);
|
||||
}
|
||||
|
||||
&.swap-target {
|
||||
border: 2px dashed #ff9800;
|
||||
}
|
||||
|
||||
&.graph {
|
||||
min-height: 120px;
|
||||
min-width: 200px;
|
||||
padding: 12px;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
&.edit-mode.absolute {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
&.edit-mode:not(.absolute) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.swap-button {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
background: rgba(33, 150, 243, 0.8);
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
color: white;
|
||||
font-size: 10px;
|
||||
padding: 2px 4px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
&:hover .swap-button,
|
||||
&.selected .swap-button {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.resize-handle {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
position: absolute;
|
||||
bottom: 2px;
|
||||
right: 2px;
|
||||
background-color: rgba(33, 150, 243, 0.8);
|
||||
cursor: nwse-resize;
|
||||
border-radius: 2px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
&.selected .resize-handle {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.element-dropdown {
|
||||
position: fixed;
|
||||
background-color: rgba(50, 50, 50, 0.95);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
padding: 10px;
|
||||
z-index: 9999;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
min-width: 150px;
|
||||
|
||||
.dropdown-button {
|
||||
padding: 8px 12px;
|
||||
background-color: rgba(85, 85, 85, 0.8);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
backdrop-filter: blur(5px);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(85, 85, 85, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.panel {
|
||||
position: fixed;
|
||||
background-color: rgba(50, 50, 50, 0.95);
|
||||
backdrop-filter: blur(15px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
padding: 20px;
|
||||
z-index: 1000;
|
||||
border-radius: 12px;
|
||||
color: #fff;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
||||
|
||||
h4 {
|
||||
margin: 0 0 20px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&.data-model-panel {
|
||||
left: 20px;
|
||||
top: 50px;
|
||||
min-width: 300px;
|
||||
max-width: 400px;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
|
||||
h4 {
|
||||
color: #9c27b0;
|
||||
}
|
||||
}
|
||||
|
||||
&.block-editor-panel {
|
||||
right: 20px;
|
||||
top: 50px;
|
||||
min-width: 280px;
|
||||
|
||||
h4 {
|
||||
color: #4caf50;
|
||||
}
|
||||
}
|
||||
|
||||
&.element-editor-panel {
|
||||
right: 20px;
|
||||
top: 50px;
|
||||
min-width: 300px;
|
||||
max-height: 84vh;
|
||||
overflow: auto;
|
||||
|
||||
h4 {
|
||||
color: #ff9800;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-input,
|
||||
.form-select,
|
||||
.form-textarea {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
background-color: rgba(85, 85, 85, 0.6);
|
||||
color: #fff;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.form-textarea {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.form-small {
|
||||
opacity: 0.7;
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.color-input {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.range-input {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
border-radius: 3px;
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.swap-modal {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: rgba(50, 50, 50, 0.95);
|
||||
backdrop-filter: blur(15px);
|
||||
border: 2px solid #4caf50;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
z-index: 2000;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
|
||||
|
||||
h4 {
|
||||
margin: 0 0 15px 0;
|
||||
color: #4caf50;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.cancel-button {
|
||||
padding: 8px 16px;
|
||||
background-color: #ff4444;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
// Chart specific styles
|
||||
.chart-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
.chart-title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.chart-content {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
min-height: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
// Label-Value specific styles
|
||||
.label-value-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.label-text {
|
||||
font-size: 12px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.value-text {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
// Text and Icon styles
|
||||
.text-container,
|
||||
.icon-container {
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.icon-container {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user