forked from admin/zeropost-tool
feat: P3 PostTemplates — 7 post structure presets in ChannelView
This commit is contained in:
+22
-10
@@ -8,6 +8,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import PhotoSearchModal from './PhotoSearchModal';
|
||||
import PostPreview from './PostPreview';
|
||||
import PostTemplates from './PostTemplates';
|
||||
|
||||
const GOAL_LABELS = {
|
||||
educational: 'Обучение', news: 'Новости',
|
||||
@@ -191,6 +192,14 @@ export default function ChannelView({ channel }) {
|
||||
setTopic('');
|
||||
}
|
||||
|
||||
function applyTemplate({ topicHint, structure }) {
|
||||
// Если тема не задана — подставляем подсказку
|
||||
if (!topic.trim()) setTopic(topicHint);
|
||||
// В textarea вставляем структуру как отправную точку
|
||||
setPost(structure);
|
||||
setSavedPostId(null);
|
||||
}
|
||||
|
||||
async function generate(asVariant = false) {
|
||||
if (!topic.trim() && !asVariant) return;
|
||||
if (asVariant && !post) return;
|
||||
@@ -328,14 +337,17 @@ export default function ChannelView({ channel }) {
|
||||
<Wand2 className="w-4 h-4 text-accent" />
|
||||
Сгенерировать пост
|
||||
</h2>
|
||||
<button
|
||||
onClick={fetchIdeas}
|
||||
disabled={loadingIdeas}
|
||||
className="text-xs inline-flex items-center gap-1 text-accent hover:underline disabled:opacity-50"
|
||||
>
|
||||
{loadingIdeas ? <Loader2 className="w-3.5 h-3.5 animate-spin" /> : <Sparkles className="w-3.5 h-3.5" />}
|
||||
Идеи тем
|
||||
</button>
|
||||
<div className="flex items-center gap-3">
|
||||
<PostTemplates onSelect={applyTemplate} disabled={generating} />
|
||||
<button
|
||||
onClick={fetchIdeas}
|
||||
disabled={loadingIdeas}
|
||||
className="text-xs inline-flex items-center gap-1 text-accent hover:underline disabled:opacity-50"
|
||||
>
|
||||
{loadingIdeas ? <Loader2 className="w-3.5 h-3.5 animate-spin" /> : <Sparkles className="w-3.5 h-3.5" />}
|
||||
Идеи тем
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{showIdeas && ideas.length > 0 && (
|
||||
@@ -588,7 +600,7 @@ export default function ChannelView({ channel }) {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>{/* конец левой колонки */}
|
||||
</div>
|
||||
{/* Правая колонка — превью */}
|
||||
<div className="card p-4 sticky top-20">
|
||||
<PostPreview
|
||||
@@ -598,7 +610,7 @@ export default function ChannelView({ channel }) {
|
||||
channelName={channel.name}
|
||||
/>
|
||||
</div>
|
||||
</div>{/* конец грида */}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Photo search modal */}
|
||||
|
||||
Reference in New Issue
Block a user