fix(studio): theme picker confirms applied + surfaces load failures
Some checks failed
Security / Security check (push) Failing after 2s

Two operator-visible fixes prompted by 'I picked a theme but
nothing changed':

  - Theme picker tile taps now show a brief "Theme applied:
    <name>" snackbar — the picker applies themes instantly, so
    the operator needs a confirming cue. Slow `_pluginThemes`
    loads no longer read as "click did nothing".
  - `_pluginThemes` failures (plugin unreachable, manifest
    drift, etc.) write to `FaiLog` so `fai admin doctor` and
    Studio's inline log viewer can surface them. Previously
    swallowed silently, which is what made debugging this so
    miserable.
  - Settings dialog's primary button relabelled to
    "Connect to endpoint" (was "Save & connect") so operators
    don't mistake it for "save my theme choice". The theme
    selection persists at tile-tap time; the Settings dialog
    has nothing left to "save".
  - Theme section header gains an explicit "(applies instantly)"
    cue for the same reason.

Also fixes a pre-existing curly-braces lint in the n8n add-
endpoint dialog. Studio bumped to 0.62.1, editor pinned via
path override at 0.15.1.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-06-04 02:25:11 +02:00
parent 8f5cd2528b
commit 805f1b4c1f
9 changed files with 91 additions and 17 deletions

View file

@ -1472,8 +1472,9 @@ class _AddN8nEndpointDialogState extends State<_AddN8nEndpointDialog> {
),
FilledButton(
onPressed: () {
if (_name.text.trim().isEmpty || _baseUrl.text.trim().isEmpty)
if (_name.text.trim().isEmpty || _baseUrl.text.trim().isEmpty) {
return;
}
Navigator.pop(
context,
N8nEndpointDraft(

View file

@ -109,11 +109,29 @@ class _ThemePickerGridState extends State<ThemePickerGrid> {
selected: active == null,
onTap: () {
StudioApp.of(context)?.setThemePlugin(null);
_confirmApplied(l, l.themePluginNone);
setState(() {});
},
);
}
/// Brief snackbar acknowledging the theme switch. The picker
/// applies themes instantly (no Save), so the operator needs
/// a visible cue that the click was registered without it,
/// a slow theme load looks like "the click did nothing".
void _confirmApplied(AppLocalizations l, String displayName) {
final messenger = ScaffoldMessenger.maybeOf(context);
if (messenger == null) return;
messenger.removeCurrentSnackBar();
messenger.showSnackBar(
SnackBar(
content: Text(l.themeApplied(displayName)),
duration: const Duration(seconds: 2),
behavior: SnackBarBehavior.floating,
),
);
}
Widget _pluginTile(ThemeData theme, String cap, String? active) {
// Pretty name: studio.theme.sunflower "Sunflower".
final display = _displayName(cap);
@ -138,6 +156,7 @@ class _ThemePickerGridState extends State<ThemePickerGrid> {
loading: preview == null,
onTap: () {
StudioApp.of(context)?.setThemePlugin(cap);
_confirmApplied(AppLocalizations.of(context)!, display);
setState(() {});
},
);
@ -176,6 +195,7 @@ class _ThemePickerGridState extends State<ThemePickerGrid> {
// Strip alpha component we only persist the RGB.
final rgb = hex.substring(2).toUpperCase();
StudioApp.of(context)?.setThemePlugin('custom:#$rgb');
_confirmApplied(l, '#$rgb');
setState(() {});
},
);