feat(studio): a full page says so instead of swallowing the click

This commit is contained in:
Maurice
2026-10-24 09:19:17 +02:00
parent 1050029842
commit e2c00ba18b
34 changed files with 202 additions and 4 deletions
@@ -0,0 +1,24 @@
import { MAX_SPREAD_ELEMENTS } from '@trek/shared';
import { useEffect, useRef } from 'react';
import { useTranslation } from '../../i18n';
import { useStudioStore } from '../../store/studioStore';
import { useToast } from '../shared/Toast';
/**
* What the Studio says about a click it could not carry out. Today one thing:
* the page already holds as many elements as a page can, so a sticker, a frame,
* a paste or a duplicate was not added. Every path that refuses counts it in the
* store, and this says it once per count rather than each path in its own words.
*/
export function StudioNotices() {
const { t } = useTranslation();
const toast = useToast();
const refused = useStudioStore((s) => s.refusedFull);
const seen = useRef(refused);
useEffect(() => {
if (refused === seen.current) return;
seen.current = refused;
toast.warning(t('journey.studio.pageFull', { max: MAX_SPREAD_ELEMENTS }));
}, [refused, toast, t]);
return null;
}