fix warnings
This commit is contained in:
@ -5,8 +5,6 @@ import { useAppDispatch } from './store/hooks/redux'
|
|||||||
import { setApps, setKeys, setPending, setPerms } from './store/reducers/content.slice'
|
import { setApps, setKeys, setPending, setPerms } from './store/reducers/content.slice'
|
||||||
import AppRoutes from './routes/AppRoutes'
|
import AppRoutes from './routes/AppRoutes'
|
||||||
import { fetchProfile, ndk } from './modules/nostr'
|
import { fetchProfile, ndk } from './modules/nostr'
|
||||||
import { useModalSearchParams } from './hooks/useModalSearchParams'
|
|
||||||
import { MODAL_PARAMS_KEYS } from './types/modal'
|
|
||||||
import { ModalInitial } from './components/Modal/ModalInitial/ModalInitial'
|
import { ModalInitial } from './components/Modal/ModalInitial/ModalInitial'
|
||||||
import { ModalImportKeys } from './components/Modal/ModalImportKeys/ModalImportKeys'
|
import { ModalImportKeys } from './components/Modal/ModalImportKeys/ModalImportKeys'
|
||||||
import { ModalSignUp } from './components/Modal/ModalSignUp/ModalSignUp'
|
import { ModalSignUp } from './components/Modal/ModalSignUp/ModalSignUp'
|
||||||
@ -14,7 +12,6 @@ import { ModalLogin } from './components/Modal/ModalLogin/ModalLogin'
|
|||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [render, setRender] = useState(0)
|
const [render, setRender] = useState(0)
|
||||||
const { handleOpen } = useModalSearchParams()
|
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
|
||||||
const [isConnected, setIsConnected] = useState(false)
|
const [isConnected, setIsConnected] = useState(false)
|
||||||
|
@ -69,12 +69,13 @@ export const ModalImportKeys = () => {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const { type, data } = nip19.decode(debouncedNsec)
|
const { type, data } = nip19.decode(debouncedNsec)
|
||||||
const ok = type === 'nsec';
|
const ok = type === 'nsec'
|
||||||
setIsBadNsec(!ok)
|
setIsBadNsec(!ok)
|
||||||
if (ok) {
|
if (ok) {
|
||||||
const npub = nip19.npubEncode(
|
const npub = nip19.npubEncode(
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
getPublicKey(data))
|
getPublicKey(data)
|
||||||
|
)
|
||||||
setIsTakenByNsec(!!nameNpub && nameNpub === npub)
|
setIsTakenByNsec(!!nameNpub && nameNpub === npub)
|
||||||
} else {
|
} else {
|
||||||
setIsTakenByNsec(false)
|
setIsTakenByNsec(false)
|
||||||
@ -84,7 +85,8 @@ export const ModalImportKeys = () => {
|
|||||||
setIsTakenByNsec(false)
|
setIsTakenByNsec(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}, [debouncedNsec])
|
// eslint-disable-next-line
|
||||||
|
}, [debouncedNsec])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkNsecUsername()
|
checkNsecUsername()
|
||||||
@ -106,8 +108,8 @@ export const ModalImportKeys = () => {
|
|||||||
if (isLoading) return undefined
|
if (isLoading) return undefined
|
||||||
try {
|
try {
|
||||||
const { nsec, username } = values
|
const { nsec, username } = values
|
||||||
if (!nsec || !username) throw new Error("Enter username and nsec")
|
if (!nsec || !username) throw new Error('Enter username and nsec')
|
||||||
if (nameNpub && !isTakenByNsec) throw new Error("Name taken")
|
if (nameNpub && !isTakenByNsec) throw new Error('Name taken')
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const k: any = await swicCall('importKey', username, nsec)
|
const k: any = await swicCall('importKey', username, nsec)
|
||||||
notify('Key imported!', 'success')
|
notify('Key imported!', 'success')
|
||||||
@ -186,9 +188,7 @@ export const ModalImportKeys = () => {
|
|||||||
helperTextProps={{
|
helperTextProps={{
|
||||||
sx: {
|
sx: {
|
||||||
'&.helper_text': {
|
'&.helper_text': {
|
||||||
color: isBadNsec
|
color: isBadNsec ? theme.palette.error.main : theme.palette.textSecondaryDecorate.main,
|
||||||
? theme.palette.error.main
|
|
||||||
: theme.palette.textSecondaryDecorate.main,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { useModalSearchParams } from '@/hooks/useModalSearchParams'
|
import { useModalSearchParams } from '@/hooks/useModalSearchParams'
|
||||||
import { Button } from '@/shared/Button/Button'
|
|
||||||
import { Modal } from '@/shared/Modal/Modal'
|
import { Modal } from '@/shared/Modal/Modal'
|
||||||
import { MODAL_PARAMS_KEYS } from '@/types/modal'
|
import { MODAL_PARAMS_KEYS } from '@/types/modal'
|
||||||
import { Box, CircularProgress, Stack, Typography } from '@mui/material'
|
import { Box, CircularProgress, Stack, Typography } from '@mui/material'
|
||||||
@ -116,15 +115,7 @@ export const ModalSettings: FC<ModalSettingsProps> = ({ isSynced }) => {
|
|||||||
{...inputProps}
|
{...inputProps}
|
||||||
onChange={handlePasswordChange}
|
onChange={handlePasswordChange}
|
||||||
value={enteredPassword}
|
value={enteredPassword}
|
||||||
// helperText={isPasswordInvalid ? 'Invalid password' : ''}
|
|
||||||
placeholder="Enter a password"
|
placeholder="Enter a password"
|
||||||
// helperTextProps={{
|
|
||||||
// sx: {
|
|
||||||
// '&.helper_text': {
|
|
||||||
// color: 'red',
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// }}
|
|
||||||
disabled={!isChecked}
|
disabled={!isChecked}
|
||||||
/>
|
/>
|
||||||
{isPasswordInvalid ? (
|
{isPasswordInvalid ? (
|
||||||
@ -153,7 +144,6 @@ export const ModalSettings: FC<ModalSettingsProps> = ({ isSynced }) => {
|
|||||||
Sync {isLoading && <CircularProgress sx={{ marginLeft: '0.5rem' }} size={'1rem'} />}
|
Sync {isLoading && <CircularProgress sx={{ marginLeft: '0.5rem' }} size={'1rem'} />}
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</StyledSettingContainer>
|
</StyledSettingContainer>
|
||||||
{/* <Button onClick={onClose}>Done</Button> */}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
@ -70,12 +70,19 @@ export const useTriggerConfirmModal = (npub: string, pending: DbPending[], perms
|
|||||||
search: {
|
search: {
|
||||||
appNpub: req.appNpub,
|
appNpub: req.appNpub,
|
||||||
reqId: req.id,
|
reqId: req.id,
|
||||||
popup: isPopup ? 'true' : ''
|
popup: isPopup ? 'true' : '',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}, [connectPendings, filteredPendingReqs.length, handleOpen, isConfirmEventModalOpened, isConfirmConnectModalOpened])
|
}, [
|
||||||
|
connectPendings,
|
||||||
|
filteredPendingReqs.length,
|
||||||
|
handleOpen,
|
||||||
|
isConfirmEventModalOpened,
|
||||||
|
isConfirmConnectModalOpened,
|
||||||
|
isPopup,
|
||||||
|
])
|
||||||
|
|
||||||
const handleOpenConfirmEventModal = useCallback(() => {
|
const handleOpenConfirmEventModal = useCallback(() => {
|
||||||
if (!filteredPendingReqs.length || connectPendings.length) return undefined
|
if (!filteredPendingReqs.length || connectPendings.length) return undefined
|
||||||
@ -91,12 +98,12 @@ export const useTriggerConfirmModal = (npub: string, pending: DbPending[], perms
|
|||||||
handleOpen(MODAL_PARAMS_KEYS.CONFIRM_EVENT, {
|
handleOpen(MODAL_PARAMS_KEYS.CONFIRM_EVENT, {
|
||||||
search: {
|
search: {
|
||||||
appNpub,
|
appNpub,
|
||||||
popup: isPopup ? 'true' : ''
|
popup: isPopup ? 'true' : '',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}, [connectPendings.length, filteredPendingReqs.length, handleOpen, prepareEventPendings])
|
}, [connectPendings.length, filteredPendingReqs.length, handleOpen, prepareEventPendings, isPopup])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleOpenConfirmEventModal()
|
handleOpenConfirmEventModal()
|
||||||
|
@ -110,8 +110,7 @@ export const getReferrerAppUrl = () => {
|
|||||||
if (!window.document.referrer) return ''
|
if (!window.document.referrer) return ''
|
||||||
try {
|
try {
|
||||||
const u = new URL(window.document.referrer.toLocaleLowerCase())
|
const u = new URL(window.document.referrer.toLocaleLowerCase())
|
||||||
if (u.hostname != DOMAIN && !u.hostname.endsWith("."+DOMAIN))
|
if (u.hostname !== DOMAIN && !u.hostname.endsWith('.' + DOMAIN)) return u.origin
|
||||||
return u.origin
|
|
||||||
} catch {}
|
} catch {}
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user