bugfix: delete action removed from appointment banners to avoid banner sizing issues. the appointment can be deleted via edit modal.

This commit is contained in:
2026-05-17 17:14:00 +03:30
parent 375fdc60b4
commit e119d02759
5 changed files with 65 additions and 56 deletions

View File

@@ -51,6 +51,7 @@ export default function AppointmentsPage() {
const [bookingProviderName, setBookingProviderName] = useState('');
const [editingAppointmentId, setEditingAppointmentId] = useState<string | null>(null);
const [savingAppointment, setSavingAppointment] = useState(false);
const [deletingAppointment, setDeletingAppointment] = useState(false);
const canManageAppointments = canEditAppointments(currentOrganization);
@@ -221,13 +222,19 @@ export default function AppointmentsPage() {
}
}
async function handleDeleteAppointment(id: string) {
async function handleDeleteEditingAppointment() {
if (!activeEditingAppointment) {
return;
}
if (!window.confirm('Remove this appointment?')) {
return;
}
setDeletingAppointment(true);
toast.setError('');
try {
await appointmentsApi.remove(id);
await appointmentsApi.remove(activeEditingAppointment.id);
setBookingOpen(false);
setEditingAppointmentId(null);
toast.showSuccess('Appointment removed.');
await loadSchedule();
} catch (err: unknown) {
@@ -236,6 +243,8 @@ export default function AppointmentsPage() {
? String((err as { message: unknown }).message)
: 'Could not delete appointment.';
toast.showError(message);
} finally {
setDeletingAppointment(false);
}
}
@@ -289,8 +298,6 @@ export default function AppointmentsPage() {
providers={providers}
appointments={appointments}
canBook={canManageAppointments && !isViewingPastDay}
canDelete={canManageAppointments}
onDeleteAppointment={(id) => void handleDeleteAppointment(id)}
onSlotClick={(hour, uid, name) => handleSlotClick(hour, uid, name)}
onAppointmentClick={(apt) => handleAppointmentClick(apt)}
/>
@@ -311,6 +318,9 @@ export default function AppointmentsPage() {
}}
onSubmit={handleSaveAppointment}
loading={savingAppointment}
canDelete={canManageAppointments && !isViewingPastDay && !!activeEditingAppointment}
onDelete={() => void handleDeleteEditingAppointment()}
deleting={deletingAppointment}
/>
{isCreateOpen && (

View File

@@ -12,7 +12,7 @@ export default function TodayPage() {
return (
<div>
<h1 className="text-2xl font-semibold mb-6">
Welcome back Babak !!
Welcome back!!
</h1>
{showNoSubscriptionNotice && (