Remove unused components and models for improved maintainability
- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files. - Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter. - Updated project structure and references to reflect these removals.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
import React, {useState} from "react";
|
||||
import ToggleSwitch from "@/components/form/ToggleSwitch";
|
||||
import AlertBox, {AlertType} from "@/components/AlertBox";
|
||||
import AlertBox, {AlertType} from "@/components/ui/AlertBox";
|
||||
|
||||
interface ToggleWithConfirmationProps {
|
||||
checked: boolean;
|
||||
@@ -15,17 +15,17 @@ interface ToggleWithConfirmationProps {
|
||||
}
|
||||
|
||||
export default function ToggleWithConfirmation({
|
||||
checked,
|
||||
onChange,
|
||||
alertTitle,
|
||||
alertMessage,
|
||||
alertType,
|
||||
confirmText = "Activer",
|
||||
cancelText = "Annuler",
|
||||
disabled = false
|
||||
}: ToggleWithConfirmationProps) {
|
||||
checked,
|
||||
onChange,
|
||||
alertTitle,
|
||||
alertMessage,
|
||||
alertType,
|
||||
confirmText = "Activer",
|
||||
cancelText = "Annuler",
|
||||
disabled = false
|
||||
}: ToggleWithConfirmationProps) {
|
||||
const [showAlert, setShowAlert] = useState<boolean>(false);
|
||||
|
||||
|
||||
function handleToggle(newChecked: boolean): void {
|
||||
if (newChecked) {
|
||||
setShowAlert(true);
|
||||
@@ -33,20 +33,20 @@ export default function ToggleWithConfirmation({
|
||||
onChange(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function handleConfirm(): Promise<void> {
|
||||
onChange(true);
|
||||
setShowAlert(false);
|
||||
}
|
||||
|
||||
|
||||
function handleCancel(): void {
|
||||
setShowAlert(false);
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<ToggleSwitch checked={checked} onChange={handleToggle} disabled={disabled}/>
|
||||
|
||||
|
||||
{showAlert && (
|
||||
<AlertBox
|
||||
title={alertTitle}
|
||||
|
||||
Reference in New Issue
Block a user