Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm before deletion of project #742

Closed
wants to merge 3 commits into from
Closed
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
Binary file modified bun.lockb
Binary file not shown.
46 changes: 38 additions & 8 deletions src/app/harbor/shipyard/edit-ship-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import type { Ship } from '@/app/utils/data'
import { useToast } from '@/hooks/use-toast'
import Icon from '@hackclub/icons'
import { useState } from 'react'
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogClose,
DialogFooter,
} from '@/components/ui/dialog'

const editMessages = [
'Orpheus hopes you know that she put a lot of effort into recording your changes~',
Expand Down Expand Up @@ -190,14 +200,34 @@ export default function EditShipForm({
Save edits
</Button>

<Button
className={`${buttonVariants({ variant: 'destructive' })} ml-auto`}
onClick={handleDelete}
disabled={deleting}
>
{deleting ? <Icon glyph="more" /> : <Icon glyph="forbidden" />}
Delete Ship
</Button>
<Dialog>
<DialogTrigger>
<Button
className={`${buttonVariants({ variant: 'destructive' })} ml-auto`}
disabled={deleting}
>
{deleting ? <Icon glyph="more" /> : <Icon glyph="forbidden" />}
Delete ship
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Are you absolutely sure?</DialogTitle>
<DialogDescription>
This action cannot be undone.
</DialogDescription>
<DialogFooter>
<Button
type="submit"
variant="secondary"
onClick={handleDelete}
>
I'm sure! Delete it.
</Button>
</DialogFooter>
</DialogHeader>
</DialogContent>
</Dialog>
</div>
</form>
)
Expand Down
8 changes: 8 additions & 0 deletions src/app/harbor/shipyard/new-update-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
import { createShipUpdate } from './ship-utils'
import type { Ship } from '@/app/utils/data'
import { Button } from '@/components/ui/button'
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog'
import JSConfetti from 'js-confetti'
import { useCallback, useEffect, useRef, useState } from 'react'
import { getWakaSessions } from '@/app/utils/waka'
Expand Down