This commit is contained in:
xds
2026-02-18 16:34:11 +03:00
parent f8adcf33d3
commit 0cc5150f9c
12 changed files with 489 additions and 118 deletions

View File

@@ -35,6 +35,40 @@ const toast = useToast()
const { currentIdea, loading, error } = storeToRefs(ideaStore)
const generations = ref([])
// --- Idea Name Editing ---
const isEditingName = ref(false)
const editableName = ref('')
const toggleEditName = () => {
if (!currentIdea.value) return
editableName.value = currentIdea.value.name
isEditingName.value = true
nextTick(() => {
const input = document.querySelector('.idea-name-input input')
if (input) input.focus()
})
}
const saveName = async () => {
if (!editableName.value.trim() || editableName.value === currentIdea.value.name) {
isEditingName.value = false
return
}
try {
const success = await ideaStore.updateIdea(currentIdea.value.id, {
name: editableName.value.trim()
})
if (success) {
toast.add({ severity: 'success', summary: 'Success', detail: 'Idea renamed', life: 2000 })
}
} catch (e) {
toast.add({ severity: 'error', summary: 'Error', detail: 'Failed to rename idea', life: 3000 })
} finally {
isEditingName.value = false
}
}
const prompt = ref('')
const negativePrompt = ref('')
const selectedModel = ref('flux-schnell')
@@ -108,7 +142,11 @@ watch([prompt, quality, aspectRatio, imageCount, selectedModel, sendToTelegram,
const viewMode = ref('feed') // 'feed' or 'gallery'
const isSubmitting = ref(false)
const isSettingsVisible = ref(true)
const isSettingsVisible = ref(localStorage.getItem('idea_detail_settings_visible') !== 'false')
watch(isSettingsVisible, (val) => {
localStorage.setItem('idea_detail_settings_visible', val)
})
const API_URL = import.meta.env.VITE_API_URL
@@ -413,6 +451,15 @@ const clearPrompt = () => {
previousPrompt.value = ''
}
const pastePrompt = async () => {
try {
const text = await navigator.clipboard.readText()
if (text) prompt.value = text
} catch (err) {
console.error('Failed to read clipboard', err)
}
}
// --- Asset Picker Logic ---
const isAssetPickerVisible = ref(false)
@@ -832,14 +879,24 @@ watch(viewMode, (v) => {
<main class="flex-1 flex flex-col min-w-0 bg-slate-950/50 relative">
<!-- Header -->
<header
class="h-16 border-b border-white/5 flex items-center justify-between px-6 bg-slate-900/80 backdrop-blur z-20">
class="h-12 border-b border-white/5 flex items-center justify-between px-6 bg-slate-900/80 backdrop-blur z-20">
<div class="flex items-center gap-4">
<div class="flex flex-col">
<div class="flex items-center gap-2">
<h1 class="text-lg font-bold text-slate-200 truncate max-w-[200px] md:max-w-md">{{
currentIdea?.name || 'Loading...' }}</h1>
<div v-if="isEditingName" class="flex items-center gap-2">
<InputText v-model="editableName"
class="idea-name-input !bg-slate-800 !border-violet-500/50 !text-white !py-0.5 !h-8 !text-base !font-bold"
@keyup.enter="saveName"
@blur="saveName"
/>
</div>
<h1 v-else class="text-base font-bold text-slate-200 truncate max-w-[200px] md:max-w-md cursor-pointer hover:text-violet-400 transition-colors"
@click="toggleEditName">
{{ currentIdea?.name || 'Loading...' }}
<i class="pi pi-pencil text-[9px] ml-1 opacity-50"></i>
</h1>
<span
class="px-2 py-0.5 rounded-full bg-slate-800 text-[10px] text-slate-400 border border-white/5">Idea
class="px-2 py-0.5 rounded-full bg-slate-800 text-[9px] text-slate-400 border border-white/5">Idea
Session</span>
</div>
</div>
@@ -1076,6 +1133,9 @@ watch(viewMode, (v) => {
:disabled="!prompt || prompt.length <= 10"
class="!py-0 !px-1.5 !text-[9px] !h-5 !bg-violet-600/20 hover:!bg-violet-600/30 !border-violet-500/30 !text-violet-400 disabled:opacity-50"
@click="handleImprovePrompt" />
<Button icon="pi pi-clipboard" label="Paste"
class="!py-0 !px-1.5 !text-[9px] !h-5 !bg-slate-800 hover:!bg-slate-700 !border-white/10 !text-slate-400"
@click="pastePrompt" />
<Button icon="pi pi-times" label="Clear"
class="!py-0 !px-1.5 !text-[9px] !h-5 !bg-slate-800 hover:!bg-slate-700 !border-white/10 !text-slate-400"
@click="clearPrompt" />