fix crash on settings screen

This commit is contained in:
reya 2023-11-26 15:01:13 +07:00
parent 34dceef4a3
commit 8439428ce1
7 changed files with 15 additions and 22 deletions

View File

@ -2,7 +2,7 @@
"name": "lume", "name": "lume",
"description": "the communication app", "description": "the communication app",
"private": true, "private": true,
"version": "2.1.4", "version": "2.1.5",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",

2
src-tauri/Cargo.lock generated
View File

@ -2680,7 +2680,7 @@ dependencies = [
[[package]] [[package]]
name = "lume" name = "lume"
version = "2.1.4" version = "2.1.5"
dependencies = [ dependencies = [
"keyring", "keyring",
"serde", "serde",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "lume" name = "lume"
version = "2.1.4" version = "2.1.5"
description = "the communication app" description = "the communication app"
authors = ["Ren Amamiya"] authors = ["Ren Amamiya"]
license = "GPL-3.0" license = "GPL-3.0"

View File

@ -9,7 +9,7 @@
}, },
"package": { "package": {
"productName": "Lume", "productName": "Lume",
"version": "2.1.4" "version": "2.1.5"
}, },
"plugins": { "plugins": {
"fs": { "fs": {

View File

@ -57,7 +57,7 @@ export function ProfileCard() {
{user?.display_name || user?.name} {user?.display_name || user?.name}
</h3> </h3>
<p className="text-lg text-neutral-700 dark:text-neutral-300"> <p className="text-lg text-neutral-700 dark:text-neutral-300">
{user.nip05 || displayNpub(db.account.pubkey, 16)} {user?.nip05 || displayNpub(db.account.pubkey, 16)}
</p> </p>
</div> </div>
</div> </div>

View File

@ -184,10 +184,7 @@ export function EditProfileScreen() {
</label> </label>
<input <input
type={'text'} type={'text'}
{...register('display_name', { {...register('display_name')}
required: true,
minLength: 4,
})}
spellCheck={false} spellCheck={false}
className="relative h-11 w-full rounded-lg bg-neutral-100 px-3 py-1 text-neutral-900 !outline-none backdrop-blur-xl placeholder:text-neutral-500 dark:bg-neutral-900 dark:text-neutral-100" className="relative h-11 w-full rounded-lg bg-neutral-100 px-3 py-1 text-neutral-900 !outline-none backdrop-blur-xl placeholder:text-neutral-500 dark:bg-neutral-900 dark:text-neutral-100"
/> />
@ -201,10 +198,7 @@ export function EditProfileScreen() {
</label> </label>
<input <input
type={'text'} type={'text'}
{...register('name', { {...register('name')}
required: true,
minLength: 4,
})}
spellCheck={false} spellCheck={false}
className="relative h-11 w-full rounded-lg bg-neutral-100 px-3 py-1 text-neutral-900 !outline-none backdrop-blur-xl placeholder:text-neutral-500 dark:bg-neutral-900 dark:text-neutral-100" className="relative h-11 w-full rounded-lg bg-neutral-100 px-3 py-1 text-neutral-900 !outline-none backdrop-blur-xl placeholder:text-neutral-500 dark:bg-neutral-900 dark:text-neutral-100"
/> />
@ -218,10 +212,7 @@ export function EditProfileScreen() {
</label> </label>
<div className="relative"> <div className="relative">
<input <input
{...register('nip05', { {...register('nip05')}
required: true,
minLength: 4,
})}
spellCheck={false} spellCheck={false}
className="relative h-11 w-full rounded-lg bg-neutral-100 px-3 py-1 text-neutral-900 !outline-none backdrop-blur-xl placeholder:text-neutral-500 dark:bg-neutral-900 dark:text-neutral-100" className="relative h-11 w-full rounded-lg bg-neutral-100 px-3 py-1 text-neutral-900 !outline-none backdrop-blur-xl placeholder:text-neutral-500 dark:bg-neutral-900 dark:text-neutral-100"
/> />

View File

@ -1,4 +1,4 @@
import { Link, NavLink, Outlet, ScrollRestoration } from 'react-router-dom'; import { NavLink, Outlet, ScrollRestoration, useNavigate } from 'react-router-dom';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { WindowTitlebar } from 'tauri-controls'; import { WindowTitlebar } from 'tauri-controls';
@ -15,6 +15,7 @@ import {
export function SettingsLayout() { export function SettingsLayout() {
const { db } = useStorage(); const { db } = useStorage();
const navigate = useNavigate();
return ( return (
<div className="flex h-screen w-screen flex-col bg-neutral-50 dark:bg-neutral-950"> <div className="flex h-screen w-screen flex-col bg-neutral-50 dark:bg-neutral-950">
@ -26,16 +27,17 @@ export function SettingsLayout() {
<div className="flex h-full min-h-0 w-full flex-col gap-8 overflow-y-auto pb-10"> <div className="flex h-full min-h-0 w-full flex-col gap-8 overflow-y-auto pb-10">
<div className="flex h-20 w-full items-center justify-between border-b border-neutral-200 px-2 pb-2 dark:border-neutral-900"> <div className="flex h-20 w-full items-center justify-between border-b border-neutral-200 px-2 pb-2 dark:border-neutral-900">
<div> <div>
<Link <button
to="/" type="button"
onClick={() => navigate(-1)}
className="inline-flex h-12 w-12 items-center justify-center rounded-xl bg-neutral-100 dark:bg-neutral-900" className="inline-flex h-12 w-12 items-center justify-center rounded-xl bg-neutral-100 dark:bg-neutral-900"
> >
<ArrowLeftIcon className="h-5 w-5" /> <ArrowLeftIcon className="h-5 w-5" />
</Link> </button>
</div> </div>
<div className="flex items-center gap-0.5"> <div className="flex items-center gap-0.5">
<NavLink <NavLink
to="/settings" to="/settings/"
end end
className={({ isActive }) => className={({ isActive }) =>
twMerge( twMerge(