This commit is contained in:
F4ilji
2026-04-07 17:54:26 +05:00
parent 04adba6682
commit 936b1fb5b0
468 changed files with 43498 additions and 4176 deletions
@@ -0,0 +1,146 @@
<template>
<div class="space-y-6">
<!-- Title & Slug -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
<div>
<label for="title" class="block text-sm font-medium text-foreground mb-1.5">
Заголовок <span class="text-rose-500">*</span>
</label>
<input
id="title"
:value="title"
@input="$emit('update:title', $event.target.value)"
@blur="$emit('generate-slug')"
type="text"
:class="inputClass"
placeholder="Введите заголовок новости"
/>
<p v-if="errors.title" class="mt-1.5 text-xs text-rose-600 flex items-center gap-1">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
{{ errors.title }}
</p>
<p v-else class="mt-1.5 text-xs text-muted-foreground-1">Заголовок будет отображаться на сайте</p>
</div>
<div>
<label for="slug" class="block text-sm font-medium text-foreground mb-1.5">
URL-адрес <span class="text-rose-500">*</span>
</label>
<div class="flex gap-2">
<input
id="slug"
:value="slug"
@input="$emit('update:slug', $event.target.value)"
type="text"
:class="inputClass"
placeholder="url-novosti"
class="font-mono flex-1"
readonly
/>
</div>
<p v-if="errors.slug" class="mt-1.5 text-xs text-rose-600 flex items-center gap-1">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
{{ errors.slug }}
</p>
<p v-else class="mt-1.5 text-xs text-muted-foreground-1">
URL генерируется автоматически. Нажмите для обновления.
</p>
</div>
</div>
<!-- Status & Category -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
<div>
<label for="status" class="block text-sm font-medium text-foreground mb-1.5">
Статус публикации <span class="text-rose-500">*</span>
</label>
<select
id="status"
:value="status"
@change="$emit('update:status', $event.target.value)"
:class="inputClass"
>
<option v-for="statusOption in statusOptions"
:key="statusOption.value"
:value="statusOption.value">
{{ statusOption.label }}
</option>
</select>
<p v-if="errors.status" class="mt-1.5 text-xs text-rose-600 flex items-center gap-1">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
{{ errors.status }}
</p>
</div>
<div>
<label for="category_id" class="block text-sm font-medium text-foreground mb-1.5">
Категория
</label>
<select
id="category_id"
:value="categoryId"
@change="$emit('update:categoryId', $event.target.value)"
:class="inputClass"
>
<option value="">Выберите категорию</option>
<option v-for="category in categories" :key="category.id" :value="category.id">
{{ category.title }}
</option>
</select>
<p v-if="errors.category_id" class="mt-1.5 text-xs text-rose-600 flex items-center gap-1">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
{{ errors.category_id }}
</p>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'PostMainInfo',
props: {
title: {
type: String,
default: ''
},
slug: {
type: String,
default: ''
},
status: {
type: String,
default: ''
},
categoryId: {
type: [String, Number],
default: ''
},
categories: {
type: Array,
default: () => []
},
statusOptions: {
type: Array,
default: () => []
},
errors: {
type: Object,
default: () => ({})
},
inputClass: {
type: String,
default: 'w-full px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all'
}
},
emits: ['update:title', 'update:slug', 'update:status', 'update:categoryId', 'generate-slug']
}
</script>
@@ -0,0 +1,105 @@
<template>
<div class="space-y-4">
<!-- Publishing Settings -->
<div class="border border-layer-line rounded-lg overflow-hidden">
<div class="px-4 py-3 bg-surface/50 border-b border-line-2">
<div class="flex items-center gap-2">
<svg class="w-4 h-4 text-muted-foreground-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<h3 class="text-sm font-medium text-foreground">Публикация по времени</h3>
</div>
</div>
<div class="p-4 space-y-4">
<div class="flex items-center gap-3">
<input
id="publish_after"
:checked="publishAfter"
@change="$emit('update:publishAfter', $event.target.checked)"
:disabled="!!publishAt"
type="checkbox"
class="w-4 h-4 text-primary border-layer-line rounded focus:ring-primary/20"
/>
<label for="publish_after" class="text-sm text-foreground">
Включить отложенную публикацию
</label>
</div>
<div v-if="publishAfter">
<label for="publish_at" class="block text-sm font-medium text-foreground mb-1.5">
Дата и время публикации
</label>
<input
id="publish_at"
:value="publishAt"
@input="$emit('update:publishAt', $event.target.value)"
type="datetime-local"
:class="inputClass"
/>
<p v-if="errors.publish_at" class="mt-1.5 text-xs text-rose-600 flex items-center gap-1">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
{{ errors.publish_at }}
</p>
</div>
</div>
</div>
<!-- Social Media -->
<div class="border border-layer-line rounded-lg overflow-hidden">
<div class="px-4 py-3 bg-surface/50 border-b border-line-2">
<div class="flex items-center gap-2">
<svg class="w-4 h-4 text-blue-500" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2.04c-5.5 0-10 4.49-10 10.02c0 5 3.66 9.15 8.44 9.9v-7H7.9v-2.9h2.54V9.85c0-2.51 1.49-3.89 3.78-3.89c1.09 0 2.23.19 2.23.19v2.47h-1.26c-1.24 0-1.63.77-1.63 1.56v1.88h2.78l-.45 2.9h-2.33v7a10 10 0 0 0 8.44-9.9c0-5.53-4.5-10.02-10-10.02Z"/>
</svg>
<h3 class="text-sm font-medium text-foreground">Публикация в соцсетях</h3>
</div>
</div>
<div class="p-4">
<div class="flex items-center gap-3">
<input
id="publication_vk"
:checked="publishVk"
@change="$emit('update:publishVk', $event.target.checked)"
type="checkbox"
class="w-4 h-4 text-primary border-layer-line rounded focus:ring-primary/20"
/>
<label for="publication_vk" class="text-sm text-foreground">
Опубликовать ВКонтакте
</label>
</div>
<p class="mt-2 text-xs text-muted-foreground-1">Новость будет автоматически опубликована в VK</p>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'PostPublishSettings',
props: {
publishAfter: {
type: Boolean,
default: false
},
publishAt: {
type: String,
default: ''
},
publishVk: {
type: Boolean,
default: false
},
errors: {
type: Object,
default: () => ({})
},
inputClass: {
type: String,
default: 'w-full px-3 py-2 bg-surface border border-layer-line rounded-lg text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all'
}
},
emits: ['update:publishAfter', 'update:publishAt', 'update:publishVk']
}
</script>
@@ -0,0 +1,115 @@
<template>
<div class="space-y-6">
<!-- Tags -->
<div>
<label class="block text-sm font-medium text-foreground mb-1.5">
Теги
</label>
<div
class="min-h-[42px] flex flex-wrap items-center gap-2 p-2.5 bg-surface border border-layer-line rounded-lg focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-primary/20 transition-all"
>
<span
v-for="(tag, index) in tags"
:key="index"
class="inline-flex items-center gap-1.5 px-3 py-1 bg-primary/10 text-primary rounded-full text-sm font-medium group"
>
{{ tag }}
<button
type="button"
@click="$emit('remove-tag', index)"
class="text-primary/70 hover:text-primary transition-colors"
>
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</span>
<input
ref="tagInput"
v-model="newTag"
type="text"
class="flex-1 min-w-[120px] bg-transparent outline-none text-sm text-foreground placeholder-muted-foreground-2"
placeholder="Добавьте тег и нажмите Enter"
@keydown.enter.prevent="addTag"
@keydown.comma.prevent="addTag"
/>
</div>
<p class="mt-1.5 text-xs text-muted-foreground-1">Нажмите Enter для добавления тега</p>
</div>
<!-- Authors -->
<div>
<label class="block text-sm font-medium text-foreground mb-1.5">
Авторы
</label>
<div
class="min-h-[42px] flex flex-wrap items-center gap-2 p-2.5 bg-surface border border-layer-line rounded-lg focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-primary/20 transition-all"
>
<span
v-for="(author, index) in authors"
:key="index"
class="inline-flex items-center gap-1.5 px-3 py-1 bg-surface-muted text-foreground rounded-full text-sm font-medium group"
>
<svg class="w-3.5 h-3.5 text-muted-foreground-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
{{ author }}
<button
type="button"
@click="$emit('remove-author', index)"
class="text-muted-foreground-1 hover:text-foreground transition-colors"
>
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</span>
<input
v-model="newAuthor"
type="text"
class="flex-1 min-w-[120px] bg-transparent outline-none text-sm text-foreground placeholder-muted-foreground-2"
placeholder="Добавьте автора"
@keydown.enter.prevent="$emit('add-author')"
/>
</div>
<p class="mt-1.5 text-xs text-muted-foreground-1">Укажите авторов новости</p>
</div>
</div>
</template>
<script>
export default {
name: 'PostTagsAuthors',
props: {
tags: {
type: Array,
default: () => []
},
authors: {
type: Array,
default: () => []
}
},
emits: ['add-tag', 'remove-tag', 'add-author', 'remove-author'],
data() {
return {
newTag: '',
newAuthor: ''
}
},
methods: {
addTag() {
if (this.newTag.trim()) {
this.$emit('add-tag', this.newTag.trim());
this.newTag = '';
}
},
addAuthor() {
if (this.newAuthor.trim()) {
this.$emit('add-author', this.newAuthor.trim());
this.newAuthor = '';
}
}
}
}
</script>