From 7c98c8a5106ca303ec26a67f8dbcd6320f1f4e33 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 10:47:17 +0300 Subject: [PATCH 1/6] ssimplify event filters --- ...5-Introduction-to-Quantum-Computing-2Ed.md | 26 ++++--------------- content/site.js.liquid | 10 +------ src/components/Events.jsx | 11 +++++--- 3 files changed, 13 insertions(+), 34 deletions(-) diff --git a/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md b/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md index 12e87407003c..708922f1fa6f 100644 --- a/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md +++ b/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md @@ -10,27 +10,11 @@ tags: - LUMI type: Event filters: - Availability: - - name: "Open to anyone" - value: false - - name: "Registration needed" - value: true - Skill level: - - name: "Advanced" - value: false - - name: "Beginner" - value: true - Pricing: - - name: "Free of charge" - value: false - Type: - - name: "Online" - value: false - - name: "Hybrid" - value: false - - name: "Onsite" - value: true - Theme: "course/workshop" + Pricing: Free of charge # Free of charge, or empty if paid + Availability: Open to anyone # Open to anyone, Registration needed + Skill level: Beginner # Beginner, Advanced + Type: Online # Online, Hybrid, Onsite + Theme: Course/Workshop # Course/Workshop, Hybrid QC+HPC computing, Programming, Webinar/Lecture --- 25-26 November: Two-day introductory course on quantum computers and the basic quantum algorithms that control them. diff --git a/content/site.js.liquid b/content/site.js.liquid index 10f79a87690e..07f52480304d 100644 --- a/content/site.js.liquid +++ b/content/site.js.liquid @@ -42,15 +42,7 @@ permalink: site.js "content": {{ event_post.content | strip_html | strip_newlines | jsonify }}, "filters": { {%- for category in event_post.filters %} - {%- if category[0] == "Theme" -%} - "Theme": "{{ category[1] }}" - {%- else -%} - "{{ category[0] }}": { - {%- for option in category[1] %} - "{{ option.name }}": {{ option.value | jsonify }}{%- unless forloop.last -%},{%- endunless -%} - {%- endfor %} - } - {%- endif -%} + "{{ category[0] }}": "{{ category[1] }}" {%- unless forloop.last -%},{%- endunless -%} {%- endfor %} } diff --git a/src/components/Events.jsx b/src/components/Events.jsx index 798cc7b826ae..8b099eb5af6f 100644 --- a/src/components/Events.jsx +++ b/src/components/Events.jsx @@ -196,7 +196,8 @@ export const Events = () => { useEffect(() => { //set filteredEvents everytime filters changes const applyFilters = (event) => { // First, check the Theme filter separately: - if (filters.Theme && event?.filters?.Theme !== filters.Theme) { + + if (filters.Theme && event?.filters?.Theme?.toLowerCase() !== filters.Theme?.toLowerCase()) { return false; } @@ -206,13 +207,15 @@ export const Events = () => { if (category === "Theme") return true; // Create an array of only the options that are checked (active) - const activeOptions = Object.entries(options).filter(([_, checked]) => checked); + const activeOptions = Object.entries(options) + .filter(([_, checked]) => checked) + .map(([option, _]) => option); // If no options are active in this category, do not filter out the event: if (activeOptions.length === 0) return true; - // Otherwise, require that at least one active option is true in the event: - return activeOptions.some(([option]) => event?.filters?.[category]?.[option]); + // Otherwise, check if the category value of the event is in the active options array: + return activeOptions.includes(event?.filters?.[category]) }); }; From dcd84ba7d6b33f74af1a422c5fdbbaa2d7ac996f Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 10:56:57 +0300 Subject: [PATCH 2/6] edit comments --- src/components/Events.jsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Events.jsx b/src/components/Events.jsx index 8b099eb5af6f..c23813f9b903 100644 --- a/src/components/Events.jsx +++ b/src/components/Events.jsx @@ -193,17 +193,14 @@ export const Events = () => { }; }, [isModalOpen]); - useEffect(() => { //set filteredEvents everytime filters changes + useEffect(() => { const applyFilters = (event) => { - // First, check the Theme filter separately: if (filters.Theme && event?.filters?.Theme?.toLowerCase() !== filters.Theme?.toLowerCase()) { return false; } - // For every other filter category... return Object.entries(filters).every(([category, options]) => { - // Skip the "Theme" category here if (category === "Theme") return true; // Create an array of only the options that are checked (active) From abb3854a338c71a936319d7ee3c46c0ae085af67 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 10:57:07 +0300 Subject: [PATCH 3/6] simplify blog filters --- content/_publications/2024-08-29-Topology.md | 16 +++------------- content/site.js.liquid | 10 +--------- src/components/Blogs.jsx | 17 +++++++++-------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/content/_publications/2024-08-29-Topology.md b/content/_publications/2024-08-29-Topology.md index 52852673baf3..c7e8c7a47ec0 100644 --- a/content/_publications/2024-08-29-Topology.md +++ b/content/_publications/2024-08-29-Topology.md @@ -12,19 +12,9 @@ tags: - Quantum type: 'Blog' filters: - Skill level: - - name: "Advanced" - value: false - - name: "Beginner" - value: true - Type: - - name: "Blog" - value: false - - name: "Instructions" - value: true - - name: "News" - value: false - Theme: "Technical" + Skill level: Beginner # Beginner, Advanced + Type: Blog # Blog, Instructions, News + Theme: Technical # Technical, Algorithm, Programming, Hybrid QC+HPC computing --- *As quantum computing continues to advance, the architecture of quantum processing units (QPUs) is becoming increasingly critical to the performance of quantum circuits, the backbone of all quantum algorithms. A key factor influencing the design of these circuits is qubit connectivity—how qubits are arranged and interact within a QPU. Different quantum platforms exhibit unique connectivity patterns that directly impact how quantum circuits are implemented and optimized.* diff --git a/content/site.js.liquid b/content/site.js.liquid index 07f52480304d..d93201777489 100644 --- a/content/site.js.liquid +++ b/content/site.js.liquid @@ -13,15 +13,7 @@ permalink: site.js "teaser": "{{ publication.header.teaser | absolute_url }}", "filters": { {%- for category in publication.filters %} - {%- if category[0] == "Theme" -%} - "Theme": "{{ category[1] }}" - {%- else -%} - "{{ category[0] }}": { - {%- for option in category[1] %} - "{{ option.name }}": {{ option.value | jsonify }}{%- unless forloop.last -%},{%- endunless -%} - {%- endfor %} - } - {%- endif -%} + "{{ category[0] }}": "{{ category[1] }}" {%- unless forloop.last -%},{%- endunless -%} {%- endfor %} } diff --git a/src/components/Blogs.jsx b/src/components/Blogs.jsx index ae2689e0d695..9f2b73a91fc2 100644 --- a/src/components/Blogs.jsx +++ b/src/components/Blogs.jsx @@ -166,24 +166,25 @@ export const Blogs = () => { }; }, [isModalOpen]); - useEffect(() => { //set filteredBlogs everytime filters changes + useEffect(() => { const applyFilters = (blog) => { - if (filters.Theme && blog?.filters?.Theme !== filters.Theme) { + if (filters.Theme && blog?.filters?.Theme?.toLowerCase() !== filters.Theme?.toLowerCase()) { return false; } - // For every other filter category... + return Object.entries(filters).every(([category, options]) => { - // Skip the "Theme" category here if (category === "Theme") return true; // Create an array of only the options that are checked (active) - const activeOptions = Object.entries(options).filter(([_, checked]) => checked); + const activeOptions = Object.entries(options) + .filter(([_, checked]) => checked) + .map(([option, _]) => option); - // If no options are active in this category, do not filter out the event: + // If no options are active in this category, do not filter out the blog: if (activeOptions.length === 0) return true; - // Otherwise, require that at least one active option is true in the event: - return activeOptions.some(([option]) => blog?.filters?.[category]?.[option]); + // Otherwise, check if the category value of the blog is in the active options array: + return activeOptions.includes(blog?.filters?.[category]) }); }; From 8c414a01035cbb0912fa95c10c449cb92778e19e Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 11:01:06 +0300 Subject: [PATCH 4/6] small bug fix --- src/components/Blogs.jsx | 3 +-- src/components/Events.jsx | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Blogs.jsx b/src/components/Blogs.jsx index 9f2b73a91fc2..31e4a4ad2a0d 100644 --- a/src/components/Blogs.jsx +++ b/src/components/Blogs.jsx @@ -80,8 +80,7 @@ const FilterModal = ({ isModalOpen, setIsModalOpen, filters, handleFilterChange return ( setIsModalOpen(event.detail)} diff --git a/src/components/Events.jsx b/src/components/Events.jsx index c23813f9b903..85b0df0e60fe 100644 --- a/src/components/Events.jsx +++ b/src/components/Events.jsx @@ -94,8 +94,6 @@ const FilterModal = ({ isModalOpen, setIsModalOpen, filters, handleFilterChange return ( setIsModalOpen(event.detail)} From 61e3757b25e5c0d999193e050f71fca359d35db6 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Thu, 12 Jun 2025 09:45:47 +0300 Subject: [PATCH 5/6] allow multiple comma separated values per filter category --- src/components/Blogs.jsx | 6 ++++-- src/components/Events.jsx | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Blogs.jsx b/src/components/Blogs.jsx index e29fca5ab631..589049369dec 100644 --- a/src/components/Blogs.jsx +++ b/src/components/Blogs.jsx @@ -166,7 +166,8 @@ export const Blogs = () => { useEffect(() => { const applyFilters = (blog) => { - if (filters.Theme && blog?.filters?.Theme?.toLowerCase() !== filters.Theme?.toLowerCase()) { + const themeOptions = blog.filters?.Theme?.split(',').map(opt => opt.trim().toLowerCase()) || []; + if (filters.Theme && !themeOptions.includes(filters.Theme?.toLowerCase())) { return false; } @@ -182,7 +183,8 @@ export const Blogs = () => { if (activeOptions.length === 0) return true; // Otherwise, check if the category value of the blog is in the active options array: - return activeOptions.includes(blog?.filters?.[category]) + const blogOptions = blog.filters?.[category]?.split(',').map(opt => opt.trim()) || []; + return activeOptions.some(opt => blogOptions.includes(opt)); }); }; diff --git a/src/components/Events.jsx b/src/components/Events.jsx index 810f2a36c008..594a28578e46 100644 --- a/src/components/Events.jsx +++ b/src/components/Events.jsx @@ -193,7 +193,8 @@ export const Events = () => { useEffect(() => { const applyFilters = (event) => { - if (filters.Theme && event?.filters?.Theme?.toLowerCase() !== filters.Theme?.toLowerCase()) { + const themeOptions = event.filters?.Theme?.split(',').map(opt => opt.trim().toLowerCase()) || []; + if (filters.Theme && !themeOptions.includes(filters.Theme?.toLowerCase())) { return false; } @@ -209,7 +210,8 @@ export const Events = () => { if (activeOptions.length === 0) return true; // Otherwise, check if the category value of the event is in the active options array: - return activeOptions.includes(event?.filters?.[category]) + const eventOptions = event.filters?.[category]?.split(',').map(opt => opt.trim()) || []; + return activeOptions.some(opt => eventOptions.includes(opt)); }); }; From a2f49b929ee151348e79ed2e2a3833b52f9639d4 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Thu, 12 Jun 2025 13:26:05 +0300 Subject: [PATCH 6/6] remove availability filter --- .../_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md | 1 - src/components/Events.jsx | 1 - 2 files changed, 2 deletions(-) diff --git a/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md b/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md index 708922f1fa6f..79221c5d8e20 100644 --- a/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md +++ b/content/_events/2024-09-05-Introduction-to-Quantum-Computing-2Ed.md @@ -11,7 +11,6 @@ tags: type: Event filters: Pricing: Free of charge # Free of charge, or empty if paid - Availability: Open to anyone # Open to anyone, Registration needed Skill level: Beginner # Beginner, Advanced Type: Online # Online, Hybrid, Onsite Theme: Course/Workshop # Course/Workshop, Hybrid QC+HPC computing, Programming, Webinar/Lecture diff --git a/src/components/Events.jsx b/src/components/Events.jsx index 594a28578e46..c9bc14dc0977 100644 --- a/src/components/Events.jsx +++ b/src/components/Events.jsx @@ -156,7 +156,6 @@ export const Events = () => { const events_dict = SplitEvents(); //get events const [isModalOpen, setIsModalOpen] = useState(false); //modal control const [filters, setFilters] = useState({ - "Availability": { "Open to anyone": false, "Registration needed": false }, "Skill level": { "Advanced": false, "Beginner": false }, "Pricing": { "Free of charge": false }, "Type": { "Online": false, "Hybrid": false, "Onsite": false },