Filter and hide text for FAQ

@jonatandor35

How does the code link the tags to the categories in the table?
I still does not work :s

import wixAnimations from 'wix-animations';
import wixData from 'wix-data';
const ACTIVE_COLOR = '#207272';

const DEFAULT_COLOR = '#001E1E';

//$w.onReady(function () {


//});



function initFAQrepeater() {
   $w('#FAQrepeater' ).forEachItem(( $item, itemData, index) => {

      $item('#FAQbutton').onClick(() => {
         openRelevantContent(index);


      });
   });

}

function openRelevantContent(targetIndex) {

   $w('#FAQrepeater').forEachItem(($item, itemData, index) => {
      const contentBox = $item('#FAQcontent');
     const button = $item('#FAQbutton');
     const arrow = $item('#FAQarrow');


      if (targetIndex === index) {

        contentBox.collapsed ? expandFAQcontent(contentBox, button, arrow) : collapseFAQcontent(contentBox, button, arrow);
      } else {
         collapseFAQcontent(contentBox, button, arrow);

      }

   });

}

function expandFAQcontent(contentBox, button, arrow) {
   contentBox.expand();
   button.style.color= ACTIVE_COLOR;
    
   wixAnimations.timeline()

      .add(arrow, { rotate: 270, duration: 300 })

      .play();
}

function collapseFAQcontent(contentBox, button, arrow) {
   contentBox.collapse();
   button.style.color= DEFAULT_COLOR;
   wixAnimations.timeline()

      .add(arrow, { rotate: 90, duration: 300 })

      .play();
}

/**
 * Adds an event handler that runs when the dataset is ready.
 */
export function FAQdataset_ready() {
   initFAQrepeater()
   // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
   // Add your code for this event here: 
}

$w.onReady(function () {
$w('#TagUser').onChange(event => {
let value = event.target.value;
if(value.length){
value = value.reverse()[0];//here you keep only the value f the last selection.
event.target.value = [value];//here you update the selection tags value
}
//then run the filter with the value by calling the runFilter() function
})

function runFilter(){
let filter = wixData.filter();
const userType = $w('#TagUser').value;
if(userType.length){
filter = filter.eq('userType', userType[0]);

const category = $w('#TagCategory').value;
if(category.length){
filter = filter.hasSome('userType', category )
}
$w('#FAQdataset').setFilter(filter);
}}})