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() {
)}
-
);
diff --git a/apps/web/src/components/status-bar/index.js b/apps/web/src/components/status-bar/index.js
new file mode 100644
index 000000000..b2ade3bc1
--- /dev/null
+++ b/apps/web/src/components/status-bar/index.js
@@ -0,0 +1,76 @@
+import React from "react";
+import { Button, Flex, Text } from "rebass";
+import EditorFooter from "../editor/footer";
+import * as Icon from "../icons";
+import { useStore as useUserStore } from "../../stores/user-store";
+import { showLogInDialog } from "../dialogs/logindialog";
+import TimeAgo from "timeago-react";
+import { navigate } from "raviger";
+
+function StatusBar() {
+ const user = useUserStore((state) => state.user);
+ const sync = useUserStore((state) => state.sync);
+ const lastSynced = useUserStore((state) => state.lastSynced);
+ const isLoggedIn = useUserStore((state) => state.isLoggedIn);
+ const isSyncing = useUserStore((state) => state.isSyncing);
+
+ return (
+
+ {isLoggedIn ? (
+
+
+
+
+ ) : (
+
+ )}
+
+
+ );
+}
+
+export default StatusBar;
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index 3e0a38695..9b32ac2dd 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -15,6 +15,7 @@ class UserStore extends BaseStore {
isSigningIn = false;
isSyncing = false;
user = undefined;
+ lastSynced = 0;
init = () => {
return db.user.getUser().then(async (user) => {
@@ -97,8 +98,10 @@ class UserStore extends BaseStore {
this.set((state) => (state.isSyncing = true));
return db
.sync(full)
- .then(() => {
- return appStore.refresh();
+ .then(async () => {
+ const lastSynced = await db.lastSynced();
+ this.set((state) => (state.lastSynced = lastSynced));
+ return await appStore.refresh();
})
.catch(async (err) => {
if (err.code === "MERGE_CONFLICT") await appStore.refresh();
diff --git a/apps/web/src/theme/colorscheme/static.js b/apps/web/src/theme/colorscheme/static.js
index 12fb4aeaa..563233193 100644
--- a/apps/web/src/theme/colorscheme/static.js
+++ b/apps/web/src/theme/colorscheme/static.js
@@ -11,6 +11,7 @@ class StaticColorSchemeFactory {
error: "#E53935",
errorBg: "#E5393520",
success: "#4F8A10",
+ warn: "#FF5722",
favorite: "#ffd700",
};
}
diff --git a/apps/web/src/theme/variants/button.js b/apps/web/src/theme/variants/button.js
index 11a1c9bf8..a3474b1bd 100644
--- a/apps/web/src/theme/variants/button.js
+++ b/apps/web/src/theme/variants/button.js
@@ -9,6 +9,7 @@ class ButtonFactory {
anchor: new Anchor(),
tool: new Tool(),
icon: new Icon(),
+ statusitem: new StatusItem(),
};
}
}
@@ -123,3 +124,14 @@ class Tool {
};
}
}
+
+class StatusItem {
+ constructor() {
+ return {
+ variant: "buttons.icon",
+ p: 0,
+ py: 1,
+ px: 1,
+ };
+ }
+}