Skip to content

Commit edacf2c

Browse files
recovery center improvements
1 parent 4c4b82f commit edacf2c

4 files changed

Lines changed: 84 additions & 130 deletions

File tree

nixos/admin-app/static/css/admin.css

Lines changed: 33 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,9 +1666,10 @@ input:focus {
16661666
}
16671667

16681668
.recovery-header-card {
1669-
display: flex;
1670-
flex-direction: column;
1671-
gap: 0.4rem;
1669+
display: grid;
1670+
grid-template-columns: auto 1fr;
1671+
gap: 0.85rem;
1672+
align-items: start;
16721673
padding: 1rem 1.05rem;
16731674
border-radius: 1rem;
16741675
border: 1px solid rgb(var(--ln-border));
@@ -1684,6 +1685,31 @@ input:focus {
16841685
transform: translateY(-1px);
16851686
}
16861687

1688+
.recovery-header-card-icon {
1689+
display: inline-flex;
1690+
align-items: center;
1691+
justify-content: center;
1692+
width: 2.4rem;
1693+
height: 2.4rem;
1694+
border-radius: 0.85rem;
1695+
border: 1px solid rgb(var(--ln-pink) / 0.22);
1696+
background: rgb(var(--ln-pink) / 0.1);
1697+
color: rgb(var(--ln-pink));
1698+
flex-shrink: 0;
1699+
}
1700+
1701+
.recovery-header-card-icon svg {
1702+
width: 1rem;
1703+
height: 1rem;
1704+
}
1705+
1706+
.recovery-header-card-text {
1707+
display: flex;
1708+
flex-direction: column;
1709+
gap: 0.4rem;
1710+
min-width: 0;
1711+
}
1712+
16871713
.recovery-header-card-label {
16881714
color: rgb(var(--ln-text));
16891715
font-family: 'JetBrains Mono', monospace;
@@ -1872,58 +1898,6 @@ input:focus {
18721898
padding: 0.9rem 1rem;
18731899
}
18741900

1875-
.recovery-subsection {
1876-
margin-bottom: 0;
1877-
border: 1px solid rgb(var(--ln-border));
1878-
border-radius: 0.9rem;
1879-
background: rgb(var(--ln-card) / 0.65);
1880-
overflow: hidden;
1881-
}
1882-
1883-
.recovery-subsection-summary {
1884-
list-style: none;
1885-
display: flex;
1886-
align-items: center;
1887-
justify-content: space-between;
1888-
gap: 1rem;
1889-
cursor: pointer;
1890-
padding: 0.9rem 1rem;
1891-
}
1892-
1893-
.recovery-subsection-summary::-webkit-details-marker {
1894-
display: none;
1895-
}
1896-
1897-
.recovery-subsection-summary::after {
1898-
content: "+";
1899-
color: rgb(var(--ln-muted));
1900-
font-family: 'JetBrains Mono', monospace;
1901-
font-size: 1rem;
1902-
line-height: 1;
1903-
}
1904-
1905-
.recovery-subsection[open] .recovery-subsection-summary {
1906-
border-bottom: 1px solid rgb(var(--ln-border));
1907-
}
1908-
1909-
.recovery-subsection[open] .recovery-subsection-summary::after {
1910-
content: "-";
1911-
color: rgb(var(--ln-pink));
1912-
}
1913-
1914-
.recovery-subsection-meta {
1915-
margin-left: auto;
1916-
color: rgb(var(--ln-muted));
1917-
font-family: 'JetBrains Mono', monospace;
1918-
font-size: 0.74rem;
1919-
text-transform: uppercase;
1920-
letter-spacing: 0.08em;
1921-
}
1922-
1923-
.recovery-subsection-body {
1924-
padding: 0.9rem 1rem;
1925-
}
1926-
19271901
.recovery-saved-list {
19281902
display: grid;
19291903
gap: 0.7rem;
@@ -1961,6 +1935,10 @@ input:focus {
19611935
grid-template-columns: 1fr;
19621936
}
19631937

1938+
.recovery-header-card {
1939+
grid-template-columns: auto 1fr;
1940+
}
1941+
19641942
.recovery-accordion-summary {
19651943
flex-direction: column;
19661944
}

nixos/admin-app/static/js/dashboard-db.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,9 @@
4949
D.renderSavedBackups = function (backups) {
5050
const container = el('recovery-saved-backups');
5151
const localSelect = el('restore-local-backup');
52-
const countLabel = el('recovery-saved-backups-count');
53-
const section = el('recovery-saved-backups-section');
5452
if (container) {
5553
container.innerHTML = '';
5654
}
57-
if (countLabel) {
58-
const total = backups && backups.length ? backups.length : 0;
59-
countLabel.textContent = total === 1 ? '1 backup' : total + ' backups';
60-
}
61-
if (section && backups && backups.length) {
62-
section.open = false;
63-
}
6455
if (localSelect) {
6556
localSelect.innerHTML = '<option value="">Choose a saved backup</option>';
6657
}

nixos/admin-app/templates/partials/cards/recovery_center.html

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<div class="recovery-footer-note mb-4">
2+
<div class="recovery-callout-title">Important</div>
3+
<p class="recovery-helper-text mb-0">
4+
Recovery archives can restore LNbits data, device settings, remote-access state, and Spark-sidecar files. Your Spark seed phrase is still the main secret for recovering wallet access and funds.
5+
</p>
6+
</div>
17
<div class="bg-ln-card border border-ln-border rounded-xl p-4 sm:p-6 transition-all duration-500 recovery-center" id="recovery-card">
28
<div class="recovery-status-strip">
39
<div class="recovery-status-pill">
@@ -56,10 +62,6 @@
5662
<option value="quick">Quick backup</option>
5763
</select>
5864
</label>
59-
<p class="recovery-helper-text mb-3" id="recovery-destination-note">
60-
Saved on this box in the local recovery folder. You can download saved backups below at any time.
61-
</p>
62-
6365
<label class="block mb-3">
6466
<span class="text-ln-muted text-xs font-mono uppercase tracking-wider block mb-1.5">Backup Password</span>
6567
<input type="password" id="recovery-passphrase" autocomplete="new-password"
@@ -79,23 +81,7 @@
7981
class="bg-ln-pink hover:bg-ln-pink-dim text-white font-mono text-sm py-2 px-4 rounded-lg transition-colors">
8082
Download Backup
8183
</button>
82-
<button id="recovery-save-btn"
83-
class="text-ln-muted hover:text-ln-pink text-xs font-mono uppercase tracking-wider transition-colors px-3 py-2 border border-ln-border rounded-lg hover:border-ln-pink/30">
84-
Save on This Box
85-
</button>
8684
</div>
87-
88-
<details class="recovery-subsection mt-4" id="recovery-saved-backups-section">
89-
<summary class="recovery-subsection-summary">
90-
<span class="recovery-callout-title">Saved Backups On This Box</span>
91-
<span class="recovery-subsection-meta" id="recovery-saved-backups-count">0 backups</span>
92-
</summary>
93-
<div class="recovery-subsection-body">
94-
<div id="recovery-saved-backups" class="recovery-saved-list">
95-
<div class="recovery-helper-text">No saved backups yet.</div>
96-
</div>
97-
</div>
98-
</details>
9985
</div>
10086
</section>
10187

@@ -166,44 +152,5 @@
166152
</button>
167153
</div>
168154
</section>
169-
170-
<section class="recovery-accordion" id="recovery-restore">
171-
<div class="recovery-accordion-summary">
172-
<div class="recovery-step-heading">
173-
<div class="recovery-step-icon" aria-hidden="true">
174-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
175-
<path d="M3 12a9 9 0 1 0 3-6.7"></path>
176-
<path d="M3 3v6h6"></path>
177-
<path d="M12 8v4l2.5 2.5"></path>
178-
</svg>
179-
</div>
180-
<div class="recovery-step-text">
181-
<div class="recovery-step-label">Restore</div>
182-
<div class="recovery-step-title">Inspect And Recover From An Existing Archive</div>
183-
<p class="recovery-step-copy">Validate the backup first, then choose only the parts you want to restore onto this box.</p>
184-
</div>
185-
</div>
186-
<span class="recovery-accordion-badge">Restore</span>
187-
</div>
188-
<div class="recovery-accordion-body">
189-
<div class="recovery-callout mb-4">
190-
<div class="recovery-callout-title">Safe restore flow</div>
191-
<p class="recovery-helper-text mb-0">
192-
LNbitsBox can restore from a backup file you upload or from one already saved on this box. It checks the backup before making changes.
193-
</p>
194-
</div>
195-
<button id="recovery-restore-btn"
196-
class="text-ln-muted hover:text-ln-pink text-xs font-mono uppercase tracking-wider transition-colors px-3 py-2 border border-ln-border rounded-lg hover:border-ln-pink/30">
197-
Open Restore Tool
198-
</button>
199-
</div>
200-
</section>
201-
</div>
202-
203-
<div class="recovery-footer-note">
204-
<div class="recovery-callout-title">Important</div>
205-
<p class="recovery-helper-text mb-0">
206-
Recovery archives can restore LNbits data, device settings, remote-access state, and Spark-sidecar files. Your Spark seed phrase is still the main secret for recovering wallet access and funds.
207-
</p>
208155
</div>
209156
</div>

nixos/admin-app/templates/recovery.html

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,45 @@
88
</div>
99
<div class="admin-page-actions recovery-header-actions">
1010
<a href="#recovery-manual-backup" class="recovery-header-card">
11-
<span class="recovery-header-card-label">Manual Backup</span>
12-
<span class="recovery-header-card-copy">Create and download an encrypted backup right now.</span>
11+
<span class="recovery-header-card-icon" aria-hidden="true">
12+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
13+
<path d="M12 3l7 3v5c0 5-3.4 8.3-7 10-3.6-1.7-7-5-7-10V6l7-3z"></path>
14+
<path d="M12 8v8"></path>
15+
<path d="M8.5 12H15.5"></path>
16+
</svg>
17+
</span>
18+
<span class="recovery-header-card-text">
19+
<span class="recovery-header-card-label">Manual Backup</span>
20+
<span class="recovery-header-card-copy">Create and download an encrypted backup right now.</span>
21+
</span>
1322
</a>
1423
<a href="#recovery-scheduled-backups" class="recovery-header-card">
15-
<span class="recovery-header-card-label">Scheduled Backups</span>
16-
<span class="recovery-header-card-copy">Set recurring protected backups for this box.</span>
24+
<span class="recovery-header-card-icon" aria-hidden="true">
25+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
26+
<rect x="3.5" y="5" width="17" height="15" rx="2"></rect>
27+
<path d="M8 3v4"></path>
28+
<path d="M16 3v4"></path>
29+
<path d="M3.5 10.5h17"></path>
30+
<path d="M8.5 14h3"></path>
31+
</svg>
32+
</span>
33+
<span class="recovery-header-card-text">
34+
<span class="recovery-header-card-label">Scheduled Backups</span>
35+
<span class="recovery-header-card-copy">Set recurring protected backups for this box.</span>
36+
</span>
1737
</a>
18-
<a href="#recovery-restore" class="recovery-header-card">
19-
<span class="recovery-header-card-label">Restore</span>
20-
<span class="recovery-header-card-copy">Validate a backup and restore only what you need.</span>
38+
<a href="#recovery-restore" class="recovery-header-card" data-open-restore="true">
39+
<span class="recovery-header-card-icon" aria-hidden="true">
40+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
41+
<path d="M3 12a9 9 0 1 0 3-6.7"></path>
42+
<path d="M3 3v6h6"></path>
43+
<path d="M12 8v4l2.5 2.5"></path>
44+
</svg>
45+
</span>
46+
<span class="recovery-header-card-text">
47+
<span class="recovery-header-card-label">Restore</span>
48+
<span class="recovery-header-card-copy">Validate a backup and restore only what you need.</span>
49+
</span>
2150
</a>
2251
</div>
2352
</div>
@@ -42,6 +71,15 @@
4271
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
4372
}
4473

74+
document.querySelectorAll('[data-open-restore="true"]').forEach(function (link) {
75+
link.addEventListener('click', function (event) {
76+
event.preventDefault();
77+
if (window.LNbitsBoxDashboard && typeof window.LNbitsBoxDashboard.openRestoreModal === 'function') {
78+
window.LNbitsBoxDashboard.openRestoreModal();
79+
}
80+
});
81+
});
82+
4583
window.addEventListener('hashchange', scrollRecoverySectionFromHash);
4684
scrollRecoverySectionFromHash();
4785
})();

0 commit comments

Comments
 (0)