chore: remove debug logs and harden slug helper edge cases
This commit is contained in:
@@ -389,12 +389,10 @@ export function LearningFacilityNew() {
|
|||||||
const [expandedTourCard, setExpandedTourCard] = useState<string | null>(null);
|
const [expandedTourCard, setExpandedTourCard] = useState<string | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('LearningFacility component mounted'); // Debug log
|
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
||||||
// Listen for custom booking modal event from CTAPopupModal
|
// Listen for custom booking modal event from CTAPopupModal
|
||||||
const handleOpenBookingModal = () => {
|
const handleOpenBookingModal = () => {
|
||||||
console.log('Custom booking modal event received'); // Debug log
|
|
||||||
handleBookNow();
|
handleBookNow();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -403,7 +401,6 @@ export function LearningFacilityNew() {
|
|||||||
// Also check if we should auto-open the booking modal based on URL parameters
|
// Also check if we should auto-open the booking modal based on URL parameters
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
if (urlParams.get('autoBooking') === 'true') {
|
if (urlParams.get('autoBooking') === 'true') {
|
||||||
console.log('Auto-opening booking modal from URL parameter'); // Debug log
|
|
||||||
setTimeout(() => handleBookNow(), 100);
|
setTimeout(() => handleBookNow(), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1850,7 +1847,6 @@ function BookingModal({
|
|||||||
|
|
||||||
const handleFormSubmit = (e: React.FormEvent) => {
|
const handleFormSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log('Booking form submitted:', bookingForm);
|
|
||||||
// Here you would typically send the form data to your backend
|
// Here you would typically send the form data to your backend
|
||||||
alert('Booking request submitted successfully! We will contact you soon.');
|
alert('Booking request submitted successfully! We will contact you soon.');
|
||||||
onClose();
|
onClose();
|
||||||
|
|||||||
@@ -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"
|
* 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) => {
|
export const getSlugWithId = (title: string, id: string) => {
|
||||||
|
const slug = createSlug(title);
|
||||||
const normalizedId = id.trim();
|
const normalizedId = id.trim();
|
||||||
return `${createSlug(title)}-${normalizedId}`;
|
|
||||||
|
if (!slug && !normalizedId) return '';
|
||||||
|
if (!slug) return normalizedId;
|
||||||
|
if (!normalizedId) return slug;
|
||||||
|
|
||||||
|
return `${slug}-${normalizedId}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user