Complete Story 3.3: Preset Import & Export
Implements FR-19: Preset import/export as JSON New Files: - src/core/PresetImportExportManager.js - Core logic for export/import with merge/replace - src/ui/gm/PresetExportDialog.js - Export dialog with file download - src/ui/gm/PresetImportDialog.js - Import dialog with file picker, preview, merge/replace - templates/preset-export.hbs - Export dialog template - templates/preset-import.hbs - Import dialog template - styles/components/_preset-import-export.less - Dialog styles - tests/unit/core/PresetImportExportManager.test.js - 38 unit tests - _bmad-output/implementation-artifacts/3-3-preset-import-and-export.md - Story file Modified Files: - src/ui/gm/DirectorsBoard.js - Added export/import button handlers - templates/directors-board.hbs - Added Export/Import buttons to footer - styles/scrying-pool.less - Added stylesheet import - lang/en.json - Added localization strings for new UI - _bmad-output/implementation-artifacts/sprint-status.yaml - Story status: review Features: - Export all presets from current scene as JSON file - Import presets with merge (add new, skip duplicates) or replace (overwrite all) modes - Preview of presets before import with validation status - Confirmation dialog for replace mode to prevent data loss - Comprehensive error handling and validation - All ACs satisfied (AC-9 deferred for README docs) Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -0,0 +1,403 @@
|
||||
// ============================================================================
|
||||
// Preset Import/Export Dialogs
|
||||
// Story 3.3: Preset Import & Export
|
||||
// ============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Shared Dialog Styles
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
.scrying-pool.dialog.preset-export,
|
||||
.scrying-pool.dialog.preset-import {
|
||||
.sp-dialog-content {
|
||||
padding: var(--sp-space-m);
|
||||
color: var(--sp-text-primary);
|
||||
}
|
||||
|
||||
.sp-dialog-buttons {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: var(--sp-space-xs);
|
||||
padding: var(--sp-space-m);
|
||||
border-top: 1px solid var(--sp-border);
|
||||
background: var(--sp-surface);
|
||||
}
|
||||
|
||||
// Description text
|
||||
.sp-export-description,
|
||||
.sp-import-description {
|
||||
margin: 0 0 var(--sp-space-m) 0;
|
||||
color: var(--sp-text-secondary);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
// Form groups
|
||||
.sp-form-group {
|
||||
margin-bottom: var(--sp-space-m);
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.sp-form-label {
|
||||
display: block;
|
||||
margin-bottom: var(--sp-space-xs);
|
||||
font-weight: 600;
|
||||
color: var(--sp-text-primary);
|
||||
font-size: var(--sp-font-size-sm);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
// Info rows
|
||||
.sp-export-info,
|
||||
.sp-import-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-space-xs);
|
||||
margin-bottom: var(--sp-space-xs);
|
||||
padding: var(--sp-space-xs) var(--sp-space-sm);
|
||||
background: var(--sp-surface-subtle);
|
||||
border-radius: var(--sp-radius-sm);
|
||||
font-size: var(--sp-font-size-sm);
|
||||
}
|
||||
|
||||
.sp-info-label {
|
||||
color: var(--sp-text-secondary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sp-info-value {
|
||||
color: var(--sp-text-primary);
|
||||
}
|
||||
|
||||
.sp-filename {
|
||||
font-family: monospace;
|
||||
font-size: 0.85em;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Buttons
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.sp-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--sp-space-xs);
|
||||
padding: var(--sp-space-xs) var(--sp-space-m);
|
||||
border: none;
|
||||
border-radius: var(--sp-radius-sm);
|
||||
font-size: var(--sp-font-size-sm);
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
}
|
||||
|
||||
.sp-btn-primary {
|
||||
background: var(--sp-accent);
|
||||
color: var(--sp-accent-text);
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: var(--sp-accent-hover);
|
||||
}
|
||||
|
||||
&:active:not(:disabled) {
|
||||
background: var(--sp-accent-active);
|
||||
}
|
||||
}
|
||||
|
||||
.sp-btn-secondary {
|
||||
background: var(--sp-surface-subtle);
|
||||
color: var(--sp-text-primary);
|
||||
border: 1px solid var(--sp-border);
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: var(--sp-surface);
|
||||
}
|
||||
}
|
||||
|
||||
.sp-btn-danger {
|
||||
background: var(--sp-color-red);
|
||||
color: white;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: var(--sp-color-red-dark);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// File Upload Styles
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.sp-file-upload {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.sp-file-input {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
z-index: 2;
|
||||
|
||||
// Prevent pointer events from bubbling through
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sp-file-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-space-xs);
|
||||
padding: var(--sp-space-sm) var(--sp-space-m);
|
||||
background: var(--sp-surface-subtle);
|
||||
border: 1px dashed var(--sp-border);
|
||||
border-radius: var(--sp-radius-sm);
|
||||
cursor: pointer;
|
||||
color: var(--sp-text-secondary);
|
||||
transition: all 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--sp-accent);
|
||||
color: var(--sp-accent);
|
||||
background: var(--sp-surface);
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
}
|
||||
|
||||
.sp-file-selected {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-space-xs);
|
||||
margin-top: var(--sp-space-xs);
|
||||
padding: var(--sp-space-xs) var(--sp-space-sm);
|
||||
background: var(--sp-color-green-subtle);
|
||||
border-radius: var(--sp-radius-sm);
|
||||
font-size: var(--sp-font-size-sm);
|
||||
color: var(--sp-color-green);
|
||||
|
||||
i {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Radio Group Styles
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.sp-radio-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-space-xs);
|
||||
}
|
||||
|
||||
.sp-radio-label {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--sp-space-sm);
|
||||
padding: var(--sp-space-xs) var(--sp-space-sm);
|
||||
border-radius: var(--sp-radius-sm);
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--sp-surface-subtle);
|
||||
}
|
||||
|
||||
input[type="radio"] {
|
||||
margin-top: 0.2em;
|
||||
accent-color: var(--sp-accent);
|
||||
}
|
||||
|
||||
.sp-radio-text {
|
||||
font-weight: 500;
|
||||
color: var(--sp-text-primary);
|
||||
}
|
||||
|
||||
.sp-radio-hint {
|
||||
display: block;
|
||||
font-size: 0.85em;
|
||||
color: var(--sp-text-secondary);
|
||||
margin-top: 0.1em;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Preview Section
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.sp-preview-section {
|
||||
margin-top: var(--sp-space-m);
|
||||
padding-top: var(--sp-space-m);
|
||||
border-top: 1px solid var(--sp-border);
|
||||
}
|
||||
|
||||
.sp-preview-title {
|
||||
margin: 0 0 var(--sp-space-sm) 0;
|
||||
font-size: var(--sp-font-size-sm);
|
||||
font-weight: 600;
|
||||
color: var(--sp-text-primary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.sp-preview-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid var(--sp-border);
|
||||
border-radius: var(--sp-radius-sm);
|
||||
background: var(--sp-surface);
|
||||
}
|
||||
|
||||
.sp-preview-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-space-sm);
|
||||
padding: var(--sp-space-xs) var(--sp-space-sm);
|
||||
border-bottom: 1px solid var(--sp-border-subtle);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 0.9em;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sp-valid {
|
||||
color: var(--sp-color-green);
|
||||
}
|
||||
|
||||
.sp-invalid {
|
||||
color: var(--sp-color-red);
|
||||
}
|
||||
|
||||
.sp-preview-name {
|
||||
flex-grow: 1;
|
||||
font-size: var(--sp-font-size-sm);
|
||||
color: var(--sp-text-primary);
|
||||
}
|
||||
|
||||
.sp-preview-error {
|
||||
font-size: 0.8em;
|
||||
color: var(--sp-color-red);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
&--invalid {
|
||||
background: rgba(var(--sp-color-red-rgb), 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Warning Box
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.sp-warning-box {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--sp-space-sm);
|
||||
padding: var(--sp-space-sm);
|
||||
margin-bottom: var(--sp-space-m);
|
||||
background: var(--sp-color-yellow-subtle);
|
||||
border-radius: var(--sp-radius-sm);
|
||||
color: var(--sp-color-yellow);
|
||||
font-size: var(--sp-font-size-sm);
|
||||
|
||||
i {
|
||||
font-size: 1.1em;
|
||||
flex-shrink: 0;
|
||||
margin-top: 0.1em;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Confirmation Section
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.sp-confirmation-section {
|
||||
margin-top: var(--sp-space-m);
|
||||
padding: var(--sp-space-sm);
|
||||
background: var(--sp-color-red-subtle);
|
||||
border-radius: var(--sp-radius-sm);
|
||||
}
|
||||
|
||||
.sp-confirmation-warning {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--sp-space-sm);
|
||||
color: var(--sp-color-red);
|
||||
font-size: var(--sp-font-size-sm);
|
||||
font-weight: 500;
|
||||
|
||||
i {
|
||||
font-size: 1.1em;
|
||||
flex-shrink: 0;
|
||||
margin-top: 0.1em;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Loading State
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
.fas.fa-spinner.fa-spin {
|
||||
animation: sp-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes sp-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Responsive adjustments
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.scrying-pool.dialog.preset-export,
|
||||
.scrying-pool.dialog.preset-import {
|
||||
width: 90vw;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.sp-dialog-buttons {
|
||||
flex-wrap: wrap;
|
||||
gap: var(--sp-space-sm);
|
||||
|
||||
.sp-btn {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user