From 0400497f05aceeb6fa40bed52bbd7c827fe08b4b Mon Sep 17 00:00:00 2001 From: TetraTsunami <78718829+TetraTsunami@users.noreply.github.com> Date: Sun, 17 Nov 2024 15:25:37 -0600 Subject: [PATCH] [refactor] Remove unused file --- src/components/controls/TagControl.tsx | 133 ------------------------- 1 file changed, 133 deletions(-) delete mode 100644 src/components/controls/TagControl.tsx diff --git a/src/components/controls/TagControl.tsx b/src/components/controls/TagControl.tsx deleted file mode 100644 index 22e0e21..0000000 --- a/src/components/controls/TagControl.tsx +++ /dev/null @@ -1,133 +0,0 @@ -// import { useEffect, useRef, useState } from 'react' - -// import Control from 'react-leaflet-custom-control' -// import L from 'leaflet' -// import { Stakeholder } from 'types' - -// interface TagControlProps { -// // A reference to a LayerGroup in leaflet -// layerRef: React.MutableRefObject -// stakeholders: Stakeholder[] -// } - -// const TagControl: React.FC = ({ layerRef, stakeholders }) => { -// const [isDropdownVisible, setDropdownVisible] = useState(false) -// const dropdownRef = useRef(null) -// const [tags, setTags] = useState([]) -// const [selectedTags, setSelectedTags] = useState([]) -// // must remove marker because setting layer opacity/interactivity does not prevent onclick -// const [removedMarkers, setRemovedMarkers] = useState([]) - -// useEffect(() => { -// const allTags = [...new Set(stakeholders.map((s) => s.tags).flat())] -// setTags(allTags) -// setSelectedTags(allTags) -// }, [stakeholders]) - -// useEffect(() => { -// if (layerRef.current) { -// // names of all stakeholders with at least one tag in selectedTags -// const viewableStakeholderNames = stakeholders.filter((s) => s.tags.some((t) => selectedTags.includes(t))).map((s) => s.name) - -// // add all previously removed markers -// removedMarkers.forEach((m) => m.addTo(layerRef.current)) - -// // get new list of removed markers -// let markersToRemove: L.Marker[] = [] -// layerRef.current.eachLayer((layer: any) => { -// if (layer instanceof L.Marker && layer.options.title != undefined) { -// if (!viewableStakeholderNames.includes(layer.options.title)) { -// markersToRemove.push(layer) -// } -// } -// }) - -// // remove markers -// markersToRemove.forEach((m) => layerRef.current.removeLayer(m)) -// setRemovedMarkers(markersToRemove) -// } -// }, [selectedTags]) - -// const handleClickOutside = (event: MouseEvent) => { -// if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) { -// setDropdownVisible(false) -// } -// } - -// useEffect(() => { -// document.addEventListener('mousedown', handleClickOutside) -// return () => { -// document.removeEventListener('mousedown', handleClickOutside) -// } -// }, []) - -// const handleCheckboxChange = (tag: string) => { -// if (selectedTags.includes(tag)) { -// setSelectedTags(selectedTags.filter((item) => item !== tag)) -// } else { -// setSelectedTags([...selectedTags, tag]) -// } -// } - -// return ( -// -//
-// { -// setDropdownVisible(!isDropdownVisible) -// e.preventDefault() -// }} -// > -// {/* ☰ */} -// ☰ -// -// {isDropdownVisible && ( -//
-//
-//
Tags
-//
-// -// { -// setSelectedTags(selectedTags.length === tags.length ? [] : tags) -// }} -// /> -//
-//
-//
-// {tags.map((tag, idx) => ( -//
-// -// {/* Render separator below all except for last */} -// {idx !== tags.length - 1 &&
} -//
-// ))} -//
-//
-// )} -//
-//
-// ) -// } - -// export default TagControl