Move preview button to per-slot in edit form, remove card dropdown
All checks were successful
Validate / Hassfest (push) Successful in 3s

- Preview button always visible next to Variables for each template slot
- Remove \n\n prefix from video_warning default value
- Use conditional {% if video_warning %} with blank line in templates
- Fix all .jinja2 files and inline defaults to match
- Add SVG favicon (camera + notification dot)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-19 21:03:35 +03:00
parent b87b5b2c87
commit 510463cba6
7 changed files with 26 additions and 11 deletions

View File

@@ -3,6 +3,8 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<title>Immich Watcher</title>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">

View File

@@ -189,6 +189,8 @@
<div class="flex items-center justify-between mb-1">
<label class="text-xs text-[var(--color-muted-foreground)]">{t(`templateConfig.${slot.label}`)}</label>
<div class="flex items-center gap-2">
<button type="button" onclick={() => previewSlot(slot.key)}
class="text-xs text-[var(--color-muted-foreground)] hover:underline">{t('templateConfig.preview')}</button>
{#if varsRef[slot.key]}
<button type="button" onclick={() => showVarsFor = slot.key}
class="text-xs text-[var(--color-muted-foreground)] hover:underline">{t('templateConfig.variables')}</button>
@@ -204,13 +206,10 @@
<p class="mt-1 text-xs" style="color: var(--color-error-fg);">✕ {t('common.syntaxError')}: {slotErrors[slot.key]}{slotErrorLines[slot.key] ? ` (${t('common.line')} ${slotErrorLines[slot.key]})` : ''}</p>
{/if}
{/if}
{#if slotPreview[slot.key] && !slotErrors[slot.key]}
<details class="mt-1">
<summary class="text-xs text-[var(--color-muted-foreground)] cursor-pointer hover:underline">{t('templateConfig.preview')}</summary>
<div class="mt-1 p-2 bg-[var(--color-muted)] rounded text-sm">
<pre class="whitespace-pre-wrap">{slotPreview[slot.key]}</pre>
</div>
</details>
{#if slotPreview[slot.key]}
<div class="mt-1 p-2 bg-[var(--color-muted)] rounded text-sm">
<pre class="whitespace-pre-wrap">{slotPreview[slot.key]}</pre>
</div>
{/if}
{:else}
<input bind:value={(form as any)[slot.key]}

View File

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<rect width="32" height="32" rx="6" fill="#4f46e5"/>
<circle cx="16" cy="15" r="7" fill="none" stroke="white" stroke-width="2"/>
<circle cx="16" cy="15" r="3" fill="white"/>
<rect x="11" y="6" width="10" height="3" rx="1" fill="white" opacity="0.7"/>
<circle cx="25" cy="8" r="5" fill="#ef4444"/>
<circle cx="25" cy="8" r="3" fill="#ef4444" stroke="white" stroke-width="1.5"/>
</svg>

After

Width:  |  Height:  |  Size: 457 B

View File

@@ -67,7 +67,7 @@ _SAMPLE_CONTEXT = {
"removed_assets": ["asset-id-1", "asset-id-2"],
"people": ["Alice", "Bob"],
"shared": True,
"video_warning": "\n\n⚠️ Note: Videos may not be sent due to Telegram's 50 MB file size limit.",
"video_warning": "⚠️ Note: Videos may not be sent due to Telegram's 50 MB file size limit.",
# Rename fields (always present, empty for non-rename events)
"old_name": "Old Album",
"new_name": "New Album",

View File

@@ -136,7 +136,7 @@ class TemplateConfig(SQLModel, table=True):
# Settings
date_format: str = Field(default="%d.%m.%Y, %H:%M UTC")
video_warning: str = Field(
default="\n\n⚠️ Note: Videos may not be sent due to Telegram's 50 MB file size limit."
default="⚠️ Note: Videos may not be sent due to Telegram's 50 MB file size limit."
)
created_at: datetime = Field(default_factory=_utcnow)
@@ -204,7 +204,7 @@ _INLINE_TEMPLATES_REMOVED = {
'{%- if asset.is_favorite %} ❤️{% endif %}\n'
'{%- endfor %}'
'{%- endif %}'
'{{ video_warning }}'
'{%- if video_warning %}\n\n{{ video_warning }}{%- endif %}'
),
"message_assets_removed": '🗑️ {{ removed_count }} photo(s) removed from album "{{ album_name }}".',
@@ -254,7 +254,7 @@ DEFAULT_TEMPLATE_RU = {
'{%- if asset.is_favorite %} ❤️{% endif %}\n'
'{%- endfor %}'
'{%- endif %}'
'{{ video_warning }}'
'{%- if video_warning %}\n\n{{ video_warning }}{%- endif %}'
),
"message_assets_removed": '🗑️ {{ removed_count }} фото удалено из альбома "{{ album_name }}".',

View File

@@ -9,4 +9,7 @@
{%- if asset.is_favorite %} ❤️{% endif %}
{%- endfor %}
{%- endif %}
{%- if video_warning %}
{{ video_warning }}
{%- endif %}

View File

@@ -9,4 +9,7 @@
{%- if asset.is_favorite %} ❤️{% endif %}
{%- endfor %}
{%- endif %}
{%- if video_warning %}
{{ video_warning }}
{%- endif %}