feat: contact page improvements, Yandex map from addresses
- Instagram field: @username input with API validation (like team page) - Phone validation: blocks auto-save when incomplete, shows warning - SectionEditor: validate prop to conditionally block saves - Yandex Map: auto-generated from addresses via Nominatim geocoding, dark theme, no API key needed - Schedule: address hint linking to Contacts - Renamed "Всплывающие окна" → "Формы записи", moved after Записи
This commit is contained in:
@@ -8,6 +8,8 @@ interface SectionEditorProps<T> {
|
||||
sectionKey: string;
|
||||
title: string;
|
||||
defaultData?: Partial<T>;
|
||||
/** Return true if data is valid and can be saved. Blocks auto-save when false. */
|
||||
validate?: (data: T) => boolean;
|
||||
children: (data: T, update: (data: T) => void) => React.ReactNode;
|
||||
}
|
||||
|
||||
@@ -17,6 +19,7 @@ export function SectionEditor<T>({
|
||||
sectionKey,
|
||||
title,
|
||||
defaultData,
|
||||
validate,
|
||||
children,
|
||||
}: SectionEditorProps<T>) {
|
||||
const [data, setData] = useState<T | null>(null);
|
||||
@@ -67,6 +70,7 @@ export function SectionEditor<T>({
|
||||
|
||||
if (timerRef.current) clearTimeout(timerRef.current);
|
||||
timerRef.current = setTimeout(() => {
|
||||
if (validate && !validate(data)) return;
|
||||
save(data);
|
||||
}, DEBOUNCE_MS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user