feat(launcher): implement auto-collapse coordinator and overhauled configuration UI
- Introduced 'Launcher_Cfg_Section' with 3-way state support (collapsed, auto, pinned). - Implemented 'handle_section_expand' coordinator in 'launcher_cfg.svelte' for single-active-section behavior. - Overhauled all configuration sub-components to participate in the auto-collapse logic. - Updated 'ae_events_stores.ts' with new persistent section states. - Synchronized 'launcher_cfg_template.svelte' with the new pattern for future extensions.
This commit is contained in:
@@ -35,6 +35,23 @@
|
||||
|
||||
// UI Tab State
|
||||
let active_tab: 'system' | 'sync' | 'general' = $state('system');
|
||||
|
||||
/**
|
||||
* Auto-Collapse Coordinator
|
||||
* When a section is opened in 'auto' mode, collapse all other 'auto' sections.
|
||||
* Pinned sections are ignored and remain open.
|
||||
*/
|
||||
function handle_section_expand(current_key: string) {
|
||||
const launcher = $events_loc.launcher;
|
||||
Object.keys(launcher).forEach(key => {
|
||||
if (key.startsWith('section_state__') && key !== `section_state__${current_key}`) {
|
||||
if (launcher[key] === 'auto') {
|
||||
launcher[key] = 'collapsed';
|
||||
}
|
||||
}
|
||||
});
|
||||
$events_loc.launcher = launcher; // Trigger store update
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -92,9 +109,9 @@
|
||||
{#if active_tab === 'system'}
|
||||
<div class="animate-in fade-in slide-in-from-left-2 duration-300">
|
||||
{#if $ae_loc.is_native}
|
||||
<Launcher_Cfg_Health />
|
||||
<Launcher_Cfg_Native_OS />
|
||||
<Launcher_Cfg_Updates />
|
||||
<Launcher_Cfg_Health on_expand={() => handle_section_expand('health')} />
|
||||
<Launcher_Cfg_Native_OS on_expand={() => handle_section_expand('native_os')} />
|
||||
<Launcher_Cfg_Updates on_expand={() => handle_section_expand('updates')} />
|
||||
{:else}
|
||||
<div class="card p-8 text-center opacity-50 italic text-sm">
|
||||
Native OS features are only available when running in the Aether Desktop app.
|
||||
@@ -105,16 +122,16 @@
|
||||
|
||||
{#if active_tab === 'sync'}
|
||||
<div class="animate-in fade-in slide-in-from-bottom-2 duration-300">
|
||||
<Launcher_Cfg_Sync_Timers />
|
||||
<Launcher_Cfg_Sync_Timers on_expand={() => handle_section_expand('sync_timers')} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if active_tab === 'general'}
|
||||
<div class="animate-in fade-in slide-in-from-right-2 duration-300">
|
||||
<Launcher_Cfg_Controller />
|
||||
<Launcher_Cfg_App_Modes />
|
||||
<Launcher_Cfg_Screen_Saver />
|
||||
<Launcher_Cfg_Local_Actions />
|
||||
<Launcher_Cfg_Controller on_expand={() => handle_section_expand('controller')} />
|
||||
<Launcher_Cfg_App_Modes on_expand={() => handle_section_expand('app_modes')} />
|
||||
<Launcher_Cfg_Screen_Saver on_expand={() => handle_section_expand('screen_saver')} />
|
||||
<Launcher_Cfg_Local_Actions on_expand={() => handle_section_expand('local_actions')} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user