Skip to content

Commit dbb5bc0

Browse files
committed
Improve updates dialog UI
1 parent 15dd906 commit dbb5bc0

1 file changed

Lines changed: 39 additions & 25 deletions

File tree

frontend/src/lib/components/modals/updates/UpdatesModal.svelte

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -120,55 +120,69 @@
120120
<header class="card-header font-bold text-2xl text-center">
121121
<T defaultValue="Updates" keyName="updates.title" />
122122
</header>
123-
<section class="px-4">
124-
<button
125-
class="btn"
126-
on:click={() => $showIgnored = !$showIgnored}>
127-
{$showIgnored ? $t('updates.hide-ignored', 'Hide ignored') : $t('updates.show-ignored', 'Show ignored')}
128-
</button>
129-
</section>
130-
<section class="px-4 flex-auto grid grid-cols-12 overflow-y-auto">
123+
<section class="px-4 py-1 space-y-2 flex-auto overflow-y-auto">
131124
{#each updatesToDisplay as update}
132-
<button class="btn p-2 col-span-8 text-left space-x-2" on:click={() => toggleSelected(update)}>
133-
<div class="h-full w-6">
125+
<button class="btn p-2 grid grid-cols-12 {$selectedUpdates.includes(update) ? '!outline !outline-2 !outline-primary-500 bg-surface-400-500-token' : ''}" on:click={() => toggleSelected(update)}>
126+
<div>
134127
{#if $selectedUpdates.includes(update)}
135128
<SvgIcon class="h-full w-8 mx-auto" icon={mdiDownload} />
136129
{/if}
137130
</div>
138-
<div class="h-full flex-auto flex flex-col content-center">
131+
<div class="col-span-7 text-left flex-auto flex flex-col content-center">
139132
<span>{modNames[update.item] ?? update.item}</span>
140133
<span>{update.currentVersion} -> {update.newVersion}</span>
141134
</div>
142-
</button>
143-
<button
144-
class="btn col-span-2"
145-
on:click={() => modalStore.trigger({ type:'component', component:{ ref: ModChangelog, props:{ mod:update.item, versionRange:{ from:update.currentVersion, to:update.newVersion } } } }, true)}>
146-
<T defaultValue="Changelog" keyName="updates.changelog" />
147-
</button>
148-
<button
149-
class="btn col-span-2"
150-
on:click={() => toggleIgnoreUpdate(update)}>
151-
{$unignoredUpdates.includes(update) ? $t('updates.ignore', 'Ignore') : $t('updates.unignore', 'Unignore')}
135+
<button
136+
class="btn col-span-2"
137+
on:click|stopPropagation={() => modalStore.trigger({ type:'component', component:{ ref: ModChangelog, props:{ mod:update.item, versionRange:{ from:update.currentVersion, to:update.newVersion } } } }, true)}>
138+
<T defaultValue="Changelog" keyName="updates.changelog" />
139+
</button>
140+
<button
141+
class="btn col-span-2"
142+
on:click|stopPropagation={() => toggleIgnoreUpdate(update)}>
143+
{$unignoredUpdates.includes(update) ? $t('updates.ignore', 'Ignore') : $t('updates.unignore', 'Unignore')}
144+
</button>
152145
</button>
153146
{/each}
154147
</section>
155-
<footer class="card-footer">
148+
<footer class="card-footer flex space-x-2">
156149
<button
157-
class="btn"
150+
class="btn variant-filled-surface"
158151
on:click={parent.onClose}>
159152
<T defaultValue="Close" keyName="common.close" />
160153
</button>
161154
<button
162-
class="btn"
155+
class="btn variant-filled-surface"
163156
disabled={!$canModify || $updateCheckInProgress || !updatesToDisplay.length}
164157
on:click={() => updateAll()}>
165158
<T defaultValue="Update All" keyName="updates.update-all" />
166159
</button>
167160
<button
168-
class="btn"
161+
class="btn variant-filled-surface"
169162
disabled={!$canModify || $updateCheckInProgress || !updatesToDisplay.length || !$selectedUpdates.length}
170163
on:click={() => updateSelected()}>
171164
<T defaultValue="Update Selected" keyName="updates.update-selected" />
172165
</button>
166+
<div class="grow" />
167+
<button
168+
class="btn variant-filled-surface"
169+
on:click={() => $showIgnored = !$showIgnored}>
170+
{$showIgnored ? $t('updates.hide-ignored', 'Hide ignored') : $t('updates.show-ignored', 'Show ignored')}
171+
</button>
173172
</footer>
174173
</div>
174+
175+
176+
<style lang="postcss">
177+
/*
178+
A button is focused by default when the modal opens, but not with focus-visible.
179+
This style is part of skeleton as a workaround for this issue,
180+
but results in all buttons having a focus outline, even when using the mouse.
181+
182+
Since we want to use the outline to display the selected items, having it show on all buttons is not ideal.
183+
This style is a workaround to revert the workaround, and results in the default focused button not having an outline until using tab navigation.
184+
*/
185+
*:focus:not(:focus-visible):not([tabindex='-1']):not(.input):not(.textarea):not(.select):not(.input-group):not(.input-group input) {
186+
outline-width: 0;
187+
}
188+
</style>

0 commit comments

Comments
 (0)