From 2fcad5e8bd1412487b4fcacefdc12a2df5707638 Mon Sep 17 00:00:00 2001
From: eperelm2 <emily_perelman@brown.edu>
Date: Thu, 24 Aug 2023 20:12:24 +0200
Subject: filter - trying to pull

---
 src/client/views/FilterPanel.tsx | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

(limited to 'src/client/views/FilterPanel.tsx')

diff --git a/src/client/views/FilterPanel.tsx b/src/client/views/FilterPanel.tsx
index 1a923a995..93f4cf818 100644
--- a/src/client/views/FilterPanel.tsx
+++ b/src/client/views/FilterPanel.tsx
@@ -15,7 +15,8 @@ import { AiOutlineMinusSquare, AiOutlinePlusSquare } from 'react-icons/ai';
 import { CiCircleRemove } from 'react-icons/ci';
 import { Slider, Rail, Handles, Tracks, Ticks } from 'react-compound-slider';
 import { TooltipRail, Handle, Tick, Track } from './nodes/SliderBox-components';
-import { DocumentOptions } from '../documents/Documents';
+import { DocumentOptions, FInfo } from '../documents/Documents';
+import { string32 } from 'pdfjs-dist/types/src/shared/util';
 
 //slight bug when you don't click on background canvas before creating filter and the you click on the canvas
 
@@ -28,6 +29,8 @@ interface filterProps {
 
 @observer
 export class FilterPanel extends React.Component<filterProps> {
+    private _documentOptions: DocumentOptions = new DocumentOptions();
+
     public static LayoutString(fieldKey: string) {
         return FieldView.LayoutString(FilterPanel, fieldKey);
     }
@@ -262,12 +265,21 @@ export class FilterPanel extends React.Component<filterProps> {
     render() {
         // console.log('this is frist one today ' + this._allFacets);
         this._allFacets.forEach(element => console.log(element));
-        const options = this._allFacets.filter(facet => this.activeFacetHeaders.indexOf(facet) === -1).map(facet => ({ value: facet, label: facet }));
+        // const options = Object.entries(this._documentOptions).forEach((pair: [string, FInfo]) => pair[1].filterable ).map(facet => value: facet, label: facet) //this._allFacets.filter(facet => this.activeFacetHeaders.indexOf(facet) === -1).map(facet => ({ value: facet, label: facet }));
         // console.log('HEELLLLLL ' + DocumentOptions);
 
-        const freeformOptions: DocumentOptions = {};
+        let filteredOptions: string[] = ['author', 'tags', 'text', 'acl-Guest'];
+
+        Object.entries(this._documentOptions).forEach((pair: [string, FInfo]) => {
+            if (pair[1].filterable) {
+                filteredOptions.push(pair[0]);
+                console.log('THIS IS FILTERABLE ALKDJFIIEII' + filteredOptions);
+            }
+        });
+
+        let options = filteredOptions.map(facet => ({ value: facet, label: facet }));
 
-        console.log('wht is this ' + freeformOptions.author);
+        //  Object.entries(this._documentOptions).forEach((pair: [string, FInfo]) => console.log('this is first piar ' + pair[0] + ' this is second piar ' + pair[1].filterable));
 
         return (
             <div className="filterBox-treeView">
@@ -373,13 +385,21 @@ export class FilterPanel extends React.Component<filterProps> {
 
             case 'range':
                 const domain = renderInfoDomain;
+                const range = renderInfoRange;
+
+                if (range) {
+                    console.log('this is info range ' + range[0] + ' , ' + range[1]);
+                }
+
                 if (domain) {
+                    console.log('this is info domain ' + domain[0] + ', ' + domain[1]);
+
                     return (
                         <div className="sliderBox-outerDiv" style={{ width: '95%', height: 45 }}>
                             <Slider
                                 mode={2}
                                 step={Math.min(1, 0.1 * (domain[1] - domain[0]))}
-                                domain={[-1000, 1000]}
+                                domain={[domain[0], domain[1]]} // -1000, 1000
                                 rootStyle={{ position: 'relative', width: '100%' }}
                                 onChange={values => Doc.setDocRangeFilter(this.targetDoc, facetHeader, values)}
                                 values={renderInfoRange!}>
-- 
cgit v1.2.3-70-g09d2

