[ui] CalmRefresh: One quiet line and Refresh when a new version of the garden is waiting
This commit is contained in:
@@ -13,7 +13,9 @@
|
||||
let {
|
||||
letter = '',
|
||||
sunset,
|
||||
rose
|
||||
rose,
|
||||
updateReady = false,
|
||||
onrefresh
|
||||
}: {
|
||||
/** The author's Markdown from docs/LETTER.md. Empty means there is no way to the page. */
|
||||
letter?: string;
|
||||
@@ -21,6 +23,10 @@
|
||||
sunset?: SunsetWiring;
|
||||
/** The rose and her care log. Absent, the garden has no rose. */
|
||||
rose?: RoseWiring;
|
||||
/** A new version of the garden is installed and waiting (calm-refresh.md). */
|
||||
updateReady?: boolean;
|
||||
/** Swap to the waiting version and reload. Only ever called by the player's tap. */
|
||||
onrefresh?: () => void;
|
||||
} = $props();
|
||||
|
||||
// --- The sunset (sunset-place.md) ---------------------------------------
|
||||
@@ -143,6 +149,14 @@
|
||||
</main>
|
||||
{/if}
|
||||
|
||||
{#if updateReady && onrefresh}
|
||||
<aside class="update" aria-label={en.update.ready}>
|
||||
<p role="status">{en.update.ready}</p>
|
||||
<button type="button" onclick={onrefresh}>{en.update.refresh}</button>
|
||||
</aside>
|
||||
{/if}
|
||||
|
||||
|
||||
<style>
|
||||
.shell {
|
||||
min-height: 100dvh;
|
||||
@@ -205,6 +219,35 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.update {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
background: var(--paper);
|
||||
border-top: 1px solid color-mix(in srgb, var(--ink-soft) 30%, transparent);
|
||||
}
|
||||
|
||||
.update p {
|
||||
margin: 0;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
.update button {
|
||||
font: inherit;
|
||||
padding: var(--space-1) var(--space-3);
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--rose);
|
||||
background: var(--paper);
|
||||
color: var(--ink);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.update button:focus-visible,
|
||||
.quiet:focus-visible {
|
||||
outline: 2px solid var(--rose);
|
||||
outline-offset: 2px;
|
||||
|
||||
Reference in New Issue
Block a user