Merge pull request #1314 from claynicholson/arcade-gallery

Sped up handle delete by a lot
This commit is contained in:
Clay Nicholson 2024-08-19 16:28:49 +00:00 committed by GitHub
commit f4114e6a3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 8 deletions

View file

@ -16,6 +16,8 @@ const CohortCard = ({
reload,
}) => {
const [isHovered, setIsHovered] = useState(false)
const [isVisible, setIsVisible] = useState(true);
async function handleDelete() {
try {
@ -47,9 +49,7 @@ const CohortCard = ({
} catch (error) {
console.error('Error deleting project:', error)
}
reload()
}
}
const firstImage = imageLink || randomNotFoundImg(id)
console.log({imageLink})
@ -59,7 +59,8 @@ const CohortCard = ({
}
return (
<div
<>
{isVisible? (<div
className={styles.card}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
@ -142,7 +143,7 @@ const CohortCard = ({
sx={{ borderRadius: '10px', border: '3px dashed #09AFB4' }}
className="gaegu"
>
<Text sx={{display: 'block', position: 'relative', pr: 3}}>Are you sure you want to delete this project?</Text>
<Text>Are you sure you want to delete this project?</Text>
<br />
<Button
sx={{
@ -158,8 +159,9 @@ const CohortCard = ({
width: 'fit-content'
}}
onClick={e => {
setIsVisible(false)
document.getElementById('add-project').close()
handleDelete()
document.getElementById('delete-project').close()
}}
>
Yes
@ -174,11 +176,15 @@ const CohortCard = ({
color: '#09AFB4'
}}
onClick={e => {
document.getElementById('delete-project').close()
document.getElementById('add-project').close()
}}
/>
</dialog>
</div>
</div>) : null
}
</>
)
}

View file

@ -148,6 +148,7 @@ const My = () => {
return (
<div sx={{ width: '100%' }}>
<Button
to="https://hackclub.com/arcade/showcase/vote/"
sx={{
backgroundColor: '#FF5C00',
color: '#FAEFD6',