Skip to content

Commit

Permalink
Merge pull request #206 from matt8707/group
Browse files Browse the repository at this point in the history
Add 'group' modal support, closes #179
  • Loading branch information
matt8707 authored Jan 19, 2024
2 parents 3f47845 + 4b5da24 commit 7abccc6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ List grouped by domains and categorized based on their similar behaviors
- [ ] idea: custom map if map camera
- [x] <https://github.com/matt8707/ha-fusion/issues/24>
- [x] counter
- [ ] group
- [x] group

### Date

Expand Down
4 changes: 4 additions & 0 deletions src/lib/Main/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@
});
break;
case 'group':
openModal(() => import('$lib/Modal/GroupModal.svelte'), { sel });
break;
case 'device_tracker': {
if ($states?.[sel?.entity_id]?.attributes?.source_type === 'gps') {
openModal(() => import('$lib/Modal/DeviceTrackerModal.svelte'), { sel });
Expand Down
27 changes: 27 additions & 0 deletions src/lib/Modal/GroupModal.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script lang="ts">
import { states } from '$lib/Stores';
import Modal from '$lib/Modal/Index.svelte';
import StateLogic from '$lib/Components/StateLogic.svelte';
import ConfigButtons from '$lib/Modal/ConfigButtons.svelte';
import { getName } from '$lib/Utils';
export let isOpen: boolean;
export let sel: any;
$: entity = $states?.[sel?.entity_id];
$: group = entity?.attributes?.entity_id;
</script>

{#if isOpen}
<Modal>
<h1 slot="title">{getName(sel, entity)}</h1>

{#each group as child_entity_id}
<h2>{getName(undefined, $states?.[child_entity_id])}</h2>

<StateLogic entity_id={child_entity_id} selected={undefined} />
{/each}

<ConfigButtons />
</Modal>
{/if}

0 comments on commit 7abccc6

Please sign in to comment.