From d9de5d5dc660d3c859590ece04fee5613621b56e Mon Sep 17 00:00:00 2001 From: madelinegr Date: Tue, 11 Jun 2019 16:34:53 -0400 Subject: techincally things are working but i think i have done some bad things --- src/client/views/search/IconBar.tsx | 185 +++++++++++++++++++----------------- 1 file changed, 100 insertions(+), 85 deletions(-) (limited to 'src') diff --git a/src/client/views/search/IconBar.tsx b/src/client/views/search/IconBar.tsx index 9a36e7cdf..3f5d11d8f 100644 --- a/src/client/views/search/IconBar.tsx +++ b/src/client/views/search/IconBar.tsx @@ -43,6 +43,13 @@ export class IconBar extends React.Component { @observable webRef = React.createRef(); @observable allRefs: React.RefObject[] = [this.colRef, this.imgRef, this.textRef, this.pdfRef, this.vidRef, this.audioRef, this.linkRef, this.histRef, this.webRef]; + @observable originalFilteredNodes: string[] = this.props.getIcons(); + + componentDidMount = () => { + //i KNOW this is bad i just can't get this to re render eeeeeeeek + this.forceUpdate(); + } + //gets ref associated with given string @action.bound getRef = (value: string) => { @@ -133,7 +140,7 @@ export class IconBar extends React.Component { //checks if option is selected based on the attribute data-selected @action.bound - isRefSelected(ref: React.RefObject) { + isRefSelected = (ref: React.RefObject) => { if (ref.current) { if (ref.current.getAttribute("data-selected") === "true") { return true; @@ -142,104 +149,112 @@ export class IconBar extends React.Component { } } - render() { + getInitialStatus = (type: string) => { + console.log(this.getRef(type)) + if (this.originalFilteredNodes.includes(type)) { + return "true" + } + return "false" + } + render() { + console.log("rendering") return ( -
-
Filter by type of node
-
-
-
{ this.onClick(DocTypes.NONE) }}> - -
-
Clear
+
+
Filter by type of node
+
+
+
{ this.onClick(DocTypes.NONE) }}> +
-
-
{ this.onClick(DocTypes.PDF) }}> - -
-
PDF
+
Clear
+
+
+
{ this.onClick(DocTypes.PDF) }}> +
-
-
{ this.onClick(DocTypes.HIST) }}> - -
-
Histogram
+
PDF
+
+
+
{ this.onClick(DocTypes.HIST) }}> +
-
-
{ this.onClick(DocTypes.COL) }}> - -
-
Collection
+
Histogram
+
+
+
{ this.onClick(DocTypes.COL) }}> +
-
-
{ this.onClick(DocTypes.IMG) }}> - -
-
Image
+
Collection
+
+
+
{ this.onClick(DocTypes.IMG) }}> +
-
-
{ this.onClick(DocTypes.VID) }}> - -
-
Video
+
Image
+
+
+
{ this.onClick(DocTypes.VID) }}> +
-
-
{ this.onClick(DocTypes.WEB) }}> - -
-
Web
+
Video
+
+
+
{ this.onClick(DocTypes.WEB) }}> +
-
-
{ this.onClick(DocTypes.LINK) }}> - -
-
Link
+
Web
+
+
+
{ this.onClick(DocTypes.LINK) }}> +
-
-
{ this.onClick(DocTypes.AUDIO) }}> - -
-
Audio
+
Link
+
+
+
{ this.onClick(DocTypes.AUDIO) }}> +
-
-
{ this.onClick(DocTypes.TEXT) }}> - -
-
Text
+
Audio
+
+
+
{ this.onClick(DocTypes.TEXT) }}> +
+
Text
+
) } } -- cgit v1.2.3-70-g09d2