From 7bb5924cf682bcae9498d24f757d91c8b712f29e Mon Sep 17 00:00:00 2001 From: Jukka Lampikoski Date: Sun, 8 Mar 2026 09:33:22 +0200 Subject: [PATCH] =?UTF-8?q?Remove=20recipe/post=20toggle=20=E2=80=94=20aut?= =?UTF-8?q?o-detect=20type=20from=20category=20selection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When user selects Reseptit category, recipe fields (time, servings, ingredients, steps) appear automatically. All other categories show the post body field instead. Removed the manual toggle buttons and cleaned up related CSS. Co-Authored-By: Claude Sonnet 4.6 --- index.html | 5 ----- script.js | 9 ++++----- style.css | 26 -------------------------- 3 files changed, 4 insertions(+), 36 deletions(-) diff --git a/index.html b/index.html index 910957f..b68c059 100644 --- a/index.html +++ b/index.html @@ -88,11 +88,6 @@

✏️ Lisää julkaisu

-
- - -
-
diff --git a/script.js b/script.js index 80cb9e5..509a64f 100644 --- a/script.js +++ b/script.js @@ -399,9 +399,7 @@ function generateSubmitCaptcha() { function setSubmitType(type) { submitType = type; document.getElementById('sub-recipeFields').style.display = type === 'recipe' ? '' : 'none'; - document.getElementById('sub-postFields').style.display = type === 'post' ? '' : 'none'; - document.getElementById('sub-typeRecipeBtn').classList.toggle('active', type === 'recipe'); - document.getElementById('sub-typePostBtn').classList.toggle('active', type === 'post'); + document.getElementById('sub-postFields').style.display = type === 'post' ? '' : 'none'; } function updateSubcategoryPicker() { @@ -418,14 +416,15 @@ function updateSubcategoryPicker() { subs.map(s => ``).join(''); group.style.display = ''; } + // Näytä reseptikentät jos kategoria on Reseptit, muuten julkaisukentät + setSubmitType(catId === 'recipes' ? 'recipe' : 'post'); } function openSubmitModal() { const cats = APP.categories; const sel = document.getElementById('sub-category'); sel.innerHTML = cats.map(c => ``).join(''); - updateSubcategoryPicker(); - setSubmitType('recipe'); + updateSubcategoryPicker(); // asettaa myös oikean tyypin kategorian mukaan document.getElementById('submitOverlay').classList.add('open'); document.body.style.overflow = 'hidden'; generateSubmitCaptcha(); diff --git a/style.css b/style.css index 225a0f3..db0139e 100644 --- a/style.css +++ b/style.css @@ -472,32 +472,6 @@ footer { gap: 12px; } -.type-toggle { - display: flex; - gap: 10px; - margin-bottom: 14px; -} - -.type-btn { - flex: 1; - padding: 10px; - border: 2px solid var(--border); - border-radius: 8px; - background: #fff; - color: var(--text-light); - font-family: 'Arial', sans-serif; - font-size: 0.88rem; - font-weight: bold; - cursor: pointer; - transition: all 0.2s; - text-align: center; -} - -.type-btn.active { - background: var(--accent); - border-color: var(--accent); - color: #fff; -} .submit-btn { width: 100%;