From 69a3e85cb3336881e76b14e339e0bdf55e7fecaa Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:25:00 +0700 Subject: [PATCH] small updates and bump version --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 4 ++-- src-tauri/tauri.conf.json | 2 +- src/app/error.tsx | 29 ++++++++++++++++++++--------- src/shared/composer/composer.tsx | 6 +++++- src/stores/sidebar.ts | 2 +- src/stores/widgets.ts | 2 +- 8 files changed, 32 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 38ba94ab..718a67e9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lume", "description": "the communication app", "private": true, - "version": "1.2.1", + "version": "1.2.2", "scripts": { "dev": "vite", "build": "vite build", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index e74ab193..32ae6435 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "lume" -version = "1.2.1" +version = "1.2.2" dependencies = [ "rust-argon2 1.0.0", "serde", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c106c822..1fa01a64 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lume" -version = "1.2.1" -description = "nostr client" +version = "1.2.2" +description = "the communication app" authors = ["Ren Amamiya"] license = "GPL-3.0" repository = "https://github.com/luminous-devs/lume" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e83ec1bf..fbff5201 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Lume", - "version": "1.2.1" + "version": "1.2.2" }, "tauri": { "allowlist": { diff --git a/src/app/error.tsx b/src/app/error.tsx index ee1e99d3..074399b7 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -3,32 +3,43 @@ import { useLocation, useRouteError } from 'react-router-dom'; import { Frame } from '@shared/frame'; -interface IRouteError { +interface RouteError { statusText: string; message: string; } -interface IDebugInfo { +interface DebugInfo { os: null | string; version: null | string; + appDir: null | string; } export function ErrorScreen() { - const error = useRouteError() as IRouteError; + const error = useRouteError() as RouteError; const location = useLocation(); - const [debugInfo, setDebugInfo] = useState({ os: null, version: null }); + const [debugInfo, setDebugInfo] = useState({ + os: null, + version: null, + appDir: null, + }); useEffect(() => { async function getInformation() { const { platform, version } = await import('@tauri-apps/api/os'); const { getVersion } = await import('@tauri-apps/api/app'); + const { appConfigDir } = await import('@tauri-apps/api/path'); const platformName = await platform(); const osVersion = await version(); const appVersion = await getVersion(); + const appDir = await appConfigDir(); - setDebugInfo({ os: platformName + ' ' + osVersion, version: appVersion }); + setDebugInfo({ + os: platformName + ' ' + osVersion, + version: appVersion, + appDir: appDir, + }); } getInformation(); @@ -36,7 +47,7 @@ export function ErrorScreen() { return ( -
+

Sorry, an unexpected error has occurred. @@ -59,19 +70,19 @@ export function ErrorScreen() { href="https://github.com/luminous-devs/lume/issues/new" target="_blank" rel="noreferrer" - className="inline-flex h-11 w-full items-center justify-center rounded-lg bg-white/10 text-sm font-medium text-white backdrop-blur-xl hover:bg-white/20" + className="inline-flex h-11 w-full items-center justify-center rounded-lg text-sm font-medium text-white backdrop-blur-xl hover:bg-white/10" > Click here to report the issue on GitHub diff --git a/src/shared/composer/composer.tsx b/src/shared/composer/composer.tsx index 5c0cd53f..107f6dbf 100644 --- a/src/shared/composer/composer.tsx +++ b/src/shared/composer/composer.tsx @@ -38,12 +38,16 @@ export function Composer() { }, }), ], - content: '', + content: JSON.parse(localStorage.getItem('editor-content') || '{}'), editorProps: { attributes: { class: 'h-full markdown break-all overflow-y-auto outline-none pr-2', }, }, + onUpdate: ({ editor }) => { + const jsonContent = JSON.stringify(editor.getJSON()); + localStorage.setItem('editor-content', jsonContent); + }, }); const submit = async () => { diff --git a/src/stores/sidebar.ts b/src/stores/sidebar.ts index 8018d46b..ba7b17aa 100644 --- a/src/stores/sidebar.ts +++ b/src/stores/sidebar.ts @@ -18,7 +18,7 @@ export const useSidebar = create()( }), { name: 'sidebar', - storage: createJSONStorage(() => localStorage), + storage: createJSONStorage(() => sessionStorage), } ) ); diff --git a/src/stores/widgets.ts b/src/stores/widgets.ts index 6fbad8f0..f59a5978 100644 --- a/src/stores/widgets.ts +++ b/src/stores/widgets.ts @@ -122,7 +122,7 @@ export const useWidgets = create()( }), { name: 'widgets', - storage: createJSONStorage(() => localStorage), + storage: createJSONStorage(() => sessionStorage), } ) );