+ );
+}
+
+// ── MAX Preview ───────────────────────────────────────────────────────────────
+
+function MaxPreview({ text, imageUrl, channelName }) {
+ const html = renderMarkdown(text, 'max');
+
+ return (
+
+ {/* Header */}
+
+
+ {(channelName || 'M').slice(0, 1).toUpperCase()}
+
+
+
{channelName || 'Канал MAX'}
+
только что
+
+
+
+ {/* Контент */}
+
+ {imageUrl && (
+
{ e.target.style.display = 'none'; }}
+ />
+ )}
+
Текст поста появится здесь…' }}
+ />
+
+
+ {/* Footer */}
+
+ 432
+ 18
+ Опрос
+
+
+ );
+}
+
+// ── Главный экспорт ───────────────────────────────────────────────────────────
+
+const PLATFORM_ORDER = ['telegram', 'vk', 'max'];
+const PLATFORM_LABELS = { telegram: 'TG', vk: 'VK', max: 'MAX' };
+
+export default function PostPreview({ text, imageUrl, platform: defaultPlatform = 'telegram', channelName }) {
+ const [visible, setVisible] = useState(true);
+ const [platform, setPlatform] = useState(defaultPlatform);
+
+ if (!visible) {
+ return (
+
setVisible(true)}
+ className="flex items-center gap-1.5 text-xs text-text-mute hover:text-text transition-colors"
+ >
+ Показать превью
+
+ );
+ }
+
+ return (
+
+ {/* Тулбар */}
+
+
Превью
+
+ {/* Переключатель платформы */}
+
+ {PLATFORM_ORDER.map(p => (
+ setPlatform(p)}
+ className={`px-2.5 py-1 font-medium transition-colors
+ ${platform === p
+ ? 'bg-accent text-white'
+ : 'bg-surface2 text-text-mute hover:text-text'
+ }`}
+ >
+ {PLATFORM_LABELS[p]}
+
+ ))}
+
+ {/* Скрыть */}
+
setVisible(false)}
+ className="btn-ghost p-1.5 rounded-lg"
+ title="Скрыть превью"
+ >
+
+
+
+
+
+ {/* Счётчик символов */}
+
+
+ {/* Превью платформы */}
+ {platform === 'telegram' && (
+
+ )}
+ {platform === 'vk' && (
+
+ )}
+ {platform === 'max' && (
+
+ )}
+
+ {/* Лимит */}
+
+ {LIMITS[platform].label}: текст до {LIMITS[platform].text.toLocaleString()} симв.
+ {', caption (с фото) до '}{LIMITS[platform].caption.toLocaleString()} симв.
+
+
+ );
+}