add sync npub logic & change perms and activity history design & add delete app/perm requests

This commit is contained in:
Bekbolsun
2024-02-01 18:33:19 +06:00
parent 0b07b78b5c
commit e5d2b8808b
47 changed files with 1084 additions and 596 deletions

View File

@@ -8,6 +8,7 @@ import { MODAL_PARAMS_KEYS } from '@/types/modal'
import { Stack, Typography } from '@mui/material'
import React, { ChangeEvent, FormEvent, useState } from 'react'
import { StyledAppLogo } from './styled'
import { useNavigate } from 'react-router-dom'
export const ModalImportKeys = () => {
const { getModalOpened, handleClose } = useModalSearchParams()
@@ -15,6 +16,7 @@ export const ModalImportKeys = () => {
const handleCloseModal = handleClose(MODAL_PARAMS_KEYS.IMPORT_KEYS)
const notify = useEnqueueSnackbar()
const navigate = useNavigate()
const [enteredNsec, setEnteredNsec] = useState('')
@@ -26,9 +28,9 @@ export const ModalImportKeys = () => {
e.preventDefault()
try {
if (!enteredNsec.trim().length) return
await swicCall('importKey', enteredNsec)
const k: any = await swicCall('importKey', enteredNsec)
notify('Key imported!', 'success')
handleCloseModal()
navigate(`/key/${k.npub}`)
} catch (error: any) {
notify(error.message, 'error')
}
@@ -36,12 +38,7 @@ export const ModalImportKeys = () => {
return (
<Modal open={isModalOpened} onClose={handleCloseModal}>
<Stack
paddingTop={'1rem'}
gap={'1rem'}
component={'form'}
onSubmit={handleSubmit}
>
<Stack gap={'1rem'} component={'form'} onSubmit={handleSubmit}>
<Stack
direction={'row'}
gap={'1rem'}
@@ -60,7 +57,7 @@ export const ModalImportKeys = () => {
onChange={handleNsecChange}
fullWidth
/>
<Button>Import nsec</Button>
<Button type='submit'>Import nsec</Button>
</Stack>
</Modal>
)