style: fix prefer-const and prettier formatting issues
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
let selectedServices = $state<Service[]>([]);
|
||||
let selectedDate = $state<CalendarDate | undefined>(undefined);
|
||||
let selectedTime = $state<string | null>(null);
|
||||
let customerInfo = $state<CustomerInfo>({
|
||||
const customerInfo = $state<CustomerInfo>({
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: '',
|
||||
@@ -98,13 +98,13 @@
|
||||
let newCardNumber = $state('');
|
||||
let newCardExpiry = $state('');
|
||||
let newCardCVC = $state('');
|
||||
let saveCardForFuture = $state(false);
|
||||
const saveCardForFuture = $state(false);
|
||||
|
||||
// Payment flow state
|
||||
let depositPaid = $state(false);
|
||||
let showPaymentForm = $state(false);
|
||||
|
||||
let depositCardFormValid = $derived(
|
||||
const depositCardFormValid = $derived(
|
||||
selectedPaymentMethod !== null ||
|
||||
(showNewCardForm &&
|
||||
newCardNumber.replace(/\s/g, '').length >= 13 &&
|
||||
@@ -113,17 +113,17 @@
|
||||
);
|
||||
|
||||
// VAT registration status from public business info (via shared store)
|
||||
let vatRegistered = $derived(getBusinessInfo()?.is_vat_registered ?? false);
|
||||
const vatRegistered = $derived(getBusinessInfo()?.is_vat_registered ?? false);
|
||||
|
||||
// Email existence check (guest flow only)
|
||||
let emailChecking = $state(false);
|
||||
let emailSuggestion = $state<string | null>(null);
|
||||
let emailError = $state('');
|
||||
let emailFormatValid = $derived(
|
||||
const emailFormatValid = $derived(
|
||||
!customerInfo.email ||
|
||||
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(customerInfo.email)
|
||||
);
|
||||
let allGuestFieldsValid = $derived(
|
||||
const allGuestFieldsValid = $derived(
|
||||
customerInfo.firstName &&
|
||||
customerInfo.lastName &&
|
||||
customerInfo.email &&
|
||||
@@ -571,12 +571,12 @@
|
||||
let loadingWorkingHours = $state<boolean>(false);
|
||||
let loadingAvailableHours = $state<boolean>(false);
|
||||
|
||||
let workingHoursCache: Record<
|
||||
const workingHoursCache: Record<
|
||||
string,
|
||||
Record<string, { isOpen: boolean; startTime: string; endTime: string }>
|
||||
> = {};
|
||||
|
||||
let availableHoursCache: Record<
|
||||
const availableHoursCache: Record<
|
||||
string,
|
||||
Record<string, { isOpen: boolean; slots: Array<{ startTime: string; endTime: string }> }>
|
||||
> = {};
|
||||
@@ -602,7 +602,7 @@
|
||||
});
|
||||
|
||||
// Track which months are currently being fetched (prevents duplicate requests)
|
||||
let loadingMonths: Record<string, boolean> = {};
|
||||
const loadingMonths: Record<string, boolean> = {};
|
||||
|
||||
// Preload current + next month on first render; subsequent months fetched individually
|
||||
let initialLoadDone = $state(false);
|
||||
@@ -1304,13 +1304,13 @@
|
||||
selectedDate ? getDayWithOrdinal(selectedDate) : undefined
|
||||
);
|
||||
|
||||
let depositRequired = $derived(calculateDepositRequired());
|
||||
let totalSteps = $derived(authStore.isAuthenticated ? 4 : 5);
|
||||
const depositRequired = $derived(calculateDepositRequired());
|
||||
const totalSteps = $derived(authStore.isAuthenticated ? 4 : 5);
|
||||
// StepIndicator uses displayNumber = startAt + index. currentStep aligns with displayNumber,
|
||||
// not the array index. For auth: startAt=1, totalSteps=4 → last displayNumber=4.
|
||||
// For guest: startAt=0, totalSteps=5 → last displayNumber=4. Always evaluates to 4.
|
||||
let finalStep = $derived(totalSteps - 1 + (authStore.isAuthenticated ? 1 : 0));
|
||||
let stepLabels = $derived(
|
||||
const finalStep = $derived(totalSteps - 1 + (authStore.isAuthenticated ? 1 : 0));
|
||||
const stepLabels = $derived(
|
||||
authStore.isAuthenticated
|
||||
? ['Service', 'Date & Time', 'Details', 'Payment']
|
||||
: userDepositsRequired > 0
|
||||
|
||||
Reference in New Issue
Block a user