From 10c6dbc9b4c8b234bf54a7bfc99381bee9ff4958 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Thu, 31 Dec 2020 13:09:32 +0500 Subject: [PATCH] feat: add status bar --- apps/web/src/app.js | 72 ++++++++++--------- apps/web/src/components/editor/footer.js | 15 ++-- apps/web/src/components/editor/index.js | 2 - apps/web/src/components/status-bar/index.js | 76 +++++++++++++++++++++ apps/web/src/stores/user-store.js | 7 +- apps/web/src/theme/colorscheme/static.js | 1 + apps/web/src/theme/variants/button.js | 12 ++++ 7 files changed, 143 insertions(+), 42 deletions(-) create mode 100644 apps/web/src/components/status-bar/index.js diff --git a/apps/web/src/app.js b/apps/web/src/app.js index 215cc9054..265bac35c 100644 --- a/apps/web/src/app.js +++ b/apps/web/src/app.js @@ -23,6 +23,7 @@ import { showAccountDeletedNotice, showPasswordChangedNotice, } from "./components/dialogs/confirm"; +import StatusBar from "./components/statusbar"; function App() { const [show, setShow] = useState(true); @@ -104,39 +105,48 @@ function App() { return ( - - setShow(state || !show)} - /> - - - {isMobile && } - {routeResult} - - - + + + setShow(state || !show)} + /> + + + {isMobile && } + {routeResult} + + + + + + - - + ); diff --git a/apps/web/src/components/editor/footer.js b/apps/web/src/components/editor/footer.js index c8e10f261..179c8887b 100644 --- a/apps/web/src/components/editor/footer.js +++ b/apps/web/src/components/editor/footer.js @@ -3,24 +3,25 @@ import { Flex, Text } from "rebass"; import { useStore } from "../../stores/editor-store"; import { timeConverter } from "../../utils/time"; -function Footer() { +function EditorFooter() { const dateEdited = useStore((store) => store.session.dateEdited); const id = useStore((store) => store.session.id); const totalWords = useStore((store) => store.session.totalWords); const isSaving = useStore((store) => store.session.isSaving); + if (!id) return null; return ( - - - {id ? totalWords + " words" : "-"} + + + {totalWords + " words"} - {timeConverter(dateEdited) || "-"} + {timeConverter(dateEdited)} - {id ? (isSaving ? "Saving" : "Saved") : "-"} + {isSaving ? "Saving" : "Saved"} ); } -export default Footer; +export default EditorFooter; const TextSeperator = () => { return ( diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js index 648728c95..2423e06d1 100644 --- a/apps/web/src/components/editor/index.js +++ b/apps/web/src/components/editor/index.js @@ -19,7 +19,6 @@ import useMobile from "../../utils/use-mobile"; import useTablet from "../../utils/use-tablet"; import { SUBSCRIPTION_STATUS } from "../../common"; import Toolbar from "./toolbar"; -import Footer from "./footer"; import ObservableArray from "../../utils/observablearray"; import Banner from "../banner"; import EditorLoading from "./loading"; @@ -170,7 +169,6 @@ function Editor() { )} -