From 1cfb1a289ceeba5581e7f82aa593029c10a474c3 Mon Sep 17 00:00:00 2001 From: Eshan Iyer Date: Mon, 29 Jun 2026 15:05:05 -0400 Subject: [PATCH] Remove dead NestedCheckBox files and a stray debug log - Delete unused duplicate NestedCheckBox files (copy/dimension variants) - Remove a leftover console.log in OrganCheckbox --- .../NestedCheckBox/NestedCheckBox copy.css | 57 ------ .../NestedCheckBox/NestedCheckBox copy.jsx | 130 ------------- .../NestedCheckBox2_dimension.jsx | 182 ------------------ ...Box2\342\200\224\342\200\224dimension.css" | 85 -------- PanTS-Demo/src/components/OrganCheckbox.tsx | 1 - 5 files changed, 455 deletions(-) delete mode 100644 PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.css delete mode 100644 PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.jsx delete mode 100644 PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2_dimension.jsx delete mode 100644 "PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2\342\200\224\342\200\224dimension.css" diff --git a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.css b/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.css deleted file mode 100644 index 90cb75a..0000000 --- a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.css +++ /dev/null @@ -1,57 +0,0 @@ -.checkbox-grid { - display: flex; - flex-wrap: wrap; - gap: 10px; - padding: 5px; -} - -.organ-chip { - position: relative; - display: flex; - align-items: center; - justify-content: center; - padding: 5px 10px; - border-radius: 5px; - font-size: 14px; - color: white; - cursor: pointer; -} - -.chip-close { - position: absolute; - top: -6px; - right: -6px; - background: white; - color: black; - font-weight: bold; - border-radius: 50%; - width: 16px; - height: 16px; - font-size: 12px; - line-height: 16px; - text-align: center; - cursor: pointer; - box-shadow: 0 0 2px rgba(0,0,0,0.5); -} - -.divider-line { - width: 100%; - height: 1px; - background-color: #ccc; - margin: 8px 0; - } - - - - .suggestion-bar { - position: absolute; - top: 100%; - left: 0; - width: 100%; - max-height: 200px; - overflow-y: auto; - background-color: white; - z-index: 10; - border: 1px solid #ccc; - } - diff --git a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.jsx b/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.jsx deleted file mode 100644 index 0cf11f2..0000000 --- a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox copy.jsx +++ /dev/null @@ -1,130 +0,0 @@ -import { APP_CONSTANTS } from '../../helpers/constants'; -import './NestedCheckBox.css'; -import React, { useEffect, useState } from 'react'; - -function ChipBox({ itemData, checkStateProp, update, rgbaVals }) { - const isChecked = checkStateProp[itemData.id]; - const label = itemData.label; - const backgroundColor = `rgba(${rgbaVals.slice(0, 3).join(',')}, 0.8)`; - - return ( -
- {label} - {isChecked ? ( -
update(itemData.id, false)}>×
- ) : ( -
update(itemData.id, true)}>īŧ‹
- )} -
- ); -} - -function NestedCheckBox({ checkBoxData, checkState, update, innerRef, sessionId }) { - const [searchText, setSearchText] = useState(""); - const [showSuggestions, setShowSuggestions] = useState(false); - const [labelColorMap, setLabelColorMap] = useState({}); - const cacheKey = `labelColorMap_${sessionId}`; - - // Load color map from backend or sessionStorage - const fetchColorMap = async (forceReload = false) => { - try { - if (!forceReload) { - const cached = sessionStorage.getItem(cacheKey); - if (cached) { - setLabelColorMap(JSON.parse(cached)); - return; - } - } - - const response = await fetch(`${APP_CONSTANTS.API_ORIGIN}/api/get-label-colormap/${sessionId}`); - const lut = await response.json(); - const parsedMap = {}; - - for (const labelId in lut) { - const color = lut[labelId]; - if (color && color.R !== undefined) { - parsedMap[labelId] = [ - color.R, - color.G, - color.B, - color.A ?? 255 - ]; - console.log(`🎨 Label ${labelId} color: R=${color.R}, G=${color.G}, B=${color.B}, A=${color.A ?? 255}`); - } - } - - sessionStorage.setItem(cacheKey, JSON.stringify(parsedMap)); - setLabelColorMap(parsedMap); - } catch (err) { - console.warn("❗ Failed to fetch colormap:", err); - } - }; - - useEffect(() => { - fetchColorMap(); - }, [sessionId]); - - const handleRefreshColorMap = () => { - sessionStorage.removeItem(cacheKey); - fetchColorMap(true); - }; - - const normalizedSearch = searchText.trim().toLowerCase(); - - const unselectedItems = checkBoxData.filter(item => !checkState[item.id]); - const selectedItems = checkBoxData.filter(item => !!checkState[item.id]); - - const filteredUnselectedItems = unselectedItems.filter(item => - normalizedSearch === "" ? true : item.label.toLowerCase().includes(normalizedSearch) - ); - - return ( -
-
- setSearchText(e.target.value)} - onFocus={() => setShowSuggestions(true)} - onBlur={() => setTimeout(() => setShowSuggestions(false), 200)} - className="search-box" - /> - - - {showSuggestions && ( -
- {filteredUnselectedItems.map(item => ( - - ))} -
- )} -
- -
- {selectedItems.length > 0 && ( - <> -
- {selectedItems.map(item => ( - - ))} - - )} -
-
- ); -} - -export default NestedCheckBox; diff --git a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2_dimension.jsx b/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2_dimension.jsx deleted file mode 100644 index d1e333f..0000000 --- a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2_dimension.jsx +++ /dev/null @@ -1,182 +0,0 @@ -import { APP_CONSTANTS } from '../../helpers/constants'; -import './NestedCheckBox.css'; -import React, { useEffect, useRef, useState } from 'react'; - -function ChipBox({ itemData, checkStateProp, update, rgbaVals, onAdd }) { - const isChecked = checkStateProp[itemData.id]; - const label = itemData.label; - const colorRGB = `rgba(${rgbaVals.slice(0, 3).join(',')}, 1)`; - - return ( -
-
- {label} - {isChecked ? ( -
update(itemData.id, false)}>×
- ) : ( -
{ - e.stopPropagation(); - onAdd(itemData); - }}>īŧ‹
- )} -
- ); -} - -function NestedCheckBox({ checkBoxData, checkState, update, innerRef, sessionId }) { - const [searchText, setSearchText] = useState(""); - const [showSuggestionsOnly, setShowSuggestionsOnly] = useState(true); - const [showBackButton, setShowBackButton] = useState(true); - const [labelColorMap, setLabelColorMap] = useState({}); - const cacheKey = `labelColorMap_${sessionId}`; - - const inputRef = useRef(null); - const suggestionRef = useRef(null); - - const fetchColorMap = async (forceReload = false) => { - try { - if (!forceReload) { - const cached = sessionStorage.getItem(cacheKey); - if (cached) { - setLabelColorMap(JSON.parse(cached)); - return; - } - } - - const response = await fetch(`${APP_CONSTANTS.API_ORIGIN}/api/get-label-colormap/${sessionId}`); - const lut = await response.json(); - const parsedMap = {}; - - for (const labelId in lut) { - const color = lut[labelId]; - if (color && color.R !== undefined) { - parsedMap[labelId] = [color.R, color.G, color.B, color.A ?? 255]; - } - } - - sessionStorage.setItem(cacheKey, JSON.stringify(parsedMap)); - setLabelColorMap(parsedMap); - } catch (err) { - console.warn("❗ Failed to fetch colormap:", err); - } - }; - - useEffect(() => { - fetchColorMap(); - }, [sessionId]); - - const handleAddImmediate = (item) => { - update(item.id, true); - }; - - const normalizedSearch = searchText.trim().toLowerCase(); - const unselectedItems = checkBoxData.filter(item => !checkState[item.id]); - const selectedItems = checkBoxData.filter(item => !!checkState[item.id]); - - const filteredUnselectedItems = unselectedItems.filter(item => - normalizedSearch === "" ? true : item.label.toLowerCase().includes(normalizedSearch) - ); - - const handleFocusSearch = () => { - setShowSuggestionsOnly(true); - setShowBackButton(true); - }; - - const handleBackClick = () => { - setShowSuggestionsOnly(false); - setShowBackButton(false); - }; - - return ( -
- {/* Top fixed search area */} -
-
- setSearchText(e.target.value)} - onFocus={handleFocusSearch} - className="search-box" - ref={inputRef} - /> - {showBackButton && ( - - )} -
-
- - {/* Scrollable organ list */} -
- {showSuggestionsOnly ? ( -
- {filteredUnselectedItems.map(item => ( - - ))} - {filteredUnselectedItems.length === 0 && ( -
- ✅ All organs are already added and displayed. -
- )} -
- ) : ( - selectedItems.length > 0 && ( -
-
- â„šī¸ Click × to remove organs from view. -
-
- {selectedItems.map(item => ( - {}} - rgbaVals={labelColorMap[item.id] || [150, 150, 150, 255]} - /> - ))} -
- ) - )} -
-
- ); -} - -export default NestedCheckBox; diff --git "a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2\342\200\224\342\200\224dimension.css" "b/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2\342\200\224\342\200\224dimension.css" deleted file mode 100644 index e178c99..0000000 --- "a/PanTS-Demo/src/components/NestedCheckBox/NestedCheckBox2\342\200\224\342\200\224dimension.css" +++ /dev/null @@ -1,85 +0,0 @@ -.checkbox-grid { - display: flex; - flex-wrap: wrap; - gap: 10px; - padding: 5px; - } - - .divider-line { - width: 100%; - height: 1px; - background-color: rgba(255, 255, 255, 0.3); - margin: 8px 0; - } - - .suggestion-bar { - position: absolute; - top: 100%; - left: 0; - width: 100%; - max-height: 200px; - overflow-y: auto; - background-color: #030a1e; - z-index: 10; - border: 1px solid rgba(255, 255, 255, 0.3); - color: #fff; - } - - .organ-chip { - position: relative; - background-color: #030a1e; - color: #fff; - display: flex; - align-items: center; - padding: 4px 8px; - border: 2px solid rgba(255, 255, 255, 0.5); - border-radius: 16px; - margin: 4px; - gap: 6px; - min-height: 32px; - } - - .organ-dot { - width: 10px; - height: 10px; - border-radius: 50%; - } - - .organ-label { - font-size: 0.95rem; - flex-grow: 1; - } - - .chip-button { - position: absolute; - top: -6px; - right: -6px; - background-color: #030a1e; - color: white; - border: 1px solid rgba(255, 255, 255, 0.5); - border-radius: 50%; - width: 20px; - height: 20px; - font-size: 14px; - text-align: center; - line-height: 18px; - cursor: pointer; - z-index: 10; - transition: background-color 0.2s; - } - - .chip-button:hover { - background-color: rgba(255, 255, 255, 0.1); - } - - .selected_checkbox-scroll-box { - max-height: 50vh; - overflow-y: auto; - padding: 5px; - background-color: #030a1e; - border-radius: 12px; - margin: 2px; - color: #fff; - border: 1px solid rgba(255, 255, 255, 0.3); - } - \ No newline at end of file diff --git a/PanTS-Demo/src/components/OrganCheckbox.tsx b/PanTS-Demo/src/components/OrganCheckbox.tsx index d66ac67..e1bb065 100644 --- a/PanTS-Demo/src/components/OrganCheckbox.tsx +++ b/PanTS-Demo/src/components/OrganCheckbox.tsx @@ -61,7 +61,6 @@ function Checked({ OrganSystem[system].forEach((sub) => { if (typeof sub === "string") { newCheckState[getOrganIdx(sub) + 1] = toggled; - console.log(toggled); return; } const key: SubSystems = Object.keys(sub)[0] as SubSystems;