Files
soroush.asadi 96e73bf633
CI/CD / CI · dotnet build (push) Failing after 0s
CI/CD / Deploy · drsousan (push) Has been skipped
first commit
2026-05-31 00:42:08 +03:30

180 lines
9.1 KiB
HTML

<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<title>وبلاگ | دکتر سوسن آل‌طه</title>
<meta name="description" content="مقالات تخصصی دکتر سوسن آل‌طه درباره زیبایی پوست، بوتاکس، فیلر، لیزر و مراقبت از پوست."/>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap" onload="this.rel='stylesheet'"/>
<style>
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{--gold:#B8955A;--gold-l:#D4B483;--gold-pale:#F5ECD8;--bg:#FAFAF7;--white:#fff;--dark:#1E1E1E;--mid:#5A5A5A;--light:#9A9A9A;--border:#E8E2D9}
body{font-family:'Vazirmatn',Tahoma,sans-serif;background:var(--bg);color:var(--dark);direction:rtl;line-height:1.8}
a{text-decoration:none;color:inherit}
/* Navbar */
header{position:sticky;top:0;z-index:50;background:rgba(250,250,247,.92);backdrop-filter:blur(12px);border-bottom:1px solid var(--border);padding:0 2rem;height:70px;display:flex;align-items:center;justify-content:space-between}
.logo{font-size:1rem;font-weight:600;color:var(--gold)}
nav{display:flex;gap:2rem}
nav a{color:var(--mid);font-size:.88rem;transition:color .2s}
nav a:hover{color:var(--gold)}
.nav-cta{background:var(--gold);color:#fff!important;padding:.4rem 1.1rem;border-radius:50px;font-size:.85rem!important}
/* Hero */
.blog-hero{background:linear-gradient(135deg,var(--gold-pale) 0%,#EDE0CA 100%);padding:4rem 2rem 3rem;text-align:center}
.blog-hero h1{font-size:clamp(1.8rem,4vw,2.5rem);font-weight:700;color:var(--dark);margin-bottom:.6rem}
.blog-hero p{font-size:1rem;color:var(--mid);max-width:520px;margin:0 auto}
/* Filter */
.filter-bar{max-width:1100px;margin:2rem auto 0;padding:0 2rem;display:flex;gap:.6rem;flex-wrap:wrap}
.filter-btn{background:transparent;border:1.5px solid var(--border);color:var(--mid);padding:.4rem 1.1rem;border-radius:50px;font-family:inherit;font-size:.85rem;cursor:pointer;transition:all .2s}
.filter-btn.active,.filter-btn:hover{background:var(--gold);border-color:var(--gold);color:#fff}
/* Grid */
.blog-grid{max-width:1100px;margin:2rem auto;padding:0 2rem;display:grid;grid-template-columns:repeat(3,1fr);gap:1.5rem}
@media(max-width:900px){.blog-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.blog-grid{grid-template-columns:1fr}}
.post-card{background:var(--white);border-radius:16px;border:1px solid var(--border);overflow:hidden;transition:transform .3s,box-shadow .3s;display:flex;flex-direction:column}
.post-card:hover{transform:translateY(-4px);box-shadow:0 12px 40px rgba(184,149,90,.15)}
.post-card-img{aspect-ratio:16/9;background:linear-gradient(135deg,var(--gold-pale),#EDE0CA);display:flex;align-items:center;justify-content:center;color:var(--gold);font-size:2rem}
.post-card-img img{width:100%;height:100%;object-fit:cover}
.post-card-body{padding:1.3rem;flex:1;display:flex;flex-direction:column;gap:.6rem}
.post-cat{font-size:.72rem;font-weight:600;color:var(--gold);background:var(--gold-pale);padding:.2rem .7rem;border-radius:50px;display:inline-block}
.post-title{font-size:1rem;font-weight:600;color:var(--dark);line-height:1.5}
.post-title:hover{color:var(--gold)}
.post-excerpt{font-size:.85rem;color:var(--mid);line-height:1.7;flex:1}
.post-meta{display:flex;align-items:center;justify-content:space-between;font-size:.75rem;color:var(--light);margin-top:auto;padding-top:.6rem;border-top:1px solid var(--border)}
.read-more{color:var(--gold);font-weight:500;font-size:.82rem}
/* Pagination */
.pagination{display:flex;gap:.5rem;justify-content:center;padding:2rem;margin-top:1rem}
.page-btn{width:38px;height:38px;border-radius:8px;border:1.5px solid var(--border);background:transparent;font-family:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}
.page-btn.active,.page-btn:hover{background:var(--gold);border-color:var(--gold);color:#fff}
/* Empty */
.empty{text-align:center;padding:4rem 2rem;color:var(--light)}
.empty svg{width:48px;height:48px;margin:0 auto 1rem}
/* Search */
.search-wrap{max-width:480px;margin:0 auto;position:relative}
.search-wrap input{width:100%;border:1.5px solid var(--border);border-radius:50px;padding:.65rem 1.2rem .65rem 3rem;font-family:inherit;font-size:.9rem;direction:rtl;outline:none;background:var(--white);transition:border-color .2s}
.search-wrap input:focus{border-color:var(--gold)}
.search-wrap svg{position:absolute;left:1rem;top:50%;transform:translateY(-50%);width:18px;height:18px;color:var(--light)}
footer{background:var(--dark);color:rgba(255,255,255,.5);text-align:center;padding:2rem;font-size:.83rem;margin-top:3rem}
footer a{color:var(--gold-l)}
</style>
</head>
<body>
<header>
<a class="logo" href="index.html">دکتر سوسن آل‌طه</a>
<nav>
<a href="index.html">خانه</a>
<a href="index.html#services">خدمات</a>
<a href="blog.html" style="color:var(--gold)">وبلاگ</a>
<a href="index.html#contact" class="nav-cta">رزرو نوبت</a>
</nav>
</header>
<div class="blog-hero">
<h1>وبلاگ تخصصی پوست و زیبایی</h1>
<p>آخرین مقالات و راهنماهای تخصصی درباره مراقبت از پوست، زیبایی و درمان‌های تخصصی</p>
<div class="search-wrap" style="margin-top:1.5rem">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
<input type="text" id="searchInput" placeholder="جستجو در مقالات..." oninput="handleSearch()"/>
</div>
</div>
<div class="filter-bar" id="filterBar">
<button class="filter-btn active" onclick="filterCat('',this)">همه</button>
</div>
<div class="blog-grid" id="blogGrid">
<div class="empty"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16"/><path d="M20 8H8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2z"/></svg><p>در حال بارگذاری...</p></div>
</div>
<div class="pagination" id="pagination"></div>
<footer>
<p>© ۱۴۰۳ دکتر سوسن آل‌طه | <a href="admin/index.html">پنل مدیریت</a></p>
</footer>
<script>
const API='http://localhost:5000';
let currentCat='', currentSearch='', currentPage=1, pageSize=9, totalPosts=0;
async function loadPosts(){
const params=new URLSearchParams({page:currentPage,pageSize});
if(currentCat) params.set('category',currentCat);
if(currentSearch) params.set('search',currentSearch);
const data=await fetch(`${API}/api/blog/posts?${params}`).then(r=>r.json()).catch(()=>null);
if(!data){renderError();return;}
totalPosts=data.total;
renderGrid(data.items);
renderPagination();
}
function renderGrid(posts){
const g=document.getElementById('blogGrid');
if(!posts.length){g.innerHTML='<div class="empty"><p>مقاله‌ای یافت نشد</p></div>';return;}
g.innerHTML=posts.map(p=>`
<div class="post-card">
<div class="post-card-img">${p.featuredImage?`<img src="${p.featuredImage}" alt="${p.title}" loading="lazy"/>`:'📝'}</div>
<div class="post-card-body">
<span class="post-cat">${p.category?.name||'عمومی'}</span>
<a href="post.html?slug=${p.slug}" class="post-title">${p.title}</a>
<p class="post-excerpt">${p.excerpt.substring(0,120)}...</p>
<div class="post-meta">
<span>🕐 ${p.readingTimeMinutes} دقیقه | 👁 ${p.viewCount}</span>
<a href="post.html?slug=${p.slug}" class="read-more">ادامه مطلب ←</a>
</div>
</div>
</div>`).join('');
}
function renderPagination(){
const total=Math.ceil(totalPosts/pageSize);
const pg=document.getElementById('pagination');
if(total<=1){pg.innerHTML='';return;}
let h='';
for(let i=1;i<=total;i++) h+=`<button class="page-btn${i===currentPage?' active':''}" onclick="gotoPage(${i})">${i}</button>`;
pg.innerHTML=h;
}
function renderError(){document.getElementById('blogGrid').innerHTML='<div class="empty"><p>خطا در اتصال به سرور. مطمئن شوید API روی پورت ۵۰۰۰ اجرا است.</p></div>';}
function filterCat(slug,btn){
currentCat=slug; currentPage=1;
document.querySelectorAll('.filter-btn').forEach(b=>b.classList.remove('active'));
btn.classList.add('active');
loadPosts();
}
let searchTimer;
function handleSearch(){
clearTimeout(searchTimer);
searchTimer=setTimeout(()=>{currentSearch=document.getElementById('searchInput').value;currentPage=1;loadPosts();},400);
}
function gotoPage(p){currentPage=p;loadPosts();window.scrollTo({top:200,behavior:'smooth'});}
async function loadCategories(){
const cats=await fetch(`${API}/api/blog/categories`).then(r=>r.json()).catch(()=>[]);
const bar=document.getElementById('filterBar');
cats.forEach(c=>{
const btn=document.createElement('button');
btn.className='filter-btn';
btn.textContent=`${c.name} (${c.postCount})`;
btn.onclick=()=>filterCat(c.slug,btn);
bar.appendChild(btn);
});
}
loadCategories();
loadPosts();
</script>
</body>
</html>