diff options
| author | kimdahey <claire_kim1@brown.edu> | 2019-11-03 17:07:18 -0500 |
|---|---|---|
| committer | kimdahey <claire_kim1@brown.edu> | 2019-11-03 17:07:18 -0500 |
| commit | b1e9619a4e04a9784d927c766361d734f549d6c5 (patch) | |
| tree | 36b875ccc0c45c3706d2533c4c28cc1492b38ce5 /src/client/views/MainViewNotifs.tsx | |
| parent | b2777f92b50f926357ad9b595c7907368b996fbd (diff) | |
| parent | 2786a2e4b33ff874f320697b89fecec3105df201 (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into webcam_mohammad
Diffstat (limited to 'src/client/views/MainViewNotifs.tsx')
| -rw-r--r-- | src/client/views/MainViewNotifs.tsx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/client/views/MainViewNotifs.tsx b/src/client/views/MainViewNotifs.tsx new file mode 100644 index 000000000..09fa1cb0c --- /dev/null +++ b/src/client/views/MainViewNotifs.tsx @@ -0,0 +1,32 @@ +import { action, computed, observable } from 'mobx'; +import { observer } from 'mobx-react'; +import "normalize.css"; +import * as React from 'react'; +import { Doc, DocListCast, Opt } from '../../new_fields/Doc'; +import { emptyFunction } from '../../Utils'; +import { SetupDrag } from '../util/DragManager'; +import "./MainViewNotifs.scss"; +import { CollectionDockingView } from './collections/CollectionDockingView'; + + +@observer +export class MainViewNotifs extends React.Component { + + @observable static NotifsCol: Opt<Doc>; + openNotifsCol = () => { + if (MainViewNotifs.NotifsCol) { + CollectionDockingView.AddRightSplit(MainViewNotifs.NotifsCol, undefined); + } + } + render() { + const length = MainViewNotifs.NotifsCol ? DocListCast(MainViewNotifs.NotifsCol.data).length : 0; + const notifsRef = React.createRef<HTMLDivElement>(); + const dragNotifs = action(() => MainViewNotifs.NotifsCol!); + return <div className="mainNotifs-container" ref={notifsRef}> + <button className="mainNotifs-badge" style={length > 0 ? { "display": "initial" } : { "display": "none" }} + onClick={this.openNotifsCol} onPointerDown={MainViewNotifs.NotifsCol ? SetupDrag(notifsRef, dragNotifs) : emptyFunction}> + {length} + </button> + </div>; + } +} |
