MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / shouldRowBeVisible

Function shouldRowBeVisible

codeclash/viewer/static/js/picker.js:765–855  ·  view source on GitHub ↗
(row)

Source from the content-addressed store, hash-verified

763let selectedFolder = "";
764
765function shouldRowBeVisible(row) {
766 // Check folder filter (mandatory)
767 const folderFilter = document.getElementById("folder-filter")?.value;
768 if (folderFilter !== undefined) {
769 const rowParentFolder = row.getAttribute("data-parent-folder") || "";
770 if (rowParentFolder !== folderFilter) {
771 return false;
772 }
773 }
774
775 // Check name filter
776 const nameFilter =
777 document.getElementById("name-filter")?.value.toLowerCase() || "";
778 if (nameFilter) {
779 const sessionNameElement = row.querySelector(".game-name");
780 const sessionName = sessionNameElement
781 ? sessionNameElement.textContent.toLowerCase()
782 : "";
783 if (!sessionName.includes(nameFilter)) {
784 return false;
785 }
786 }
787
788 // Check game name filter
789 const gameFilter =
790 document.getElementById("game-filter")?.value.toLowerCase() || "";
791 if (gameFilter) {
792 const gameNameElement = row.querySelector(".game-name-text");
793 const gameName = gameNameElement
794 ? gameNameElement.textContent.toLowerCase()
795 : "";
796 if (!gameName.includes(gameFilter)) {
797 return false;
798 }
799 }
800
801 // Check rounds filter
802 const roundsFilter = document.getElementById("rounds-filter")?.value || "";
803 if (roundsFilter) {
804 const roundsElement = row.querySelector(".rounds-count");
805 if (roundsFilter === "complete") {
806 // Only show rows with complete rounds (no warning class)
807 if (
808 !roundsElement ||
809 roundsElement.classList.contains("rounds-count-warning")
810 ) {
811 return false;
812 }
813 } else if (roundsFilter === "incomplete") {
814 // Only show rows with incomplete rounds (has warning class) or unknown
815 if (
816 roundsElement &&
817 !roundsElement.classList.contains("rounds-count-warning")
818 ) {
819 return false;
820 }
821 }
822 }

Callers 1

applyFiltersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected