aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm/MarqueeOptionsMenu.tsx
blob: 0f51fe6ffdc19d9ff12f0504cde41be8a9d9a7c7 (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
import React = require('react');
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tooltip } from '@material-ui/core';
import { observer } from 'mobx-react';
import { unimplementedFunction } from '../../../../Utils';
import { AntimodeMenu, AntimodeMenuProps } from '../../AntimodeMenu';
import { IconButton } from 'browndash-components';
import { StrCast } from '../../../../fields/Types';
import { Doc } from '../../../../fields/Doc';
import { computed } from 'mobx';

@observer
export class MarqueeOptionsMenu extends AntimodeMenu<AntimodeMenuProps> {
    static Instance: MarqueeOptionsMenu;

    public createCollection: (e: KeyboardEvent | React.PointerEvent | undefined, group?: boolean) => void = unimplementedFunction;
    public delete: (e: KeyboardEvent | React.PointerEvent | undefined) => void = unimplementedFunction;
    public summarize: (e: KeyboardEvent | React.PointerEvent | undefined) => void = unimplementedFunction;
    public showMarquee: () => void = unimplementedFunction;
    public hideMarquee: () => void = unimplementedFunction;
    public pinWithView: (e: KeyboardEvent | React.PointerEvent | undefined) => void = unimplementedFunction;
    public isShown = () => this._opacity > 0;
    constructor(props: Readonly<{}>) {
        super(props);

        MarqueeOptionsMenu.Instance = this;
    }

    @computed get userColor() {
        return StrCast(Doc.UserDoc().userColor)
    }

    render() {
        const presPinWithViewIcon = <img src="/assets/pinWithView.png" style={{ width: 19 }} />;
        const buttons = (
            <>
                <IconButton 
                    tooltip={"Create a Collection"}
                    onPointerDown={this.createCollection}
                    icon={<FontAwesomeIcon icon="object-group"/>}
                    color={this.userColor}
                />
                <IconButton 
                    tooltip={"Create a Grouping"}
                    onPointerDown={e => this.createCollection(e, true)}
                    icon={<FontAwesomeIcon icon="layer-group"/>}
                    color={this.userColor}
                />
                <IconButton 
                    tooltip={"Summarize Documents"}
                    onPointerDown={this.summarize}
                    icon={<FontAwesomeIcon icon="compress-arrows-alt"/>}
                    color={this.userColor}
                />
                <IconButton 
                    tooltip={"Delete Documents"}
                    onPointerDown={this.delete}
                    icon={<FontAwesomeIcon icon="trash-alt"/>}
                    color={this.userColor}
                />
                <IconButton 
                    tooltip={"Pin selected region"}
                    onPointerDown={this.pinWithView}
                    icon={presPinWithViewIcon}
                    color={this.userColor}
                />
            </>
        );
        return this.getElement(buttons);
    }
}