feat: Implement content planning and post management with a new service and calendar view.
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useIdeaStore } from '../stores/ideas'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { dataService } from '../services/dataService' // Added import
|
||||
import Skeleton from 'primevue/skeleton'
|
||||
import Dialog from 'primevue/dialog'
|
||||
import InputText from 'primevue/inputtext'
|
||||
import Textarea from 'primevue/textarea'
|
||||
import Button from 'primevue/button'
|
||||
import Image from 'primevue/image'
|
||||
import Dropdown from 'primevue/dropdown'
|
||||
import Checkbox from 'primevue/checkbox'
|
||||
|
||||
const router = useRouter()
|
||||
const ideaStore = useIdeaStore()
|
||||
@@ -19,10 +22,103 @@ const newIdea = ref({ name: '', description: '' })
|
||||
const submitting = ref(false)
|
||||
const API_URL = import.meta.env.VITE_API_URL
|
||||
|
||||
// --- Generation Settings ---
|
||||
const prompt = ref('')
|
||||
const selectedModel = ref('flux-schnell')
|
||||
const quality = ref({ key: 'TWOK', value: '2K' })
|
||||
const aspectRatio = ref({ key: 'NINESIXTEEN', value: '9:16' })
|
||||
const imageCount = ref(1)
|
||||
const sendToTelegram = ref(false)
|
||||
const telegramId = ref('')
|
||||
const useProfileImage = ref(true)
|
||||
const isSubmittingGen = ref(false)
|
||||
|
||||
// Character & Assets
|
||||
const characters = ref([])
|
||||
const selectedCharacter = ref(null)
|
||||
const selectedAssets = ref([])
|
||||
let _savedCharacterId = null
|
||||
|
||||
const qualityOptions = ref([
|
||||
{ key: 'ONEK', value: '1K' },
|
||||
{ key: 'TWOK', value: '2K' },
|
||||
{ key: 'FOURK', value: '4K' }
|
||||
])
|
||||
const aspectRatioOptions = ref([
|
||||
{ key: "NINESIXTEEN", value: "9:16" },
|
||||
{ key: "FOURTHREE", value: "4:3" },
|
||||
{ key: "THREEFOUR", value: "3:4" },
|
||||
{ key: "SIXTEENNINE", value: "16:9" }
|
||||
])
|
||||
|
||||
// Restore settings
|
||||
const SETTINGS_KEY = 'idea-gen-settings'
|
||||
const restoreSettings = () => {
|
||||
const stored = localStorage.getItem(SETTINGS_KEY)
|
||||
if (!stored) return
|
||||
try {
|
||||
const s = JSON.parse(stored)
|
||||
if (s.prompt) prompt.value = s.prompt
|
||||
if (s.quality) quality.value = s.quality
|
||||
if (s.aspectRatio) aspectRatio.value = s.aspectRatio
|
||||
if (s.imageCount) imageCount.value = Math.min(s.imageCount, 4)
|
||||
if (s.selectedModel) selectedModel.value = s.selectedModel
|
||||
sendToTelegram.value = s.sendToTelegram || false
|
||||
telegramId.value = s.telegramId || localStorage.getItem('telegram_id') || ''
|
||||
if (s.useProfileImage !== undefined) useProfileImage.value = s.useProfileImage
|
||||
_savedCharacterId = s.selectedCharacterId || null
|
||||
if (s.selectedAssetIds && s.selectedAssetIds.length > 0) {
|
||||
selectedAssets.value = s.selectedAssetIds.map(id => ({
|
||||
id,
|
||||
url: `/assets/${id}`,
|
||||
name: 'Asset ' + id.substring(0, 4)
|
||||
}))
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to restore settings', e)
|
||||
}
|
||||
}
|
||||
|
||||
const saveSettings = () => {
|
||||
const settings = {
|
||||
prompt: prompt.value,
|
||||
quality: quality.value,
|
||||
aspectRatio: aspectRatio.value,
|
||||
imageCount: imageCount.value,
|
||||
selectedModel: selectedModel.value,
|
||||
sendToTelegram: sendToTelegram.value,
|
||||
telegramId: telegramId.value,
|
||||
useProfileImage: useProfileImage.value,
|
||||
selectedCharacterId: selectedCharacter.value?.id || null,
|
||||
selectedAssetIds: selectedAssets.value.map(a => a.id),
|
||||
}
|
||||
localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings))
|
||||
if (telegramId.value) localStorage.setItem('telegram_id', telegramId.value)
|
||||
}
|
||||
|
||||
watch([prompt, quality, aspectRatio, imageCount, selectedModel, sendToTelegram, telegramId, useProfileImage, selectedCharacter, selectedAssets], saveSettings, { deep: true })
|
||||
|
||||
onMounted(async () => {
|
||||
await ideaStore.fetchIdeas()
|
||||
restoreSettings()
|
||||
await Promise.all([
|
||||
ideaStore.fetchIdeas(),
|
||||
loadCharacters()
|
||||
])
|
||||
})
|
||||
|
||||
const loadCharacters = async () => {
|
||||
try {
|
||||
characters.value = await dataService.getCharacters()
|
||||
if (_savedCharacterId && characters.value.length > 0) {
|
||||
const found = characters.value.find(c => c.id === _savedCharacterId)
|
||||
if (found) selectedCharacter.value = found
|
||||
_savedCharacterId = null
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load characters', e)
|
||||
}
|
||||
}
|
||||
|
||||
const goToDetail = (id) => {
|
||||
router.push(`/ideas/${id}`) // Navigate to IdeaDetailView
|
||||
}
|
||||
@@ -38,120 +134,391 @@ const createIdea = async () => {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-generation flow
|
||||
const handleGenerate = async () => {
|
||||
if (!prompt.value) return
|
||||
|
||||
isSubmittingGen.value = true
|
||||
try {
|
||||
// 1. Create a random name idea
|
||||
const randomName = 'Session ' + new Date().toLocaleString()
|
||||
const newIdea = await ideaStore.createIdea({
|
||||
name: randomName,
|
||||
description: 'Auto-generated from quick start'
|
||||
})
|
||||
|
||||
// 2. Save settings (already handled by watch, but ensure latest)
|
||||
saveSettings()
|
||||
|
||||
// 3. Navigate with autostart param
|
||||
router.push({ path: `/ideas/${newIdea.id}`, query: { autostart: 'true' } })
|
||||
|
||||
} catch (e) {
|
||||
console.error('Failed to start session', e)
|
||||
} finally {
|
||||
isSubmittingGen.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// --- Asset Picker Logic ---
|
||||
const isAssetPickerVisible = ref(false)
|
||||
const assetPickerTab = ref('all') // 'all', 'uploaded', 'generated'
|
||||
const modalAssets = ref([])
|
||||
const isModalLoading = ref(false)
|
||||
const tempSelectedAssets = ref([])
|
||||
const assetPickerFileInput = ref(null)
|
||||
|
||||
const loadModalAssets = async () => {
|
||||
isModalLoading.value = true
|
||||
try {
|
||||
const typeParam = assetPickerTab.value === 'all' ? undefined : assetPickerTab.value
|
||||
const response = await dataService.getAssets(100, 0, typeParam)
|
||||
if (response && response.assets) {
|
||||
modalAssets.value = response.assets
|
||||
} else {
|
||||
modalAssets.value = Array.isArray(response) ? response : []
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load modal assets', e)
|
||||
modalAssets.value = []
|
||||
} finally {
|
||||
isModalLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const openAssetPicker = () => {
|
||||
tempSelectedAssets.value = [...selectedAssets.value]
|
||||
isAssetPickerVisible.value = true
|
||||
loadModalAssets()
|
||||
}
|
||||
|
||||
const toggleAssetSelection = (asset) => {
|
||||
const index = tempSelectedAssets.value.findIndex(a => a.id === asset.id)
|
||||
if (index === -1) {
|
||||
tempSelectedAssets.value.push(asset)
|
||||
} else {
|
||||
tempSelectedAssets.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
const confirmAssetSelection = () => {
|
||||
selectedAssets.value = [...tempSelectedAssets.value]
|
||||
isAssetPickerVisible.value = false
|
||||
}
|
||||
|
||||
const removeAsset = (asset) => {
|
||||
selectedAssets.value = selectedAssets.value.filter(a => a.id !== asset.id)
|
||||
}
|
||||
|
||||
watch(assetPickerTab, () => {
|
||||
if (isAssetPickerVisible.value) {
|
||||
loadModalAssets()
|
||||
}
|
||||
})
|
||||
|
||||
const triggerAssetPickerUpload = () => {
|
||||
assetPickerFileInput.value?.click()
|
||||
}
|
||||
|
||||
const handleAssetPickerUpload = async (event) => {
|
||||
const target = event.target
|
||||
if (target.files && target.files[0]) {
|
||||
const file = target.files[0]
|
||||
try {
|
||||
isModalLoading.value = true
|
||||
await dataService.uploadAsset(file)
|
||||
assetPickerTab.value = 'uploaded'
|
||||
loadModalAssets()
|
||||
} catch (e) {
|
||||
console.error('Failed to upload asset', e)
|
||||
} finally {
|
||||
isModalLoading.value = false
|
||||
target.value = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col h-full p-8 overflow-y-auto text-slate-100 font-sans">
|
||||
<!-- Top Bar -->
|
||||
<header class="flex justify-between items-end mb-8 border-b border-white/5 pb-6">
|
||||
<div>
|
||||
<h1
|
||||
class="text-4xl font-bold m-0 bg-gradient-to-r from-violet-400 to-fuchsia-400 bg-clip-text text-transparent">
|
||||
Ideas</h1>
|
||||
<p class="mt-2 mb-0 text-slate-400">Your creative sessions and experiments</p>
|
||||
</div>
|
||||
<Button label="New Idea" icon="pi pi-plus" @click="showCreateDialog = true"
|
||||
class="!bg-violet-600 hover:!bg-violet-500 !border-none" />
|
||||
</header>
|
||||
<div class="flex flex-col h-full font-sans relative">
|
||||
<!-- Content Area (Scrollable) -->
|
||||
<div class="flex-1 overflow-y-auto p-8 pb-48 custom-scrollbar">
|
||||
<!-- Top Bar -->
|
||||
<header class="flex justify-between items-end mb-8 border-b border-white/5 pb-6">
|
||||
<div>
|
||||
<h1
|
||||
class="text-4xl font-bold m-0 bg-gradient-to-r from-violet-400 to-fuchsia-400 bg-clip-text text-transparent">
|
||||
Ideas</h1>
|
||||
<p class="mt-2 mb-0 text-slate-400">Your creative sessions and experiments</p>
|
||||
</div>
|
||||
<!-- REMOVED NEW IDEA BUTTON -->
|
||||
</header>
|
||||
|
||||
<!-- Loading State -->
|
||||
<div v-if="loading && ideas.length === 0" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div v-for="i in 6" :key="i" class="glass-panel rounded-2xl p-6 flex flex-col gap-4">
|
||||
<Skeleton height="12rem" class="w-full rounded-xl" />
|
||||
<Skeleton width="60%" height="1.5rem" />
|
||||
<Skeleton width="40%" height="1rem" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Empty State -->
|
||||
<div v-else-if="ideas.length === 0"
|
||||
class="flex flex-col items-center justify-center h-96 text-slate-400 bg-slate-900/30 rounded-3xl border border-dashed border-white/10">
|
||||
<div class="w-20 h-20 rounded-full bg-violet-500/10 flex items-center justify-center mb-6">
|
||||
<i class="pi pi-lightbulb text-4xl text-violet-400"></i>
|
||||
</div>
|
||||
<h3 class="text-xl font-semibold text-white mb-2">No ideas yet</h3>
|
||||
<p class="text-slate-400 mb-6 max-w-sm text-center">Start a new creative session to organize your
|
||||
generations and prompts.</p>
|
||||
<Button label="Create your first idea" icon="pi pi-plus" @click="showCreateDialog = true" />
|
||||
</div>
|
||||
|
||||
<!-- Ideas Grid -->
|
||||
<div v-else class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div v-for="idea in ideas" :key="idea.id"
|
||||
class="glass-panel rounded-2xl p-0 flex flex-col gap-0 transition-all duration-300 cursor-pointer border border-white/5 hover:-translate-y-1 hover:bg-slate-800/80 hover:border-violet-500/30 group overflow-hidden"
|
||||
@click="goToDetail(idea.id)">
|
||||
|
||||
<!-- Cover Image -->
|
||||
<div class="aspect-video w-full bg-slate-800 relative overflow-hidden">
|
||||
<div v-if="idea.last_generation && idea.last_generation.status == 'done' && idea.last_generation.result_list.length > 0" class="w-full h-full">
|
||||
<img :src="API_URL + '/assets/' + idea.last_generation.result_list[0] + '?thumbnail=true'"
|
||||
class="w-full h-full object-cover transition-transform duration-700 group-hover:scale-105" />
|
||||
</div>
|
||||
<div v-else
|
||||
class="w-full h-full flex items-center justify-center bg-gradient-to-br from-slate-800 to-slate-900 group-hover:from-violet-900/20 group-hover:to-slate-900 transition-colors">
|
||||
<i
|
||||
class="pi pi-lightbulb text-4xl text-slate-700 group-hover:text-violet-500/50 transition-colors"></i>
|
||||
</div>
|
||||
|
||||
<!-- Overlay Gradient -->
|
||||
<div
|
||||
class="absolute inset-0 bg-gradient-to-t from-slate-900 via-transparent to-transparent opacity-60">
|
||||
</div>
|
||||
|
||||
<!-- Count Badge -->
|
||||
<div
|
||||
class="absolute top-3 right-3 bg-black/40 backdrop-blur-md text-white text-xs font-bold px-2 py-1 rounded-lg border border-white/10 flex items-center gap-1">
|
||||
<i class="pi pi-images text-[10px]"></i>
|
||||
<span>{{ idea.generation_ids?.length || 0 }}</span>
|
||||
<!-- Loading State -->
|
||||
<div v-if="loading && ideas.length === 0" class="flex flex-col gap-4">
|
||||
<div v-for="i in 6" :key="i" class="glass-panel rounded-2xl p-4 flex gap-4 items-center">
|
||||
<Skeleton width="4rem" height="4rem" class="rounded-lg" />
|
||||
<div class="flex-1">
|
||||
<Skeleton width="40%" height="1.5rem" class="mb-2" />
|
||||
<Skeleton width="60%" height="1rem" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-5">
|
||||
<h3
|
||||
class="m-0 mb-2 text-xl font-bold truncate text-slate-100 group-hover:text-violet-300 transition-colors">
|
||||
{{ idea.name }}</h3>
|
||||
<p class="m-0 text-sm text-slate-400 line-clamp-2 min-h-[2.5em] leading-relaxed">
|
||||
{{ idea.description || 'No description provided.' }}
|
||||
</p>
|
||||
<!-- Empty State -->
|
||||
<div v-else-if="ideas.length === 0"
|
||||
class="flex flex-col items-center justify-center h-96 text-slate-400 bg-slate-900/30 rounded-3xl border border-dashed border-white/10">
|
||||
<div class="w-20 h-20 rounded-full bg-violet-500/10 flex items-center justify-center mb-6">
|
||||
<i class="pi pi-lightbulb text-4xl text-violet-400"></i>
|
||||
</div>
|
||||
<h3 class="text-xl font-semibold text-white mb-2">No ideas yet</h3>
|
||||
<p class="text-slate-400 mb-6 max-w-sm text-center">Use the panel below to start a new creative session.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 pt-4 border-t border-white/5 flex justify-between items-center">
|
||||
<span class="text-xs text-slate-500 font-mono">ID: {{ idea.id.substring(0, 8) }}...</span>
|
||||
<div
|
||||
class="text-xs text-violet-400 font-medium opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1">
|
||||
Open Session <i class="pi pi-arrow-right text-[10px]"></i>
|
||||
<!-- Ideas List (Vertical) -->
|
||||
<div v-else class="flex flex-col gap-3">
|
||||
<div v-for="idea in ideas" :key="idea.id"
|
||||
class="glass-panel rounded-xl p-3 flex gap-4 items-center cursor-pointer border border-white/5 hover:bg-slate-800/80 hover:border-violet-500/30 group transition-all"
|
||||
@click="goToDetail(idea.id)">
|
||||
|
||||
<!-- Thumbnail -->
|
||||
<div
|
||||
class="w-16 h-16 rounded-lg bg-slate-800 flex-shrink-0 overflow-hidden relative border border-white/10">
|
||||
<img v-if="idea.last_generation && idea.last_generation.status == 'done' && idea.last_generation.result_list.length > 0"
|
||||
:src="API_URL + '/assets/' + idea.last_generation.result_list[0] + '?thumbnail=true'"
|
||||
class="w-full h-full object-cover" />
|
||||
<div v-else class="w-full h-full flex items-center justify-center bg-slate-800 text-slate-600">
|
||||
<i class="pi pi-image text-xl"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Details -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<h3
|
||||
class="m-0 text-lg font-bold text-slate-200 group-hover:text-violet-300 transition-colors truncate">
|
||||
{{ idea.name }}</h3>
|
||||
<p class="m-0 text-sm text-slate-500 truncate">{{ idea.description || 'No description' }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Meta -->
|
||||
<div class="flex items-center gap-4 text-xs text-slate-500">
|
||||
<div class="flex items-center gap-1 bg-slate-900/50 px-2 py-1 rounded-md">
|
||||
<i class="pi pi-images text-[10px]"></i>
|
||||
<span>{{ idea.generation_ids?.length || 0 }}</span>
|
||||
</div>
|
||||
<i class="pi pi-chevron-right text-slate-600 group-hover:text-white transition-colors"></i>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Create Idea Dialog (Removed) -->
|
||||
|
||||
|
||||
<!-- SETTINGS PANEL (Bottom - Persistent) -->
|
||||
<div
|
||||
class="absolute bottom-4 left-1/2 -translate-x-1/2 w-[95%] max-w-4xl glass-panel border border-white/10 bg-slate-900/95 backdrop-blur-xl px-4 py-3 z-[60] !rounded-[2rem] shadow-2xl flex flex-col gap-1 max-h-[60vh] overflow-y-auto">
|
||||
|
||||
<div class="flex flex-col lg:flex-row gap-3">
|
||||
<!-- LEFT COLUMN: Prompt + Character + Assets -->
|
||||
<div class="flex-1 flex flex-col gap-2">
|
||||
<!-- Prompt -->
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex justify-between items-center">
|
||||
<label class="text-[10px] font-bold text-slate-400 uppercase tracking-wider">Prompt</label>
|
||||
<!-- Optional: Add Clear/Improve buttons here if desired, keeping simple for now to match layout -->
|
||||
</div>
|
||||
<Textarea v-model="prompt" rows="2" autoResize
|
||||
placeholder="Describe what you want to create... (Auto-starts new session)"
|
||||
class="w-full bg-slate-800 !text-sm border-white/10 text-white rounded-lg p-2 focus:border-violet-500 focus:ring-1 focus:ring-violet-500/50 transition-all resize-none shadow-inner" />
|
||||
</div>
|
||||
|
||||
<!-- Character & Assets Row -->
|
||||
<div class="flex flex-col md:flex-row gap-2">
|
||||
<div class="flex-1 flex flex-col gap-1">
|
||||
<label
|
||||
class="text-[10px] font-bold text-slate-400 uppercase tracking-wider">Character</label>
|
||||
<Dropdown v-model="selectedCharacter" :options="characters" optionLabel="name"
|
||||
placeholder="Select Character" filter showClear
|
||||
class="w-full !bg-slate-800 !border-white/10 !text-white !rounded-xl" :pt="{
|
||||
root: { class: '!bg-slate-800' },
|
||||
input: { class: '!text-white' },
|
||||
trigger: { class: '!text-slate-400' },
|
||||
panel: { class: '!bg-slate-800 !border-white/10' },
|
||||
item: { class: '!text-slate-300 hover:!bg-white/10 hover:!text-white' }
|
||||
}">
|
||||
<template #value="slotProps">
|
||||
<div v-if="slotProps.value" class="flex items-center gap-2">
|
||||
<img v-if="slotProps.value.avatar_image"
|
||||
:src="API_URL + slotProps.value.avatar_image"
|
||||
class="w-6 h-6 rounded-full object-cover" />
|
||||
<span>{{ slotProps.value.name }}</span>
|
||||
</div>
|
||||
<span v-else>{{ slotProps.placeholder }}</span>
|
||||
</template>
|
||||
<template #option="slotProps">
|
||||
<div class="flex items-center gap-2">
|
||||
<img v-if="slotProps.option.avatar_image"
|
||||
:src="API_URL + slotProps.option.avatar_image"
|
||||
class="w-8 h-8 rounded-full object-cover" />
|
||||
<span>{{ slotProps.option.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</Dropdown>
|
||||
|
||||
<div v-if="selectedCharacter"
|
||||
class="flex items-center gap-2 mt-2 px-1 animate-in fade-in slide-in-from-top-1">
|
||||
<Checkbox v-model="useProfileImage" :binary="true" inputId="idea-use-profile-img"
|
||||
class="!border-white/20" :pt="{
|
||||
box: ({ props, state }) => ({
|
||||
class: ['!bg-slate-800 !border-white/20', { '!bg-violet-600 !border-violet-600': props.modelValue }]
|
||||
})
|
||||
}" />
|
||||
<label for="idea-use-profile-img"
|
||||
class="text-xs text-slate-300 cursor-pointer select-none">Use
|
||||
Character
|
||||
Photo</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 flex flex-col gap-1">
|
||||
<label class="text-[10px] font-bold text-slate-400 uppercase tracking-wider">Assets</label>
|
||||
<div @click="openAssetPicker"
|
||||
class="w-full bg-slate-800 border border-white/10 rounded-lg p-2 min-h-[38px] cursor-pointer hover:bg-slate-700/50 transition-colors flex flex-wrap gap-1.5">
|
||||
<span v-if="selectedAssets.length === 0" class="text-slate-400 text-sm py-0.5">Select
|
||||
Assets</span>
|
||||
<div v-for="asset in selectedAssets" :key="asset.id"
|
||||
class="px-2 py-1 bg-violet-600/30 border border-violet-500/30 text-violet-200 text-xs rounded-md flex items-center gap-2 animate-in fade-in zoom-in duration-200"
|
||||
@click.stop>
|
||||
<img v-if="asset.url" :src="API_URL + asset.url + '?thumbnail=true'"
|
||||
class="w-4 h-4 rounded object-cover" />
|
||||
<span class="truncate max-w-[100px]">{{ asset.name || 'Asset ' + (asset.id ?
|
||||
asset.id.substring(0, 4) : '') }}</span>
|
||||
<i class="pi pi-times cursor-pointer hover:text-white"
|
||||
@click.stop="removeAsset(asset)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RIGHT COLUMN: Settings & Button -->
|
||||
<div class="w-full lg:w-72 flex flex-col gap-2">
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label class="text-[10px] font-bold text-slate-400 uppercase tracking-wider">Quality</label>
|
||||
<Dropdown v-model="quality" :options="qualityOptions" optionLabel="value"
|
||||
class="w-full !bg-slate-800 !border-white/10 !text-white !rounded-xl"
|
||||
:pt="{ input: { class: '!text-white' }, trigger: { class: '!text-slate-400' }, panel: { class: '!bg-slate-800 !border-white/10' }, item: { class: '!text-slate-300 hover:!bg-white/10 hover:!text-white' } }" />
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<label class="text-[10px] font-bold text-slate-400 uppercase tracking-wider">Ratio</label>
|
||||
<Dropdown v-model="aspectRatio" :options="aspectRatioOptions" optionLabel="value"
|
||||
class="w-full !bg-slate-800 !border-white/10 !text-white !rounded-xl"
|
||||
:pt="{ input: { class: '!text-white' }, trigger: { class: '!text-slate-400' }, panel: { class: '!bg-slate-800 !border-white/10' }, item: { class: '!text-slate-300 hover:!bg-white/10 hover:!text-white' } }" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Generation Count -->
|
||||
<div class="flex flex-col gap-1">
|
||||
<label class="text-[10px] font-bold text-slate-400 uppercase tracking-wider">Count</label>
|
||||
<div class="flex items-center">
|
||||
<div class="flex-1 flex bg-slate-800 rounded-lg border border-white/10 overflow-hidden">
|
||||
<button v-for="n in 4" :key="n" @click="imageCount = n"
|
||||
class="flex-1 py-1 text-xs font-bold transition-all"
|
||||
:class="imageCount === n ? 'bg-violet-600 text-white' : 'text-slate-400 hover:text-white hover:bg-white/5'">
|
||||
{{ n }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Telegram (Copied from Detail View) -->
|
||||
<div class="flex flex-col gap-1 bg-slate-800/50 p-2 rounded-lg border border-white/5">
|
||||
<div class="flex items-center gap-2">
|
||||
<Checkbox v-model="sendToTelegram" :binary="true" inputId="idea-tg-check" />
|
||||
<label for="idea-tg-check" class="text-xs text-slate-300 cursor-pointer">Send to
|
||||
Telegram</label>
|
||||
</div>
|
||||
<div v-if="sendToTelegram" class="animate-in fade-in slide-in-from-top-1">
|
||||
<InputText v-model="telegramId" placeholder="Telegram ID"
|
||||
class="w-full !text-xs !bg-slate-900 !border-white/10 !text-white !py-1.5" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-auto">
|
||||
<Button :label="isSubmittingGen ? 'Starting...' : 'Generate New Session'"
|
||||
:icon="isSubmittingGen ? 'pi pi-spin pi-spinner' : 'pi pi-sparkles'"
|
||||
:loading="isSubmittingGen" :disabled="isSubmittingGen || !prompt" @click="handleGenerate"
|
||||
class="w-full !py-2 !text-sm !font-bold !bg-gradient-to-r from-violet-600 to-cyan-500 !border-none !rounded-lg !shadow-lg !shadow-violet-500/20 hover:!scale-[1.02] transition-all disabled:opacity-50 disabled:cursor-not-allowed" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Create Idea Dialog -->
|
||||
<Dialog v-model:visible="showCreateDialog" modal header="New Idea Session" :style="{ width: '500px' }"
|
||||
:breakpoints="{ '960px': '75vw', '641px': '90vw' }"
|
||||
:pt="{ root: { class: '!bg-slate-900 !border !border-white/10' }, header: { class: '!bg-slate-900 !border-b !border-white/5 !text-white' }, content: { class: '!bg-slate-900 !p-6' }, footer: { class: '!bg-slate-900 !border-t !border-white/5 !p-4' }, closeButton: { class: '!text-slate-400 hover:!text-white' } }">
|
||||
<div class="flex flex-col gap-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="name" class="font-semibold text-slate-300">Session Name</label>
|
||||
<InputText id="name" v-model="newIdea.name"
|
||||
class="w-full !bg-slate-800 !border-white/10 !text-white focus:!border-violet-500"
|
||||
placeholder="e.g., Cyberpunk Character Study" autofocus />
|
||||
<Dialog v-model:visible="isAssetPickerVisible" modal header="Select Assets"
|
||||
:style="{ width: '80vw', maxWidth: '900px' }"
|
||||
:pt="{ root: { class: '!bg-slate-900 !border !border-white/10' }, header: { class: '!bg-slate-900 !border-b !border-white/5 !text-white' }, content: { class: '!bg-slate-900 !p-0' }, footer: { class: '!bg-slate-900 !border-t !border-white/5 !p-4' }, closeButton: { class: '!text-slate-400 hover:!text-white' } }">
|
||||
<div class="flex flex-col h-[70vh]">
|
||||
<!-- Tabs -->
|
||||
<div class="flex border-b border-white/5 px-4 items-center">
|
||||
<button v-for="tab in ['all', 'uploaded', 'generated']" :key="tab" @click="assetPickerTab = tab"
|
||||
class="px-4 py-3 text-sm font-medium border-b-2 transition-colors capitalize"
|
||||
:class="assetPickerTab === tab ? 'border-violet-500 text-violet-400' : 'border-transparent text-slate-400 hover:text-slate-200'">
|
||||
{{ tab }}
|
||||
</button>
|
||||
<!-- Upload Action -->
|
||||
<div class="ml-auto flex items-center">
|
||||
<input type="file" ref="assetPickerFileInput" @change="handleAssetPickerUpload" class="hidden"
|
||||
accept="image/*" />
|
||||
<Button icon="pi pi-upload" label="Upload" @click="triggerAssetPickerUpload"
|
||||
class="!text-xs !bg-violet-600/20 !text-violet-300 hover:!bg-violet-600/40 !border-none !px-3 !py-1.5 !rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<label for="description" class="font-semibold text-slate-300">Description</label>
|
||||
<Textarea id="description" v-model="newIdea.description" rows="3"
|
||||
class="w-full !bg-slate-800 !border-white/10 !text-white focus:!border-violet-500"
|
||||
placeholder="What are you exploring in this session?" />
|
||||
|
||||
<!-- Grid -->
|
||||
<div class="flex-1 overflow-y-auto p-4 custom-scrollbar">
|
||||
<div v-if="isModalLoading" class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4">
|
||||
<Skeleton v-for="i in 10" :key="i" height="150px" class="!bg-slate-800 rounded-xl" />
|
||||
</div>
|
||||
<div v-else-if="modalAssets.length > 0"
|
||||
class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4">
|
||||
<div v-for="asset in modalAssets" :key="asset.id" @click="toggleAssetSelection(asset)"
|
||||
class="relative aspect-square rounded-xl overflow-hidden cursor-pointer border-2 transition-all group"
|
||||
:class="tempSelectedAssets.some(a => a.id === asset.id) ? 'border-violet-500 ring-2 ring-violet-500/30' : 'border-transparent hover:border-white/20'">
|
||||
<img :src="API_URL + asset.url + '?thumbnail=true'" class="w-full h-full object-cover" />
|
||||
<div class="absolute bottom-0 left-0 right-0 p-2 bg-black/60 backdrop-blur-sm">
|
||||
<p class="text-[10px] text-white truncate">{{ asset.name || 'Asset ' + (asset.id ?
|
||||
asset.id.substring(0, 4) : '') }}</p>
|
||||
</div>
|
||||
<!-- Checkmark -->
|
||||
<div v-if="tempSelectedAssets.some(a => a.id === asset.id)"
|
||||
class="absolute top-2 right-2 w-6 h-6 bg-violet-500 rounded-full flex items-center justify-center shadow-lg animate-in zoom-in duration-200">
|
||||
<i class="pi pi-check text-white text-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="flex flex-col items-center justify-center h-full text-slate-500">
|
||||
<i class="pi pi-image text-4xl mb-2 opacity-50"></i>
|
||||
<p>No assets found</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end gap-2">
|
||||
<Button label="Cancel" @click="showCreateDialog = false" text
|
||||
class="!text-slate-400 hover:!text-white" />
|
||||
<Button label="Start Session" icon="pi pi-check" @click="createIdea" :loading="submitting"
|
||||
class="!bg-violet-600 hover:!bg-violet-500 !border-none" />
|
||||
<Button label="Cancel" @click="isAssetPickerVisible = false"
|
||||
class="!text-slate-300 hover:!bg-white/5" text />
|
||||
<Button :label="'Select (' + tempSelectedAssets.length + ')'" @click="confirmAssetSelection"
|
||||
class="!bg-violet-600 !border-none hover:!bg-violet-500" />
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -160,4 +527,21 @@ const createIdea = async () => {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar-track {
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user