feat: add blog category selection and update project section title

This commit is contained in:
poyrazavsever
2026-03-11 13:43:17 +03:00
parent 8c37be35f0
commit d59f0985b7
4 changed files with 23 additions and 4 deletions
+19 -2
View File
@@ -1,5 +1,5 @@
import { COLLECTION_CONFIGS, PODCAST_LABELS } from "./configs.js";
import { BLOG_CATEGORIES, COLLECTION_CONFIGS, PODCAST_LABELS } from "./configs.js";
const state = {
activeTab: "blog",
@@ -136,6 +136,23 @@ function emptyBlogDraft() {
};
}
function ensureBlogCategorySelect(selectedCategory = "General") {
const options = BLOG_CATEGORIES;
const normalizedSelected = String(selectedCategory || "").trim();
const hasSelected = options.includes(normalizedSelected);
const finalValue = hasSelected ? normalizedSelected : "General";
el.blogCategory.innerHTML = "";
for (const category of options) {
const option = document.createElement("option");
option.value = category;
option.textContent = category;
el.blogCategory.appendChild(option);
}
el.blogCategory.value = finalValue;
}
function currentBlogDraft() {
return {
slug: el.blogSlug.value.trim(),
@@ -154,7 +171,7 @@ function fillBlogForm(post) {
const draft = post || emptyBlogDraft();
el.blogSlug.value = draft.slug || "";
el.blogTitle.value = draft.title || "";
el.blogCategory.value = draft.category || "General";
ensureBlogCategorySelect(draft.category || "General");
el.blogDate.value = draft.date || "";
el.blogReadTime.value = draft.readTime || "";
el.blogAuthor.value = draft.author || "Poyraz Avsever";
+2
View File
@@ -1,4 +1,6 @@
export const BLOG_CATEGORIES = ["Frontend", "UX", "Yazilim", "TypeScript", "Testing", "General"];
export const COLLECTION_CONFIGS = {
announcement: {
label: "Announcement",
+1 -1
View File
@@ -66,7 +66,7 @@
</div>
<div>
<label for="blog-category">Category</label>
<input id="blog-category" placeholder="React" />
<select id="blog-category"></select>
</div>
<div>
<label for="blog-date">Date</label>
+1 -1
View File
@@ -80,7 +80,7 @@ export async function ProjectsContent() {
<ProjectSection title="Mobil Uygulamalar" items={MOBILE_APPS} />
<ProjectSection title="Web Uygulamaları" items={WEB_APPS} />
<ProjectSection title="Açık Kaynak Araçlar" items={FIGMA_TEMPLATES} />
<ProjectSection title="Figma Tasarımları" items={FIGMA_TEMPLATES} />
<section className="space-y-2">
<Typography variant="large" className="text-base">