aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search/IconBar.tsx
blob: 4741359d0bc35fa688bcbed66ace13cc208da5ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import * as React from 'react';
import { observer } from 'mobx-react';
import { observable, action, runInAction } from 'mobx';
import "./SearchBox.scss";
import "./IconBar.scss";
import * as anime from 'animejs';
import { DocTypes } from '../../documents/Documents';
import { faSearch, faFilePdf, faFilm, faImage, faObjectGroup, faStickyNote, faMusic, faLink, faChartBar, faGlobeAsia, faBan, faTimesCircle, faCheckCircle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { library, icon } from '@fortawesome/fontawesome-svg-core';
import * as _ from "lodash";
import $ from 'jquery';
import { array } from 'prop-types';
import { IconButton } from './IconButton';
import { list } from 'serializr';
import { SearchBox } from './SearchBox';

library.add(faSearch);
library.add(faObjectGroup);
library.add(faImage);
library.add(faStickyNote);
library.add(faFilePdf);
library.add(faFilm);
library.add(faMusic);
library.add(faLink);
library.add(faChartBar);
library.add(faGlobeAsia);
library.add(faBan);

@observer
export class IconBar extends React.Component {

    static Instance: IconBar;
    
    allIcons: string[] = [DocTypes.AUDIO, DocTypes.COL, DocTypes.HIST, DocTypes.IMG, DocTypes.LINK, DocTypes.PDF, DocTypes.TEXT, DocTypes.VID, DocTypes.WEB];
    @observable public ResetClicked: boolean = false;
    @observable public SelectAllClicked: boolean = false;
    public Reset: number = 0;
    public Select: number = 0;

    constructor(props: any) {
        super(props);
        IconBar.Instance = this;
    }

    @action.bound
    getList = (): string[] => {
        return SearchBox.Instance.getIcons();
    }

    @action.bound
    updateList(newList: string[]) {
        SearchBox.Instance.updateIcon(newList)
    }

    @action.bound
    resetSelf = () => {
        this.ResetClicked = true;
        this.updateList([]);
    }

    @action.bound
    selectAll = () => {
        this.SelectAllClicked = true;
        this.updateList(this.allIcons);
    }

    render() {
        return (
            <div>
                <div className="filter icon-title">Filter by type of node</div>
                <div className="filter icon-bar">
                <div className="filter type-outer">
                        <div className={"type-icon none not-selected"}
                            onClick={this.selectAll}>
                            <FontAwesomeIcon className="fontawesome-icon" icon={faCheckCircle} />
                        </div>
                        <div className="filter-description">Select All</div>
                    </div>
                    {this.allIcons.map((type: string) =>
                        <IconButton type={type}/>
                    )}
                    <div className="filter type-outer">
                        <div className={"type-icon none not-selected"}
                            onClick={this.resetSelf}>
                            <FontAwesomeIcon className="fontawesome-icon" icon={faTimesCircle} />
                        </div>
                        <div className="filter-description">Clear</div>
                    </div>
                </div>
            </div>
        );
    }
}