mirror of
https://github.com/jhbruhn/respira.git
synced 2026-01-27 10:23:41 +00:00
- Replace vanilla canvas with Konva.js for better interactivity - Add pan and zoom functionality (mouse wheel zoom, drag to pan) - Make pattern draggable within hoop coordinate system - Center canvas on embroidery origin (0,0) - Default zoom shows entire 100x100mm hoop - Pass user-defined pattern offset to LAYOUT command - Replace auto-centering with manual pattern positioning - Add visual overlays for thread legend, dimensions, pattern position, and zoom controls - Fix effect dependencies to prevent drag interruption on machine status updates - Memoize callbacks to prevent unnecessary re-renders - Create konvaRenderers.ts utility for rendering grid, hoop, stitches, etc. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
803 lines
14 KiB
CSS
803 lines
14 KiB
CSS
:root {
|
|
--primary-color: #0066cc;
|
|
--secondary-color: #6c757d;
|
|
--danger-color: #dc3545;
|
|
--success-color: #28a745;
|
|
--warning-color: #ffc107;
|
|
--info-color: #17a2b8;
|
|
--background: #f5f5f5;
|
|
--panel-background: #ffffff;
|
|
--border-color: #dee2e6;
|
|
--text-color: #212529;
|
|
--text-muted: #6c757d;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
sans-serif;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
background-color: var(--background);
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.app {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.app-header {
|
|
background-color: var(--panel-background);
|
|
padding: 1.5rem 2rem;
|
|
border-bottom: 1px solid var(--border-color);
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.app-header h1 {
|
|
font-size: 1.75rem;
|
|
font-weight: 600;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.error-message {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
padding: 0.75rem 1rem;
|
|
border-radius: 4px;
|
|
margin-top: 1rem;
|
|
border: 1px solid #f5c6cb;
|
|
}
|
|
|
|
.app-content {
|
|
flex: 1;
|
|
display: grid;
|
|
grid-template-columns: 400px 1fr;
|
|
gap: 1.5rem;
|
|
padding: 1.5rem;
|
|
max-width: 1600px;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.left-panel {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.right-panel {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.connection-panel,
|
|
.file-upload-panel,
|
|
.progress-panel,
|
|
.canvas-panel {
|
|
background-color: var(--panel-background);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
h2 {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
margin-bottom: 1rem;
|
|
padding-bottom: 0.5rem;
|
|
border-bottom: 2px solid var(--border-color);
|
|
}
|
|
|
|
h3 {
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
margin: 1rem 0 0.5rem 0;
|
|
}
|
|
|
|
.detail-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 0.5rem 0;
|
|
border-bottom: 1px solid var(--border-color);
|
|
}
|
|
|
|
.detail-row:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.detail-row .label {
|
|
font-weight: 500;
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
.detail-row .value {
|
|
font-weight: 600;
|
|
}
|
|
|
|
.status-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
margin-bottom: 1rem;
|
|
padding: 0.75rem;
|
|
background-color: var(--background);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.status-indicator {
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 4px;
|
|
font-weight: 600;
|
|
font-size: 0.875rem;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.status-indicator.status-16 { /* IDLE */
|
|
background-color: #d1ecf1;
|
|
color: #0c5460;
|
|
}
|
|
|
|
.status-indicator.status-17 { /* SEWING_WAIT */
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
}
|
|
|
|
.status-indicator.status-48 { /* SEWING */
|
|
background-color: #fff3cd;
|
|
color: #856404;
|
|
}
|
|
|
|
.status-indicator.status-49 { /* SEWING_COMPLETE */
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
}
|
|
|
|
.status-indicator.status-64 { /* COLOR_CHANGE_WAIT */
|
|
background-color: #fff3cd;
|
|
color: #856404;
|
|
}
|
|
|
|
.error-indicator {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 4px;
|
|
font-weight: 600;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.polling-indicator {
|
|
color: var(--primary-color);
|
|
font-size: 0.75rem;
|
|
animation: pulse 1s ease-in-out infinite;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% {
|
|
opacity: 1;
|
|
}
|
|
50% {
|
|
opacity: 0.3;
|
|
}
|
|
}
|
|
|
|
.connection-actions,
|
|
.progress-actions {
|
|
display: flex;
|
|
gap: 0.75rem;
|
|
margin-top: 1rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
button {
|
|
padding: 0.75rem 1.5rem;
|
|
border: none;
|
|
border-radius: 4px;
|
|
font-size: 0.875rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
button:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: var(--primary-color);
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover:not(:disabled) {
|
|
background-color: #0052a3;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background-color: var(--secondary-color);
|
|
color: white;
|
|
}
|
|
|
|
.btn-secondary:hover:not(:disabled) {
|
|
background-color: #5a6268;
|
|
}
|
|
|
|
.btn-danger {
|
|
background-color: var(--danger-color);
|
|
color: white;
|
|
}
|
|
|
|
.btn-danger:hover:not(:disabled) {
|
|
background-color: #c82333;
|
|
}
|
|
|
|
.file-input {
|
|
display: none;
|
|
}
|
|
|
|
.progress-bar {
|
|
height: 8px;
|
|
background-color: var(--border-color);
|
|
border-radius: 4px;
|
|
overflow: hidden;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.progress-fill {
|
|
height: 100%;
|
|
background-color: var(--primary-color);
|
|
transition: width 0.3s;
|
|
}
|
|
|
|
/* Canvas container with Konva */
|
|
.canvas-container {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 600px;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 4px;
|
|
background-color: #fafafa;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.canvas-placeholder {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 600px;
|
|
color: var(--text-muted);
|
|
font-style: italic;
|
|
}
|
|
|
|
/* Canvas overlay elements */
|
|
.canvas-legend {
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 10px;
|
|
background: rgba(255, 255, 255, 0.95);
|
|
padding: 12px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
z-index: 10;
|
|
backdrop-filter: blur(4px);
|
|
max-width: 150px;
|
|
}
|
|
|
|
.canvas-legend h4 {
|
|
margin: 0 0 8px 0;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--text-color);
|
|
border-bottom: 1px solid var(--border-color);
|
|
padding-bottom: 6px;
|
|
}
|
|
|
|
.legend-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.legend-item:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.legend-swatch {
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 3px;
|
|
border: 1px solid #000;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.legend-label {
|
|
font-size: 12px;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.canvas-dimensions {
|
|
position: absolute;
|
|
bottom: 165px;
|
|
right: 20px;
|
|
background: rgba(255, 255, 255, 0.95);
|
|
padding: 8px 16px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
z-index: 11;
|
|
backdrop-filter: blur(4px);
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.canvas-offset-info {
|
|
position: absolute;
|
|
bottom: 80px;
|
|
right: 20px;
|
|
background: rgba(255, 255, 255, 0.95);
|
|
padding: 10px 14px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
z-index: 11;
|
|
backdrop-filter: blur(4px);
|
|
min-width: 180px;
|
|
}
|
|
|
|
.offset-label {
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
color: var(--text-muted);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.offset-value {
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--primary-color);
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.offset-hint {
|
|
font-size: 10px;
|
|
color: var(--text-muted);
|
|
font-style: italic;
|
|
}
|
|
|
|
/* Zoom controls */
|
|
.zoom-controls {
|
|
position: absolute;
|
|
bottom: 20px;
|
|
right: 20px;
|
|
display: flex;
|
|
gap: 8px;
|
|
align-items: center;
|
|
background: rgba(255, 255, 255, 0.95);
|
|
padding: 8px 12px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
z-index: 10;
|
|
backdrop-filter: blur(4px);
|
|
}
|
|
|
|
.zoom-btn {
|
|
width: 32px;
|
|
height: 32px;
|
|
padding: 0;
|
|
font-size: 18px;
|
|
font-weight: bold;
|
|
border: 1px solid var(--border-color);
|
|
background: white;
|
|
cursor: pointer;
|
|
border-radius: 4px;
|
|
transition: all 0.2s;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.zoom-btn:hover:not(:disabled) {
|
|
background: var(--primary-color);
|
|
color: white;
|
|
border-color: var(--primary-color);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 2px 6px rgba(0, 102, 204, 0.3);
|
|
}
|
|
|
|
.zoom-btn:active:not(:disabled) {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.zoom-level {
|
|
min-width: 50px;
|
|
text-align: center;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--text-color);
|
|
user-select: none;
|
|
}
|
|
|
|
.zoom-reset {
|
|
margin-left: 4px;
|
|
font-size: 20px;
|
|
}
|
|
|
|
.status-message {
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
margin: 1rem 0;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.status-message.success {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
border: 1px solid #c3e6cb;
|
|
}
|
|
|
|
.status-message.warning {
|
|
background-color: #fff3cd;
|
|
color: #856404;
|
|
border: 1px solid #ffeeba;
|
|
}
|
|
|
|
.status-message.info {
|
|
background-color: #d1ecf1;
|
|
color: #0c5460;
|
|
border: 1px solid #bee5eb;
|
|
}
|
|
|
|
/* Color Block Progress Styles */
|
|
.color-blocks {
|
|
margin-top: 1.5rem;
|
|
padding-top: 1rem;
|
|
border-top: 1px solid var(--border-color);
|
|
}
|
|
|
|
.color-block-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.color-block-item {
|
|
padding: 0.75rem;
|
|
border-radius: 4px;
|
|
background-color: var(--background);
|
|
border: 2px solid transparent;
|
|
transition: all 0.3s;
|
|
}
|
|
|
|
.color-block-item.completed {
|
|
border-color: var(--success-color);
|
|
background-color: #f0f9f4;
|
|
}
|
|
|
|
.color-block-item.current {
|
|
border-color: var(--primary-color);
|
|
background-color: #e7f3ff;
|
|
box-shadow: 0 2px 8px rgba(0, 102, 204, 0.2);
|
|
}
|
|
|
|
.color-block-item.pending {
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.block-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.color-swatch {
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: 4px;
|
|
border: 2px solid var(--border-color);
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.block-label {
|
|
font-weight: 600;
|
|
flex: 1;
|
|
}
|
|
|
|
.block-status {
|
|
font-size: 1.25rem;
|
|
font-weight: bold;
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
.color-block-item.completed .block-status {
|
|
color: var(--success-color);
|
|
}
|
|
|
|
.color-block-item.current .block-status {
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
.block-stitches {
|
|
font-size: 0.875rem;
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
.block-progress-bar {
|
|
margin-top: 0.5rem;
|
|
height: 4px;
|
|
background-color: #fff;
|
|
border-radius: 2px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.block-progress-fill {
|
|
height: 100%;
|
|
background-color: var(--primary-color);
|
|
transition: width 0.3s;
|
|
}
|
|
|
|
@media (max-width: 1024px) {
|
|
.app-content {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
|
|
/* ==========================================================================
|
|
State-Based UX Safety Styles
|
|
========================================================================== */
|
|
|
|
/* Confirmation Dialog Styles */
|
|
.confirm-dialog-overlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.confirm-dialog {
|
|
background-color: var(--panel-background);
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
|
|
max-width: 500px;
|
|
width: 90%;
|
|
margin: 1rem;
|
|
}
|
|
|
|
.confirm-dialog-danger {
|
|
border-top: 4px solid #dc3545;
|
|
}
|
|
|
|
.confirm-dialog-warning {
|
|
border-top: 4px solid #ffc107;
|
|
}
|
|
|
|
.confirm-dialog-header {
|
|
padding: 1.5rem;
|
|
border-bottom: 1px solid var(--border-color);
|
|
}
|
|
|
|
.confirm-dialog-header h3 {
|
|
margin: 0;
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.confirm-dialog-body {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.confirm-dialog-body p {
|
|
margin: 0;
|
|
line-height: 1.5;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.confirm-dialog-actions {
|
|
padding: 1rem 1.5rem;
|
|
display: flex;
|
|
gap: 0.75rem;
|
|
justify-content: flex-end;
|
|
border-top: 1px solid var(--border-color);
|
|
}
|
|
|
|
/* Enhanced Status Badge */
|
|
.status-badge {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 4px;
|
|
font-weight: 600;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.status-badge-idle,
|
|
.status-badge-info {
|
|
background-color: #d1ecf1;
|
|
color: #0c5460;
|
|
border: 1px solid #bee5eb;
|
|
}
|
|
|
|
.status-badge-active,
|
|
.status-badge-waiting,
|
|
.status-badge-warning {
|
|
background-color: #fff3cd;
|
|
color: #856404;
|
|
border: 1px solid #ffeeba;
|
|
}
|
|
|
|
.status-badge-complete,
|
|
.status-badge-success {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
border: 1px solid #c3e6cb;
|
|
}
|
|
|
|
.status-badge-interrupted,
|
|
.status-badge-error,
|
|
.status-badge-danger {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
border: 1px solid #f5c6cb;
|
|
}
|
|
|
|
.status-icon {
|
|
font-size: 1.1rem;
|
|
line-height: 1;
|
|
}
|
|
|
|
.status-text {
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
/* State Indicator Component */
|
|
.state-indicator {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
margin: 1rem 0;
|
|
border-left: 4px solid transparent;
|
|
}
|
|
|
|
.state-indicator-idle,
|
|
.state-indicator-info {
|
|
background-color: #e7f3ff;
|
|
border-left-color: #0066cc;
|
|
}
|
|
|
|
.state-indicator-active,
|
|
.state-indicator-waiting,
|
|
.state-indicator-warning {
|
|
background-color: #fff8e1;
|
|
border-left-color: #ffc107;
|
|
}
|
|
|
|
.state-indicator-complete,
|
|
.state-indicator-success {
|
|
background-color: #e8f5e9;
|
|
border-left-color: #28a745;
|
|
}
|
|
|
|
.state-indicator-interrupted,
|
|
.state-indicator-error,
|
|
.state-indicator-danger {
|
|
background-color: #ffebee;
|
|
border-left-color: #dc3545;
|
|
}
|
|
|
|
.state-icon {
|
|
font-size: 2rem;
|
|
line-height: 1;
|
|
}
|
|
|
|
.state-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.state-label {
|
|
font-weight: 600;
|
|
font-size: 1rem;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.state-description {
|
|
font-size: 0.875rem;
|
|
color: #666;
|
|
}
|
|
|
|
/* Enhanced Progress Visualization */
|
|
.progress-bar {
|
|
height: 12px;
|
|
background-color: var(--border-color);
|
|
border-radius: 6px;
|
|
overflow: hidden;
|
|
margin: 1rem 0;
|
|
position: relative;
|
|
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.progress-fill {
|
|
height: 100%;
|
|
background: linear-gradient(90deg, var(--primary-color), #0052a3);
|
|
transition: width 0.3s ease;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-fill::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: linear-gradient(
|
|
90deg,
|
|
transparent,
|
|
rgba(255, 255, 255, 0.3),
|
|
transparent
|
|
);
|
|
animation: shimmer 2s infinite;
|
|
}
|
|
|
|
@keyframes shimmer {
|
|
0% {
|
|
transform: translateX(-100%);
|
|
}
|
|
100% {
|
|
transform: translateX(100%);
|
|
}
|
|
}
|
|
|
|
/* Button enhancements for safety */
|
|
button.btn-danger:hover:not(:disabled) {
|
|
background-color: #c82333;
|
|
box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
button.btn-primary:hover:not(:disabled) {
|
|
box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
button.btn-secondary:hover:not(:disabled) {
|
|
box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
button:active:not(:disabled) {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
/* Info message styles */
|
|
.status-message.info {
|
|
background-color: #d1ecf1;
|
|
color: #0c5460;
|
|
border: 1px solid #bee5eb;
|
|
}
|
|
|
|
/* Enhanced visual feedback for disabled state */
|
|
button:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
filter: grayscale(0.3);
|
|
}
|