Add first layer complete notification with camera snapshot (#679)

Notify users when the first layer finishes printing so they can check
  adhesion remotely. Triggers once per print when layer 2 begins
  (layer_num >= 2, capped at <= 5 to handle reconnects). Includes a
  camera snapshot attachment. Adds the on_first_layer_complete toggle
  to all notification providers, with backend/frontend/i18n support
  across all 7 locales.
This commit is contained in:
maziggy
2026-03-13 10:53:21 +01:00
parent 685d04df67
commit 0b6facc91c
26 changed files with 426 additions and 71 deletions
@@ -41,6 +41,7 @@ export function AddNotificationModal({ provider, onClose }: AddNotificationModal
const [onFilamentLow, setOnFilamentLow] = useState(provider?.on_filament_low ?? false);
const [onMaintenanceDue, setOnMaintenanceDue] = useState(provider?.on_maintenance_due ?? false);
const [onBedCooled, setOnBedCooled] = useState(provider?.on_bed_cooled ?? false);
const [onFirstLayerComplete, setOnFirstLayerComplete] = useState(provider?.on_first_layer_complete ?? false);
// Provider-specific config
const [config, setConfig] = useState<Record<string, string>>(
@@ -141,6 +142,7 @@ export function AddNotificationModal({ provider, onClose }: AddNotificationModal
on_filament_low: onFilamentLow,
on_maintenance_due: onMaintenanceDue,
on_bed_cooled: onBedCooled,
on_first_layer_complete: onFirstLayerComplete,
};
if (isEditing) {
@@ -491,6 +493,13 @@ export function AddNotificationModal({ provider, onClose }: AddNotificationModal
</div>
<Toggle checked={onBedCooled} onChange={setOnBedCooled} />
</div>
<div className="flex items-center justify-between col-span-2">
<div>
<span className="text-sm text-white">{t('notifications.firstLayerCompleteLabel')}</span>
<span className="text-xs text-bambu-gray ml-1">{t('notifications.firstLayerCompleteDescription')}</span>
</div>
<Toggle checked={onFirstLayerComplete} onChange={setOnFirstLayerComplete} />
</div>
</div>
</div>