Sync admin settings and media with the public landing site.

Show logo in the navbar, add image upload fields for logo/team/work/blog/gallery, and drive site chrome from settings everywhere.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-30 22:10:45 +03:30
co-authored by Cursor
parent ceac76781b
commit c33a757af4
14 changed files with 189 additions and 49 deletions
+14 -10
View File
@@ -1,6 +1,7 @@
<template>
<div>
<h1>تنظیمات سایت</h1>
<p class="muted">این مقادیر روی هدر، فوتر و کل سایت اعمال می‌شوند.</p>
<form v-if="form" class="card" @submit.prevent="save">
<div class="grid-2">
<div class="field">
@@ -26,17 +27,19 @@
<div class="field">
<label class="label">منطقه زمانی</label>
<select v-model="form.timezone" class="input" dir="ltr">
<option value="Asia/Tehran">Asia/Tehran (ایران — تهران، اصفهان، مشهد و …)</option>
<option value="Asia/Tehran">Asia/Tehran (ایران)</option>
<option value="UTC">UTC</option>
</select>
<p class="muted" style="margin-top: 0.35rem">برای همهٔ شهرهای ایران فقط Asia/Tehran معتبر است.</p>
</div>
<div class="field" style="grid-column: 1 / -1">
<label class="label">آدرس لوگو</label>
<input v-model="form.logoUrl" class="input" dir="ltr" placeholder="از بخش رسانه آپلود کنید و آدرس را اینجا بگذارید" />
</div>
</div>
<ImageField
v-model="form.logoUrl"
label="لوگو"
placeholder="/api/uploads/..."
hint="لوگو در هدر سایت نمایش داده می‌شود. اگر خالی باشد نام برند نشان داده می‌شود."
/>
<h2 style="margin: 1.25rem 0 0.75rem; font-size: 1rem">شبکه‌های اجتماعی</h2>
<div v-for="(s, i) in socials" :key="i" class="item-box">
<div class="row" style="justify-content: space-between; margin-bottom: 0.5rem">
@@ -45,16 +48,16 @@
</div>
<div class="grid-2">
<div class="field">
<label class="label">نام (مثلاً لینکدین)</label>
<label class="label">نام</label>
<input v-model="s.label" class="input" />
</div>
<div class="field">
<label class="label">آدرس لینک</label>
<label class="label">لینک</label>
<input v-model="s.url" class="input" dir="ltr" placeholder="https://..." />
</div>
</div>
</div>
<button type="button" class="btn ghost" @click="socials.push({ label: '', url: '' })">+ افزودن شبکه اجتماعی</button>
<button type="button" class="btn ghost" @click="socials.push({ label: '', url: '' })">+ افزودن</button>
<p v-if="msg" class="muted" style="margin-top: 1rem">{{ msg }}</p>
<button class="btn" style="margin-top: 0.75rem">ذخیره</button>
@@ -65,6 +68,7 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from "vue";
import { api } from "../lib/api";
import ImageField from "../components/ImageField.vue";
const form = ref<{
brandName: string;
@@ -110,7 +114,7 @@ async function save() {
};
const { data } = await api.put("/admin/settings", payload);
form.value.logoUrl = data.logoUrl || "";
msg.value = "ذخیره شد.";
msg.value = "ذخیره شد. برای دیدن در سایت صفحه را رفرش کنید.";
} catch (e: any) {
const detail = e?.response?.data?.message;
msg.value = Array.isArray(detail)