2021-01-02 22:24:07 +05:00
|
|
|
import React from "react";
|
2021-01-03 10:16:54 +05:00
|
|
|
import Vault from "../common/vault";
|
2021-01-02 22:24:07 +05:00
|
|
|
import {
|
|
|
|
|
showAddNotebookDialog,
|
|
|
|
|
showEditNotebookDialog,
|
|
|
|
|
} from "../components/dialogs/addnotebookdialog";
|
|
|
|
|
import { closeOpenedDialog } from "../components/dialogs/dialog";
|
|
|
|
|
import { showLogInDialog } from "../components/dialogs/logindialog";
|
2021-01-03 10:16:54 +05:00
|
|
|
import { showSignUpDialog } from "../components/dialogs/signupdialog";
|
2021-01-02 22:24:07 +05:00
|
|
|
import RouteContainer from "../components/route-container";
|
|
|
|
|
import SplitEditor from "../components/spliteditor";
|
|
|
|
|
import Unlock from "../components/unlock";
|
2021-01-03 10:16:54 +05:00
|
|
|
import { store as appStore } from "../stores/app-store";
|
2021-01-02 22:24:07 +05:00
|
|
|
import { store as editorStore } from "../stores/editor-store";
|
|
|
|
|
import { store as noteStore } from "../stores/note-store";
|
|
|
|
|
import { isMobile } from "../utils/dimensions";
|
|
|
|
|
|
|
|
|
|
const hashroutes = {
|
|
|
|
|
"/": () => {
|
|
|
|
|
closeOpenedDialog();
|
|
|
|
|
},
|
|
|
|
|
"/notebooks/create": () => {
|
|
|
|
|
showAddNotebookDialog();
|
|
|
|
|
},
|
|
|
|
|
"/notebooks/:notebookId/edit": ({ notebookId }) => {
|
|
|
|
|
showEditNotebookDialog(notebookId);
|
|
|
|
|
},
|
|
|
|
|
"/notes/:noteId/edit": ({ noteId }) => {
|
|
|
|
|
editorStore.openSession(noteId);
|
|
|
|
|
},
|
|
|
|
|
"/notes/:noteId/unlock": ({ noteId }) => {
|
|
|
|
|
return (
|
|
|
|
|
<RouteContainer
|
|
|
|
|
onlyBackButton={isMobile()}
|
|
|
|
|
route={<Unlock noteId={noteId} />}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
"/notes/:noteId/conflict": ({ noteId }) => {
|
|
|
|
|
return <SplitEditor noteId={noteId} />;
|
|
|
|
|
},
|
|
|
|
|
"/notes/create": () => {
|
|
|
|
|
editorStore.newSession(noteStore.get().context);
|
|
|
|
|
},
|
2021-01-03 10:16:54 +05:00
|
|
|
"/signup": () => {
|
|
|
|
|
showSignUpDialog();
|
|
|
|
|
},
|
|
|
|
|
"/vault/changePassword": () => {
|
|
|
|
|
Vault.changeVaultPassword();
|
|
|
|
|
},
|
|
|
|
|
"/vault/create": () => {
|
|
|
|
|
Vault.createVault().then((res) => {
|
|
|
|
|
appStore.setIsVaultCreated(res);
|
|
|
|
|
});
|
|
|
|
|
},
|
2021-01-02 22:24:07 +05:00
|
|
|
"/login": () => {
|
|
|
|
|
showLogInDialog();
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default hashroutes;
|