From 2a958262ccdb0b6354f1d5240cacd1d5c064d653 Mon Sep 17 00:00:00 2001 From: WDI-Ideas Date: Mon, 30 Mar 2026 03:23:13 +0530 Subject: [PATCH] chore: remove debug logs and harden slug helper edge cases --- .gitea/workflows/src/components/LearningFacilityNew.tsx | 4 ---- .gitea/workflows/src/utils/urlHelpers.ts | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/src/components/LearningFacilityNew.tsx b/.gitea/workflows/src/components/LearningFacilityNew.tsx index 2bd37ab..f54888c 100644 --- a/.gitea/workflows/src/components/LearningFacilityNew.tsx +++ b/.gitea/workflows/src/components/LearningFacilityNew.tsx @@ -389,12 +389,10 @@ export function LearningFacilityNew() { const [expandedTourCard, setExpandedTourCard] = useState(null); useEffect(() => { - console.log('LearningFacility component mounted'); // Debug log window.scrollTo(0, 0); // Listen for custom booking modal event from CTAPopupModal const handleOpenBookingModal = () => { - console.log('Custom booking modal event received'); // Debug log handleBookNow(); }; @@ -403,7 +401,6 @@ export function LearningFacilityNew() { // Also check if we should auto-open the booking modal based on URL parameters const urlParams = new URLSearchParams(window.location.search); if (urlParams.get('autoBooking') === 'true') { - console.log('Auto-opening booking modal from URL parameter'); // Debug log setTimeout(() => handleBookNow(), 100); } @@ -1850,7 +1847,6 @@ function BookingModal({ const handleFormSubmit = (e: React.FormEvent) => { e.preventDefault(); - console.log('Booking form submitted:', bookingForm); // Here you would typically send the form data to your backend alert('Booking request submitted successfully! We will contact you soon.'); onClose(); diff --git a/.gitea/workflows/src/utils/urlHelpers.ts b/.gitea/workflows/src/utils/urlHelpers.ts index 9f5a27d..1f3b513 100644 --- a/.gitea/workflows/src/utils/urlHelpers.ts +++ b/.gitea/workflows/src/utils/urlHelpers.ts @@ -18,8 +18,14 @@ export const createSlug = (text: string): string => { * Example: "Ad ut neque enim omn", "e7d611b6-853b-4785-b508-599eeed2af92" -> "ad-ut-neque-enim-omn-e7d611b6-853b-4785-b508-599eeed2af92" */ export const getSlugWithId = (title: string, id: string) => { + const slug = createSlug(title); const normalizedId = id.trim(); - return `${createSlug(title)}-${normalizedId}`; + + if (!slug && !normalizedId) return ''; + if (!slug) return normalizedId; + if (!normalizedId) return slug; + + return `${slug}-${normalizedId}`; }; /**