Compare commits

..

2 commits

Author SHA1 Message Date
Konrad Kunkel
e90920ce86 Merge pull request 'Remove speech archive categories' (#5) from codex/remove-speech-categories into main
All checks were successful
/ deploy (push) Successful in 38s
Reviewed-on: https://git.bcgen.ie/familyfedie/familyfedie-website/pulls/5
2026-06-11 17:48:13 +00:00
e0a79bf5ef Remove speech archive categories 2026-06-11 19:46:55 +02:00
2 changed files with 7 additions and 31 deletions

View file

@ -30,7 +30,7 @@ body.custom-background { background-color: #ffffff; }
.speech-filters { .speech-filters {
display: grid; display: grid;
grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr)) auto; grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(150px, 1fr)) auto;
gap: 12px; gap: 12px;
align-items: end; align-items: end;
margin: 0 0 18px; margin: 0 0 18px;
@ -100,18 +100,16 @@ body.custom-background { background-color: #ffffff; }
} }
.speech-result p { .speech-result p {
margin: 0 0 10px; margin: 0;
} }
.speech-result-meta, .speech-result-meta {
.speech-result-categories {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 6px; gap: 6px;
} }
.speech-result-meta span, .speech-result-meta span {
.speech-result-categories span {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
min-height: 22px; min-height: 22px;

View file

@ -5,12 +5,11 @@ import { getSpeechArchive, uniqueSorted } from "../../lib/speeches";
const speeches = getSpeechArchive(); const speeches = getSpeechArchive();
const years = uniqueSorted(speeches.map((speech) => speech.year), "desc"); const years = uniqueSorted(speeches.map((speech) => speech.year), "desc");
const speakers = uniqueSorted(speeches.map((speech) => speech.speaker)); const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.length ? speech.categories : [speech.category]));
--- ---
<SiteLayout <SiteLayout
title="Speeches Archive &#8211; FFWPU Ireland" title="Speeches Archive &#8211; FFWPU Ireland"
description="Search the FFWPU Ireland archive of speeches by Rev. Sun Myung Moon and Dr. Hak Ja Han Moon by year, speaker, category, and text." description="Search the FFWPU Ireland archive of speeches by Rev. Sun Myung Moon and Dr. Hak Ja Han Moon by year, speaker, and text."
bodyClass="page-template page-template-templates page-template-template-onecolumn page-template-templatestemplate-onecolumn-php page custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" bodyClass="page-template page-template-templates page-template-template-onecolumn page-template-templatestemplate-onecolumn-php page custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/speeches/" pathname="/speeches/"
canonical="/speeches/" canonical="/speeches/"
@ -47,14 +46,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
</select> </select>
</div> </div>
<div class="speech-filter">
<label for="speech-category">Category</label>
<select id="speech-category" name="category">
<option value="">All categories</option>
{categories.map((category) => <option value={category}>{category}</option>)}
</select>
</div>
<button class="speech-reset" type="reset">Reset filters</button> <button class="speech-reset" type="reset">Reset filters</button>
</form> </form>
@ -74,9 +65,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
<a href={speech.url}>{speech.title}</a> <a href={speech.url}>{speech.title}</a>
</h2> </h2>
<p>{speech.excerpt}</p> <p>{speech.excerpt}</p>
<div class="speech-result-categories">
{(speech.categories.length ? speech.categories : [speech.category]).map((category) => <span>{category}</span>)}
</div>
</article> </article>
)) ))
} }
@ -98,9 +86,8 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
const searchInput = document.getElementById("speech-search"); const searchInput = document.getElementById("speech-search");
const yearSelect = document.getElementById("speech-year"); const yearSelect = document.getElementById("speech-year");
const speakerSelect = document.getElementById("speech-speaker"); const speakerSelect = document.getElementById("speech-speaker");
const categorySelect = document.getElementById("speech-category");
if (!form || !results || !count || !searchInput || !yearSelect || !speakerSelect || !categorySelect) { if (!form || !results || !count || !searchInput || !yearSelect || !speakerSelect) {
return; return;
} }
@ -120,7 +107,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
q: searchInput.value.trim(), q: searchInput.value.trim(),
year: yearSelect.value, year: yearSelect.value,
speaker: speakerSelect.value, speaker: speakerSelect.value,
category: categorySelect.value,
}; };
} }
@ -141,7 +127,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
searchInput.value = params.get("q") || ""; searchInput.value = params.get("q") || "";
yearSelect.value = params.get("year") || ""; yearSelect.value = params.get("year") || "";
speakerSelect.value = params.get("speaker") || ""; speakerSelect.value = params.get("speaker") || "";
categorySelect.value = params.get("category") || "";
} }
function matchesSpeech(speech, filters) { function matchesSpeech(speech, filters) {
@ -151,9 +136,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
if (filters.speaker && speech.speaker !== filters.speaker) { if (filters.speaker && speech.speaker !== filters.speaker) {
return false; return false;
} }
if (filters.category && !speech.categories.includes(filters.category) && speech.category !== filters.category) {
return false;
}
if (!filters.q) { if (!filters.q) {
return true; return true;
} }
@ -188,11 +170,7 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
const excerpt = document.createElement("p"); const excerpt = document.createElement("p");
excerpt.textContent = speech.excerpt; excerpt.textContent = speech.excerpt;
const categories = document.createElement("div"); article.append(meta, title, excerpt);
categories.className = "speech-result-categories";
appendMeta(categories, speech.categories.length ? speech.categories : [speech.category]);
article.append(meta, title, excerpt, categories);
return article; return article;
} }