From 300aff743835dfd1c021609fd005819c8f2fd584 Mon Sep 17 00:00:00 2001
From: andrewdkim <adkim414@gmail.com>
Date: Wed, 7 Aug 2019 14:56:48 -0400
Subject: working timelinemenu

---
 .../views/animationtimeline/TimelineMenu.tsx       | 85 ++++++++++++++--------
 1 file changed, 54 insertions(+), 31 deletions(-)

(limited to 'src/client/views/animationtimeline/TimelineMenu.tsx')

diff --git a/src/client/views/animationtimeline/TimelineMenu.tsx b/src/client/views/animationtimeline/TimelineMenu.tsx
index 52f6f6535..8b47448f2 100644
--- a/src/client/views/animationtimeline/TimelineMenu.tsx
+++ b/src/client/views/animationtimeline/TimelineMenu.tsx
@@ -3,6 +3,10 @@ import {observable, action, runInAction} from "mobx";
 import {observer} from "mobx-react"; 
 import "./TimelineMenu.scss"; 
 import { jSXAttribute } from "babel-types";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faChartLine, faRoad, faClipboard, faPen, faTrash, faTable } from "@fortawesome/free-solid-svg-icons";
+import { AddComparisonResult } from "../../northstar/model/idea/idea";
+
 
 /**
  * TimelineMenu: 
@@ -38,8 +42,7 @@ export class TimelineMenu extends React.Component {
     @observable private _x = 0; 
     @observable private _y = 0; 
     @observable private _type: "timeline" | "keyframe" | "region" | "" = ""; 
-
-
+    @observable private _currentMenu:JSX.Element[] = []; 
     constructor (props:Readonly<{}>){
         super(props); 
         TimelineMenu.Instance = this; 
@@ -67,8 +70,7 @@ export class TimelineMenu extends React.Component {
     }
     
     @action
-    openMenu = (type: "timeline" | "keyframe" | "region", x?:number, y?:number) => {
-        this._type = type;
+    openMenu = (x?:number, y?:number) => {
         this._opacity = 1; 
         x ? this._x = x : this._x = 0; 
         y ? this._y = y : this._y = 0; 
@@ -88,41 +90,62 @@ export class TimelineMenu extends React.Component {
 
     }
 
+    addItem = (type: "input" | "button", title: string, event: (e:any) => void) => {
+        if (type === "input"){
+            let ref = React.createRef<HTMLInputElement>(); 
+            let text = ""; 
+            return <div className="timeline-menu-item"><FontAwesomeIcon icon={faClipboard} size="lg"/><input className="timeline-menu-input" ref = {ref} placeholder={title} onChange={(e) => {text = e.target.value;}} onKeyDown={(e:React.KeyboardEvent) => {
+                if(e.keyCode === 13){
+                    event(text); 
+                }}}/></div>; 
+        } else if (type === "button") {
+            let ref = React.createRef<HTMLDivElement>(); 
+            return <div className="timeline-menu-item"><FontAwesomeIcon icon={faChartLine}size="lg"/><p className="timeline-menu-desc" onClick={event}>{title}</p></div>; 
+        }
+        return <div></div>; 
+    }
 
+    @action 
+    addMenu = (title:string, items: JSX.Element[]) => {
+        items.unshift(<div className="timeline-menu-header"><p className="timeline-menu-header-desc">{title}</p></div>); 
+        this._currentMenu = items;  
+    }
 
     render() {
-        let menu: (JSX.Element[] | undefined);
-        switch(this._type){
-            case "keyframe": 
-                menu = [ 
-                    <button className="timeline-menu-button"> Show Schema</button>,  
-                    <button className="timeline-menu-button"> Delete Keyframe</button>,
-                    <input className="timeline-menu-input"placeholder="Move Keyframe"/> 
+        // let menu: (JSX.Element[] | undefined);
+        // switch(this._type){
+        //     case "keyframe": 
+        //         menu = [ 
+        //             <div className="timeline-menu-header"><p className="timeline-menu-header-desc">Keyframe</p></div>, 
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faTable} size="lg"/><p className="timeline-menu-desc">Show Data</p> </div>, 
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faTrash} size="lg"/><p className="timeline-menu-desc"> Delete</p></div>,
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faClipboard} size="lg"/><input className="timeline-menu-input"placeholder="Move Keyframe"/></div> 
                    
-                ]; 
-                break; 
-            case "region" :
-                menu = [
-                    <button className="timeline-menu-button" onClick={this.addEase}>Add Ease</button>,
-                    <button className="timeline-menu-button"onClick={this.addPath}>Add Path</button>,
-                    <input className="timeline-menu-input"placeholder="fadeIn"/>,
-                    <input className="timeline-menu-input"placeholder="fadeOut"/>,
-                    <input className="timeline-menu-input"placeholder="position"/>,
-                    <input className="timeline-menu-input"placeholder="duration"/>,
-                ]; 
-                break; 
-            case "timeline":
-                menu = [
+        //         ]; 
+        //         break; 
+        //     case "region" :
+        //         menu = [
+        //             <div className="timeline-menu-header"><p className="timeline-menu-header-desc">Region</p></div>, 
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faChartLine}size="lg"/><p className="timeline-menu-desc" onClick={this.addEase}>Add Ease</p></div>,
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faPen} size="lg"/><p className="timeline-menu-desc"onClick={this.addPath}>Add Path</p></div>,
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faClipboard} size="lg"/><input className="timeline-menu-input"placeholder="fadeIn"/> </div>,
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faClipboard} size="lg"/><input className="timeline-menu-input"placeholder="fadeOut"/></div>,
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faClipboard} size="lg"/><input className="timeline-menu-input"placeholder="position"/></div>,
+        //             <div className="timeline-menu-item"><FontAwesomeIcon icon={faClipboard} size="lg"/><input className="timeline-menu-input"placeholder="duration"/></div>,
+        //         ]; 
+        //         break; 
+        //     case "timeline":
+        //         menu = [
 
-                ]; 
-                break; 
-            default: 
-                break; 
+        //         ]; 
+        //         break; 
+        //     default: 
+        //         break; 
             
-        }
+        // }
         return (
             <div className="timeline-menu-container" style={{opacity: this._opacity, left: this._x, top: this._y}} >
-                {menu}
+                {this._currentMenu}
             </div>
         );
     }
-- 
cgit v1.2.3-70-g09d2

