Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'
import Link from 'next/link'
import { useCallback, useEffect, useState } from 'react'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import Input from '@/app/components/base/input'
Expand All @@ -18,13 +18,10 @@ export default function VerifyEmail(props: DeleteAccountProps) {
const { t } = useTranslation()
const emailToken = useAccountDeleteStore(state => state.sendEmailToken)
const [verificationCode, setVerificationCode] = useState<string>()
const [shouldButtonDisabled, setShouldButtonDisabled] = useState(true)
const { mutate: sendEmail } = useSendDeleteAccountEmail()
const { isPending: isDeleting, mutateAsync: confirmDeleteAccount } = useConfirmDeleteAccount()

useEffect(() => {
setShouldButtonDisabled(!(verificationCode && CODE_EXP.test(verificationCode)) || isDeleting)
}, [verificationCode, isDeleting])
const shouldButtonDisabled = !(verificationCode && CODE_EXP.test(verificationCode)) || isDeleting

const handleConfirm = useCallback(async () => {
try {
Expand Down
20 changes: 7 additions & 13 deletions web/app/components/app/overview/app-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '@remixicon/react'
import { usePathname, useRouter } from 'next/navigation'
import * as React from 'react'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import AppBasic from '@/app/components/app-sidebar/basic'
import { useStore as useAppStore } from '@/app/components/app/store'
Expand Down Expand Up @@ -160,18 +160,12 @@ function AppCard({
}
}

const [isAppAccessSet, setIsAppAccessSet] = useState(true)
useEffect(() => {
if (appDetail && appAccessSubjects) {
if (appDetail.access_mode === AccessMode.SPECIFIC_GROUPS_MEMBERS && appAccessSubjects.groups?.length === 0 && appAccessSubjects.members?.length === 0)
setIsAppAccessSet(false)
else
setIsAppAccessSet(true)
}
else {
setIsAppAccessSet(true)
}
}, [appAccessSubjects, appDetail])
const isAppAccessSet = !(
appDetail && appAccessSubjects
&& appDetail.access_mode === AccessMode.SPECIFIC_GROUPS_MEMBERS
&& appAccessSubjects.groups?.length === 0
&& appAccessSubjects.members?.length === 0
)

const handleClickAccessControl = useCallback(() => {
if (!appDetail)
Expand Down
6 changes: 0 additions & 6 deletions web/eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@
}
},
"app/account/(commonLayout)/delete-account/components/verify-email.tsx": {
"react-hooks-extra/no-direct-set-state-in-use-effect": {
"count": 1
},
"tailwindcss/enforce-consistent-class-order": {
"count": 3
}
Expand Down Expand Up @@ -1226,9 +1223,6 @@
"no-restricted-imports": {
"count": 2
},
"react-hooks-extra/no-direct-set-state-in-use-effect": {
"count": 3
},
"tailwindcss/enforce-consistent-class-order": {
"count": 8
},
Expand Down
Loading