2022-10-17 13:50:40 +03:00
|
|
|
import "./App.css";
|
|
|
|
import { Routes, Route } from "react-router-dom";
|
|
|
|
import Menu from "./components/menu";
|
|
|
|
import CreateNote from "./pages/create";
|
2022-10-20 17:55:09 +03:00
|
|
|
import Save from "./pages/save-local";
|
2022-10-31 18:31:16 +03:00
|
|
|
import Publish from "./pages/publish";
|
2023-04-03 15:23:41 +03:00
|
|
|
import NotePage from "./pages/note";
|
2022-10-20 21:37:09 +03:00
|
|
|
import Notes from "./pages/notes";
|
2022-11-01 20:29:32 +03:00
|
|
|
import PubNote from "./pages/pubNote";
|
|
|
|
import PubError from "./pages/pubError";
|
2023-01-21 16:59:44 +03:00
|
|
|
import PubNoteSafe from "./pages/pubNoteSafe";
|
2023-04-01 20:57:46 +03:00
|
|
|
import RenderMarkdown from "./components/markdown";
|
2023-04-03 15:23:41 +03:00
|
|
|
import socket from "./components/socket";
|
2023-04-03 17:03:01 +03:00
|
|
|
import Settings from "./pages/settings";
|
2023-04-04 16:50:11 +03:00
|
|
|
import Chat from "./pages/chat";
|
2023-04-04 15:15:15 +03:00
|
|
|
import Locales from "./localisation/main";
|
|
|
|
import { useState } from "react";
|
2022-10-17 13:50:40 +03:00
|
|
|
|
|
|
|
function App() {
|
2022-10-18 18:32:25 +03:00
|
|
|
Storage.prototype.setObj = function (key, obj) {
|
|
|
|
return this.setItem(key, JSON.stringify(obj));
|
|
|
|
};
|
|
|
|
Storage.prototype.getObj = function (key) {
|
2022-10-20 17:55:09 +03:00
|
|
|
return JSON.parse(this.getItem(key)) || {};
|
2022-10-18 18:32:25 +03:00
|
|
|
};
|
2022-10-31 18:31:16 +03:00
|
|
|
|
2023-04-04 15:15:15 +03:00
|
|
|
const [key, setKey] = useState(Math.random());
|
|
|
|
|
2023-04-03 17:03:01 +03:00
|
|
|
window.settings = localStorage.getObj("settings") || {};
|
2023-04-04 15:15:15 +03:00
|
|
|
window.locals =
|
|
|
|
Locales[window.settings.language] ||
|
|
|
|
Locales[navigator.language] ||
|
|
|
|
Locales[navigator.userLanguage] ||
|
|
|
|
Locales.en;
|
|
|
|
|
|
|
|
window.addEventListener("reRenderPage", () => {
|
|
|
|
setKey(Math.random());
|
|
|
|
});
|
2023-04-03 17:03:01 +03:00
|
|
|
|
2022-10-17 13:50:40 +03:00
|
|
|
return (
|
2023-04-04 15:15:15 +03:00
|
|
|
<div
|
|
|
|
className="grid grid-cols-4 lg:grid-cols-5 gap-10 text-black dark:text-white"
|
|
|
|
key={key}
|
|
|
|
>
|
2022-10-17 13:50:40 +03:00
|
|
|
<Menu />
|
|
|
|
<div className="col-span-4 p-5 m-4 rounded-2xl">
|
|
|
|
<Routes>
|
|
|
|
<Route path="/" element={<CreateNote />} />
|
2022-10-20 17:55:09 +03:00
|
|
|
<Route path="/notes/save-local" element={<Save />} />
|
2022-10-31 18:31:16 +03:00
|
|
|
<Route path="/notes/publish" element={<Publish />} />
|
2023-04-03 15:23:41 +03:00
|
|
|
<Route path="/notes/:id" element={<NotePage />} />
|
2022-11-01 20:29:32 +03:00
|
|
|
<Route path="/pubNotes/:id" element={<PubNote />} />
|
2023-01-21 16:59:44 +03:00
|
|
|
<Route path="/pubNotesSafe/:id" element={<PubNoteSafe />} />
|
2022-11-01 20:29:32 +03:00
|
|
|
<Route path="/pubError" element={<PubError />} />
|
2023-04-03 17:03:01 +03:00
|
|
|
<Route path="/settings" element={<Settings />} />
|
2023-04-04 16:50:11 +03:00
|
|
|
<Route path="/chat" element={<Chat />} />
|
2022-10-17 13:50:40 +03:00
|
|
|
<Route
|
|
|
|
path="/about"
|
2022-11-01 21:08:39 +03:00
|
|
|
element={
|
2023-02-09 17:15:34 +03:00
|
|
|
<div className="col-span-4 md">
|
2023-04-01 20:57:46 +03:00
|
|
|
<RenderMarkdown>
|
2023-02-09 17:15:34 +03:00
|
|
|
{`## Anopaper - сервис анонимных записок
|
|
|
|
\rAnoPaper позволяет анонимно сохранять и публиковать заметки.
|
|
|
|
\r-----
|
|
|
|
\r### Функционал:
|
|
|
|
|
|
|
|
\r* Заметки поддерживают формат markdown. Например запись: \`### Заголовок 3-го уровня\` будет выглядеть так:
|
|
|
|
\r> ### Заголовок 3-го уровня
|
2023-04-01 20:57:46 +03:00
|
|
|
|
|
|
|
\r*Так же поддерживается синтаксис mathjax* Например запись: \`$\\sum_{i=1}^n i^2$\` будет выглядеть так: $\\sum_{i=1}^n i^2$
|
|
|
|
|
2023-02-09 17:15:34 +03:00
|
|
|
|
|
|
|
\r* Публичные заметки доступны только по ссылке.
|
2023-04-02 10:15:52 +03:00
|
|
|
\r* При переходе по ссылке заметка сохраняется локально и удаляется с сервера.
|
2023-02-09 17:15:34 +03:00
|
|
|
\r* Не публичные заметки сохраняются локально и не отправляются на сервер.`}
|
2023-04-01 20:57:46 +03:00
|
|
|
</RenderMarkdown>
|
2022-11-01 21:08:39 +03:00
|
|
|
</div>
|
|
|
|
}
|
2022-10-17 13:50:40 +03:00
|
|
|
/>
|
2022-10-20 21:37:09 +03:00
|
|
|
<Route path="/notes" element={<Notes />} />
|
2022-10-17 13:50:40 +03:00
|
|
|
</Routes>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|