Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
class Component extends DCLogic {
state = {
ready: false,
theme: 'dark',
theme: (function () { try { return localStorage.getItem('ls_theme') || 'dark'; } catch (e) { return 'dark'; } })(),
route: 'loading',
orgId: 'aurora',
orgs: seedOrgs(),
Expand Down Expand Up @@ -488,7 +488,7 @@
{ icon: 'box', label: 'Create repository', kind: 'Action', run: () => this.setState({ cmdOpen: false, nav: 'repos', confirm: { create: true }, newOrgName: '' }) },
{ icon: 'key-round', label: 'Generate access token', kind: 'Action', run: () => this.setState({ cmdOpen: false, nav: 'tokens', tokenModal: { step: 'form', name: '', scopes: { lock: true, read: true, write: true } } }) },
{ icon: 'database', label: 'Connect storage', kind: 'Action', run: () => { this.setState({ cmdOpen: false, nav: 'storage', storageEditing: true }); this.ensureDraft(); } },
{ icon: this.state.theme === 'dark' ? 'sun' : 'moon', label: 'Toggle theme', kind: 'Action', run: () => this.setState(s => ({ cmdOpen: false, theme: s.theme === 'dark' ? 'light' : 'dark' })) },
{ icon: this.state.theme === 'dark' ? 'sun' : 'moon', label: 'Toggle theme', kind: 'Action', run: () => this.setState(s => { const t = s.theme === 'dark' ? 'light' : 'dark'; try { localStorage.setItem('ls_theme', t); } catch (e) {} return { cmdOpen: false, theme: t }; }) },
{ icon: 'book-open', label: 'Open documentation', kind: 'Help', run: () => { this.setState({ cmdOpen: false }); window.open('https://github.com/nikrich/lockstep#readme', '_blank'); } },
{ icon: 'life-buoy', label: 'Contact support', kind: 'Help', run: () => this.setState({ cmdOpen: false, helpOpen: true }) },
{ icon: 'log-out', label: 'Sign out', kind: 'Account', run: () => { this.setState({ cmdOpen: false }); if (window.LSAPI) window.LSAPI.logout().finally(() => this.setState({ route: 'signin' })); else this.setState({ route: 'signin' }); } },
Expand Down Expand Up @@ -590,7 +590,7 @@
}

themeToggle(style = {}) {
return h('button', { onClick: () => this.setState(s => ({ theme: s.theme === 'dark' ? 'light' : 'dark' })), title: 'Toggle theme',
return h('button', { onClick: () => this.setState(s => { const t = s.theme === 'dark' ? 'light' : 'dark'; try { localStorage.setItem('ls_theme', t); } catch (e) {} return { theme: t }; }), title: 'Toggle theme',
onMouseEnter: e => e.currentTarget.style.background = 'var(--surface-hover)', onMouseLeave: e => e.currentTarget.style.background = 'transparent',
style: { width: 34, height: 34, borderRadius: 'var(--radius-md)', border: 'none', background: 'transparent', color: 'var(--text-secondary)', cursor: 'pointer', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', transition: 'background var(--dur-fast)', ...style } },
h(Icon, { n: this.state.theme === 'dark' ? 'sun' : 'moon', s: 17 }));
Expand Down
6 changes: 3 additions & 3 deletions dashboard/source.dc.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
class Component extends DCLogic {
state = {
ready: false,
theme: 'dark',
theme: (function () { try { return localStorage.getItem('ls_theme') || 'dark'; } catch (e) { return 'dark'; } })(),
route: 'loading',
orgId: 'aurora',
orgs: seedOrgs(),
Expand Down Expand Up @@ -487,7 +487,7 @@
{ icon: 'box', label: 'Create repository', kind: 'Action', run: () => this.setState({ cmdOpen: false, nav: 'repos', confirm: { create: true }, newOrgName: '' }) },
{ icon: 'key-round', label: 'Generate access token', kind: 'Action', run: () => this.setState({ cmdOpen: false, nav: 'tokens', tokenModal: { step: 'form', name: '', scopes: { lock: true, read: true, write: true } } }) },
{ icon: 'database', label: 'Connect storage', kind: 'Action', run: () => { this.setState({ cmdOpen: false, nav: 'storage', storageEditing: true }); this.ensureDraft(); } },
{ icon: this.state.theme === 'dark' ? 'sun' : 'moon', label: 'Toggle theme', kind: 'Action', run: () => this.setState(s => ({ cmdOpen: false, theme: s.theme === 'dark' ? 'light' : 'dark' })) },
{ icon: this.state.theme === 'dark' ? 'sun' : 'moon', label: 'Toggle theme', kind: 'Action', run: () => this.setState(s => { const t = s.theme === 'dark' ? 'light' : 'dark'; try { localStorage.setItem('ls_theme', t); } catch (e) {} return { cmdOpen: false, theme: t }; }) },
{ icon: 'book-open', label: 'Open documentation', kind: 'Help', run: () => { this.setState({ cmdOpen: false }); window.open('https://github.com/nikrich/lockstep#readme', '_blank'); } },
{ icon: 'life-buoy', label: 'Contact support', kind: 'Help', run: () => this.setState({ cmdOpen: false, helpOpen: true }) },
{ icon: 'log-out', label: 'Sign out', kind: 'Account', run: () => { this.setState({ cmdOpen: false }); if (window.LSAPI) window.LSAPI.logout().finally(() => this.setState({ route: 'signin' })); else this.setState({ route: 'signin' }); } },
Expand Down Expand Up @@ -589,7 +589,7 @@
}

themeToggle(style = {}) {
return h('button', { onClick: () => this.setState(s => ({ theme: s.theme === 'dark' ? 'light' : 'dark' })), title: 'Toggle theme',
return h('button', { onClick: () => this.setState(s => { const t = s.theme === 'dark' ? 'light' : 'dark'; try { localStorage.setItem('ls_theme', t); } catch (e) {} return { theme: t }; }), title: 'Toggle theme',
onMouseEnter: e => e.currentTarget.style.background = 'var(--surface-hover)', onMouseLeave: e => e.currentTarget.style.background = 'transparent',
style: { width: 34, height: 34, borderRadius: 'var(--radius-md)', border: 'none', background: 'transparent', color: 'var(--text-secondary)', cursor: 'pointer', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', transition: 'background var(--dur-fast)', ...style } },
h(Icon, { n: this.state.theme === 'dark' ? 'sun' : 'moon', s: 17 }));
Expand Down
Loading