'use client';
import { useState, useTransition } from 'react';
import { FoxButton } from '@fox/core/components/fox-button';
import { FoxButtonGroup } from '@fox/core/components/fox-button-group';
import { FoxIconButton } from '@fox/core/components/fox-icon-button';
import { useFeedback } from '@/app/_hooks/use-feedback';
import type { PointStandard } from '@/lib/domain/point-standard';
import { deletePointStandardAction } from '../_actions';
import { PointStandardFormModal } from './point-standard-form-modal';
interface PointStandardRowActionsProps {
standard: PointStandard;
}
export function PointStandardRowActions({
standard,
}: PointStandardRowActionsProps) {
const { showAlert, hideAlert, showToast } = useFeedback();
const [isEditOpen, setIsEditOpen] = useState(false);
const [isDeleting, startDeleting] = useTransition();
function runDelete() {
hideAlert();
startDeleting(async () => {
const result = await deletePointStandardAction(standard.id);
if (result.status === 'error') {
showToast({ variant: 'danger', message: result.message });
return;
}
showToast({ variant: 'success', message: '포인트 기준을 삭제했습니다.' });
});
}
function confirmDelete() {
showAlert({
variant: 'danger',
title: '포인트 기준을 삭제하시겠습니까?',
message: `"${standard.eventCode}" 기준을 삭제합니다. 삭제 후에는 되돌릴 수 없습니다.`,
actions: (