diff --git a/src/components/Modal/ModalAppDetails/ModalAppDetails.tsx b/src/components/Modal/ModalAppDetails/ModalAppDetails.tsx index 1e562b1..5465b7f 100644 --- a/src/components/Modal/ModalAppDetails/ModalAppDetails.tsx +++ b/src/components/Modal/ModalAppDetails/ModalAppDetails.tsx @@ -68,7 +68,6 @@ export const ModalAppDetails = () => { if (isEmptyString(url)) return try { - const u = new URL(url) if (isEmptyString(name)) setDetails((prev) => ({ ...prev, name: u.hostname })) diff --git a/src/components/Modal/ModalConfirmConnect/ModalConfirmConnect.tsx b/src/components/Modal/ModalConfirmConnect/ModalConfirmConnect.tsx index afaf459..d4ad0a8 100644 --- a/src/components/Modal/ModalConfirmConnect/ModalConfirmConnect.tsx +++ b/src/components/Modal/ModalConfirmConnect/ModalConfirmConnect.tsx @@ -73,11 +73,11 @@ export const ModalConfirmConnect = () => { useEffect(() => { if (isModalOpened) { if (isPopup) { - console.log("waiting for sw") + console.log('waiting for sw') // wait for SW to start swicWaitStarted().then(() => { // give it some time to load the pending reqs etc - console.log("waiting for sw done") + console.log('waiting for sw done') setTimeout(() => setIsLoaded(true), 500) }) } else { @@ -123,7 +123,6 @@ export const ModalConfirmConnect = () => { const options = { perms, appUrl } await confirmPending(pendingReqId, true, true, options) } else { - try { await askNotificationPermission() const result = await swicCall('enablePush') diff --git a/src/components/Modal/ModalEditName/styled.tsx b/src/components/Modal/ModalEditName/styled.tsx index 0f0e021..92cacf4 100644 --- a/src/components/Modal/ModalEditName/styled.tsx +++ b/src/components/Modal/ModalEditName/styled.tsx @@ -1,4 +1,4 @@ -import { Stack, StackProps, styled } from "@mui/material"; +import { Stack, StackProps, styled } from '@mui/material' export const StyledSettingContainer = styled((props: StackProps) => ( @@ -7,4 +7,4 @@ export const StyledSettingContainer = styled((props: StackProps) => ( borderRadius: '1rem', background: theme.palette.background.default, color: theme.palette.text.primary, -})) \ No newline at end of file +})) diff --git a/src/components/Modal/ModalSignUp/ModalSignUp.tsx b/src/components/Modal/ModalSignUp/ModalSignUp.tsx index d9cff4c..51452b3 100644 --- a/src/components/Modal/ModalSignUp/ModalSignUp.tsx +++ b/src/components/Modal/ModalSignUp/ModalSignUp.tsx @@ -60,10 +60,8 @@ export const ModalSignUp = () => { try { setIsLoading(true) const k: any = await swicCall('generateKey', name) - if (k.name) - notify(`Account created for "${k.name}"`, 'success') - else - notify(`Failed to assign name "${name}", try again`, 'error') + if (k.name) notify(`Account created for "${k.name}"`, 'success') + else notify(`Failed to assign name "${name}", try again`, 'error') setIsLoading(false) setTimeout(() => { // give frontend time to read the new key first diff --git a/src/components/Warning/Warning.tsx b/src/components/Warning/Warning.tsx index a9eb535..3fd7f89 100644 --- a/src/components/Warning/Warning.tsx +++ b/src/components/Warning/Warning.tsx @@ -13,14 +13,8 @@ export const Warning: FC = ({ hint, message, icon, ...restProps }) {icon && {icon}} - - {message} - - {hint && ( - - {hint} - - )} + {message} + {hint && {hint}} ) diff --git a/src/layout/Header/components/ListItemProfile.tsx b/src/layout/Header/components/ListItemProfile.tsx index f0de331..487bd3a 100644 --- a/src/layout/Header/components/ListItemProfile.tsx +++ b/src/layout/Header/components/ListItemProfile.tsx @@ -4,28 +4,21 @@ import { Avatar, ListItemIcon, MenuItem, Typography } from '@mui/material' import React, { FC } from 'react' type ListItemProfileProps = { - onClickItem: () => void + onClickItem: () => void } & DbKey -export const ListItemProfile: FC = ({ - onClickItem, - npub, -}) => { - const { userName, userAvatar, avatarTitle } = useProfile(npub) - return ( - - - - {avatarTitle} - - - - {userName} - - - ) +export const ListItemProfile: FC = ({ onClickItem, npub }) => { + const { userName, userAvatar, avatarTitle } = useProfile(npub) + return ( + + + + {avatarTitle} + + + + {userName} + + + ) } diff --git a/src/modules/backend.ts b/src/modules/backend.ts index b1b52ee..02371c2 100644 --- a/src/modules/backend.ts +++ b/src/modules/backend.ts @@ -693,7 +693,7 @@ export class NoauthBackend { } private getDecision(backend: Nip46Backend, req: DbPending): DECISION { - if (!(req.method in backend.handlers)) return DECISION.IGNORE; + if (!(req.method in backend.handlers)) return DECISION.IGNORE const reqPerm = getReqPerm(req) const appPerms = this.perms.filter((p) => p.npub === req.npub && p.appNpub === req.appNpub) @@ -1175,10 +1175,10 @@ export class NoauthBackend { } private async transferName(npub: string, name: string, newNpub: string) { - const key = this.enckeys.find(k => k.npub === npub) - if (!key) throw new Error("Npub not found") - if (!name) throw new Error("Empty name") - if (key.name !== name) throw new Error("Name changed, please reload") + const key = this.enckeys.find((k) => k.npub === npub) + if (!key) throw new Error('Npub not found') + if (!name) throw new Error('Empty name') + if (key.name !== name) throw new Error('Name changed, please reload') await this.sendTransferNameToServer(npub, key.name, newNpub) await dbi.editName(npub, '') key.name = '' diff --git a/src/modules/keys.ts b/src/modules/keys.ts index 70af6b8..61357e1 100644 --- a/src/modules/keys.ts +++ b/src/modules/keys.ts @@ -43,7 +43,7 @@ export function isWeakPassphase(passphrase: string): boolean { const compl = Math.pow(base, passphrase.length) const thresh = Math.pow(11, 14) // console.log({ big, small, number, punct, base, compl, thresh }); - return compl < thresh; + return compl < thresh } export class Keys { diff --git a/src/modules/swic.ts b/src/modules/swic.ts index 8ee794b..fa0b261 100644 --- a/src/modules/swic.ts +++ b/src/modules/swic.ts @@ -20,8 +20,8 @@ export async function swicRegister() { }, onUpdate() { // tell new SW that it should activate immediately - swr?.waiting?.postMessage({type: 'SKIP_WAITING'}) - } + swr?.waiting?.postMessage({ type: 'SKIP_WAITING' }) + }, }) navigator.serviceWorker.ready.then(async (r) => { @@ -33,8 +33,7 @@ export async function swicRegister() { console.log('This page is not currently controlled by a service worker.') } - while (queue.length) - await (queue.shift()!)() + while (queue.length) await queue.shift()!() }) navigator.serviceWorker.addEventListener('message', (event) => { @@ -43,11 +42,11 @@ export async function swicRegister() { } export function swicWaitStarted() { - return new Promise(ok => { + return new Promise((ok) => { if (swr && swr.active) ok() else queue.push(ok) }) -} +} function onMessage(data: any) { const { id, result, error } = data @@ -78,7 +77,6 @@ export async function swicCall(method: string, ...args: any[]) { nextReqId++ return new Promise((ok, rej) => { - const call = async () => { if (!swr || !swr.active) { rej(new Error('No active service worker')) diff --git a/src/pages/KeyPage/components/BackgroundSigningWarning.tsx b/src/pages/KeyPage/components/BackgroundSigningWarning.tsx index 3734c72..dcc4166 100644 --- a/src/pages/KeyPage/components/BackgroundSigningWarning.tsx +++ b/src/pages/KeyPage/components/BackgroundSigningWarning.tsx @@ -16,12 +16,7 @@ export const BackgroundSigningWarning: FC = ({ is Enable background service {isEnabling ? : null} } - hint={ - - Please allow notifications - for background operation. - - } + hint={Please allow notifications for background operation.} icon={} onClick={isEnabling ? undefined : onEnableBackSigning} /> diff --git a/src/utils/consts.ts b/src/utils/consts.ts index 7f68c77..0af612f 100644 --- a/src/utils/consts.ts +++ b/src/utils/consts.ts @@ -16,7 +16,7 @@ export enum ACTION_TYPE { } export const ACTIONS: { [type: string]: string } = { - basic: 'Basic permissions', + basic: 'Basic permissions', get_public_key: 'Get public key', sign_event: 'Sign event', connect: 'Connect', diff --git a/src/utils/helpers/date.ts b/src/utils/helpers/date.ts index efe1d78..77bdea6 100644 --- a/src/utils/helpers/date.ts +++ b/src/utils/helpers/date.ts @@ -3,7 +3,7 @@ import { format } from 'date-fns' export const formatTimestampDate = (timestamp: number) => { try { const date = new Date(timestamp) - const formattedDate = format(date, "dd-MM-yyyy HH:mm") + const formattedDate = format(date, 'dd-MM-yyyy HH:mm') return formattedDate } catch (error) { return ''