fix: delete app and setting modal is not wokring in firefox (#1427)

This commit is contained in:
crazywoola
2023-10-29 14:22:05 +08:00
committed by GitHub
parent 292d4c077a
commit 2b366bb321
2 changed files with 35 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
'use client'
import { useContext, useContextSelector } from 'use-context-selector'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import cn from 'classnames'
@@ -30,6 +30,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
const { t } = useTranslation()
const { notify } = useContext(ToastContext)
const { isCurrentWorkspaceManager } = useAppContext()
const { push } = useRouter()
const mutateApps = useContextSelector(
AppsContext,
@@ -103,11 +104,13 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
const Operations = (props: HtmlContentProps) => {
const onClickSettings = async (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation()
props.onClick?.()
e.preventDefault()
await getAppDetail()
}
const onClickDelete = async (e: React.MouseEvent<HTMLDivElement>) => {
e.stopPropagation()
props.onClick?.()
e.preventDefault()
setShowConfirmDelete(true)
@@ -133,8 +136,11 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
return (
<>
<Link
href={`/app/${app.id}/overview`}
<div
onClick={(e) => {
e.preventDefault()
push(`/app/${app.id}/overview`)
}}
className={style.listItem}
>
<div className={style.listItemTitle}>
@@ -186,7 +192,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
onSave={onSaveSiteConfig}
/>
)}
</Link>
</div>
</>
)
}