Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,10 @@ 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
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.

16 changes: 3 additions & 13 deletions content/_publications/2024-08-29-Topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when

  1. Someone misspells the skill level e.g "Beginer" instead of "Beginer" or if a person uses lowercase "beginner"?
  2. What happens if they use 2 values "Beginner, Advanced" ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Case does not matter. Otherwise misspelled category will just result to the event/blog not showing up in any category
  2. I think rn that would count as misspelled but maybe it would be smarter to allow for multiple values and have the blog / event show up under both. Not a big change so I'll try to get to it this week

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.*
Expand Down
20 changes: 2 additions & 18 deletions content/site.js.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
}
Expand All @@ -42,15 +34,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 %}
}
Expand Down
22 changes: 12 additions & 10 deletions src/components/Blogs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ const FilterModal = ({ isModalOpen, setIsModalOpen, filters, handleFilterChange
return (
<CModal
key={isModalOpen ? 'open' : 'closed'}
style={{ overflow: 'scroll' }}
className='overflow-scroll'
className=''
value={isModalOpen}
dismissable
onChangeValue={event => setIsModalOpen(event.detail)}
Expand Down Expand Up @@ -165,24 +164,27 @@ export const Blogs = () => {
};
}, [isModalOpen]);

useEffect(() => { //set filteredBlogs everytime filters changes
useEffect(() => {
const applyFilters = (blog) => {
if (filters.Theme && blog?.filters?.Theme !== filters.Theme) {
const themeOptions = blog.filters?.Theme?.split(',').map(opt => opt.trim().toLowerCase()) || [];
if (filters.Theme && !themeOptions.includes(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:
const blogOptions = blog.filters?.[category]?.split(',').map(opt => opt.trim()) || [];
return activeOptions.some(opt => blogOptions.includes(opt));
});
};

Expand Down
21 changes: 10 additions & 11 deletions src/components/Events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ const FilterModal = ({ isModalOpen, setIsModalOpen, filters, handleFilterChange
return (
<CModal
key={isModalOpen ? 'open' : 'closed'}
style={{ 'overflow': 'scroll' }}
className='overflow-scroll'
value={isModalOpen}
dismissable
onChangeValue={event => setIsModalOpen(event.detail)}
Expand Down Expand Up @@ -158,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 },
Expand Down Expand Up @@ -192,26 +189,28 @@ 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 !== filters.Theme) {

const themeOptions = event.filters?.Theme?.split(',').map(opt => opt.trim().toLowerCase()) || [];
if (filters.Theme && !themeOptions.includes(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 (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:
const eventOptions = event.filters?.[category]?.split(',').map(opt => opt.trim()) || [];
return activeOptions.some(opt => eventOptions.includes(opt));
});
};

Expand Down
Loading