aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/topbar
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/topbar')
-rw-r--r--src/client/views/topbar/TopBar.scss218
-rw-r--r--src/client/views/topbar/TopBar.tsx66
2 files changed, 284 insertions, 0 deletions
diff --git a/src/client/views/topbar/TopBar.scss b/src/client/views/topbar/TopBar.scss
new file mode 100644
index 000000000..d04ae8a80
--- /dev/null
+++ b/src/client/views/topbar/TopBar.scss
@@ -0,0 +1,218 @@
+@import "../global/globalCssVariables";
+
+.topbar-container {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ position: relative;
+ font-size: 10px;
+ line-height: 1;
+ overflow-y: auto;
+ overflow-x: visible;
+ background: $dark-gray;
+ overflow: visible;
+ z-index: 1000;
+
+ .topbar-bar {
+ height: $topbar-height;
+ display: grid;
+ grid-auto-columns: 33.3% 33.3% 33.3%;
+ align-items: center;
+ background-color: $dark-gray;
+
+ .topBar-icon {
+ cursor: pointer;
+ font-size: 12px;
+ font-family: 'Roboto';
+ width: fit-content;
+ display: flex;
+ justify-content: center;
+ gap: 4px;
+ align-items: center;
+ justify-self: center;
+ align-self: center;
+ border-radius: 5px;
+ padding: 5px;
+ transition: linear 0.1s;
+ color: $black;
+ background-color: $light-gray;
+ }
+
+ .topBar-icon:hover {
+ background-color: $light-blue;
+ }
+
+
+ .topbar-center {
+ grid-column: 2;
+ display: inline-flex;
+ justify-content: center;
+ align-items: center;
+ gap: 5px;
+
+ .topbar-dashboards {
+ display: flex;
+ flex-direction: row;
+ gap: 5px;
+ }
+
+ .topbar-lozenge-dashboard {
+ display: flex;
+
+
+
+ .topbar-dashSelect {
+ border: none;
+ background-color: $dark-gray;
+ color: $white;
+ font-family: 'Roboto';
+ font-size: 17;
+ font-weight: 500;
+
+ &:hover {
+ cursor: pointer;
+ }
+ }
+ }
+ }
+
+
+ .topbar-right {
+ grid-column: 3;
+ position: relative;
+ display: flex;
+ justify-content: flex-end;
+ gap: 5px;
+ margin-right: 5px;
+ }
+
+ .topbar-left {
+ grid-column: 1;
+ color: black;
+ font-family: 'Roboto';
+ position: relative;
+ display: flex;
+ width: fit-content;
+ gap: 5px;
+
+ .topBar-icon:hover {
+ background-color: $close-red;
+ }
+
+ .topbar-lozenge-user,
+ .topbar-lozenge {
+ height: 23;
+ font-size: 12;
+ color: white;
+ font-family: 'Roboto';
+ font-weight: 400;
+ padding: 4px;
+ align-self: center;
+ margin-left: 7px;
+ display: flex;
+ align-items: center;
+
+ .topbar-dashSelect {
+ border: none;
+ background-color: transparent;
+ color: black;
+ font-family: 'Roboto';
+ font-size: 17;
+ font-weight: 500;
+
+ &:hover {
+ cursor: pointer;
+ }
+ }
+ }
+
+ .topbar-logoff {
+ border-radius: 3px;
+ background: olivedrab;
+ color: white;
+ display: none;
+ margin-left: 5px;
+ padding: 1px 2px 1px 2px;
+ cursor: pointer;
+ }
+
+ .topbar-logoff {
+ background: red;
+ }
+
+ .topbar-lozenge-user:hover {
+ .topbar-logoff {
+ display: inline-block;
+ }
+ }
+ }
+
+ .topbar-barChild {
+
+ &.topbar-collection {
+ flex: 0 1 auto;
+ margin-left: 2px;
+ margin-right: 2px
+ }
+
+ &.topbar-input {
+ margin:5px;
+ border-radius:20px;
+ border:$dark-gray;
+ display: block;
+ width: 130px;
+ -webkit-transition: width 0.4s;
+ transition: width 0.4s;
+ /* align-self: stretch; */
+ outline: none;
+
+ &:focus {
+ width: 500px;
+ outline: none;
+ }
+ }
+
+ &.topbar-filter {
+ align-self: stretch;
+
+ button {
+ transform: none;
+
+ &:hover {
+ transform: none;
+ }
+ }
+ }
+
+ &.topbar-submit {
+ margin-left: 2px;
+ margin-right: 2px
+ }
+
+ &.topbar-close {
+ color: $white;
+ max-height: $topbar-height;
+ }
+ }
+ }
+}
+
+.topbar-results {
+ display: flex;
+ flex-direction: column;
+ top: 300px;
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ overflow: visible;
+
+ .no-result {
+ width: 500px;
+ background: $light-gray;
+ padding: 10px;
+ height: 50px;
+ text-transform: uppercase;
+ text-align: left;
+ font-weight: bold;
+ }
+} \ No newline at end of file
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx
new file mode 100644
index 000000000..05edb975c
--- /dev/null
+++ b/src/client/views/topbar/TopBar.tsx
@@ -0,0 +1,66 @@
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { observer } from "mobx-react";
+import * as React from 'react';
+import { Doc, DocListCast } from '../../../fields/Doc';
+import { Id } from '../../../fields/FieldSymbols';
+import { StrCast } from '../../../fields/Types';
+import { Utils } from '../../../Utils';
+import { CurrentUserUtils } from "../../util/CurrentUserUtils";
+import { SettingsManager } from "../../util/SettingsManager";
+import { undoBatch } from "../../util/UndoManager";
+import { Borders, Colors } from "../global/globalEnums";
+import "./TopBar.scss";
+
+/**
+ * ABOUT: This is the topbar in Dash, which included the current Dashboard as well as access to information on the user
+ * and settings and help buttons. Future scope for this bar is to include the collaborators that are on the same Dashboard.
+ */
+@observer
+export class TopBar extends React.Component {
+ render() {
+ const myDashboards = DocListCast(CurrentUserUtils.MyDashboards.data);
+ return (
+ //TODO:glr Add support for light / dark mode
+ <div style={{ pointerEvents: "all" }} className="topbar-container">
+ <div className="topbar-bar" style={{ background: Colors.DARK_GRAY, borderBottom: Borders.STANDARD }}>
+ <div className="topbar-left">
+ <div className="topbar-lozenge-user">
+ {`${Doc.CurrentUserEmail}`}
+ </div>
+ <div className="topbar-icon" onClick={() => window.location.assign(Utils.prepend("/logout"))}>
+ {"Sign out"}
+ </div>
+ </div>
+ <div className="topbar-center" >
+ <div className="topbar-lozenge-dashboard">
+ <select className="topbar-dashSelect" onChange={e => CurrentUserUtils.openDashboard(Doc.UserDoc(), myDashboards[Number(e.target.value)])}
+ value={myDashboards.indexOf(CurrentUserUtils.ActiveDashboard)}
+ style={{ color: Colors.WHITE }}>
+ {myDashboards.map((dash, i) => <option key={dash[Id]} value={i}> {StrCast(dash.title)} </option>)}
+ </select>
+ </div>
+ <div className="topbar-dashboards">
+ <div className="topbar-icon" onClick={undoBatch(() => CurrentUserUtils.createNewDashboard(Doc.UserDoc()))}
+ >
+ {"New"}<FontAwesomeIcon icon="plus"></FontAwesomeIcon>
+ </div>
+ {Doc.UserDoc().noviceMode ? (null) : <div className="topbar-icon" onClick={undoBatch(() => CurrentUserUtils.snapshotDashboard(Doc.UserDoc()))}
+ >
+ {"Snapshot"}<FontAwesomeIcon icon="camera"></FontAwesomeIcon>
+ </div>}
+ </div>
+ </div>
+ <div className="topbar-right" >
+ <div className="topbar-icon">
+ {"Help"}<FontAwesomeIcon icon="question-circle"></FontAwesomeIcon>
+ </div>
+ <div className="topbar-icon" onClick={() => SettingsManager.Instance.open()}>
+ {"Settings"}<FontAwesomeIcon icon="cog"></FontAwesomeIcon>
+ </div>
+
+ </div>
+ </div>
+ </div >
+ );
+ }
+} \ No newline at end of file