import React, { useState } from ‘react’;
// Main App component
const App = () => {
// State variables for form inputs and generated plan
const [name, setName] = useState(”);
const [email, setEmail] = useState(”);
const [phone, setPhone] = useState(”);
const [eventType, setEventType] = useState(”);
const [foodPreference, setFoodPreference] = useState(”);
const [sceneryPreference, setSceneryPreference] = useState(”);
const [moviePreference, setMoviePreference] = useState(”);
const [petPreference, setPetPreference] = useState(”); // ‘dog’, ‘cat’, ‘neither’
const [musicGenre, setMusicGenre] = useState(”);
const [dreamDestination, setDreamDestination] = useState(”);
const [timeOfDayVibe, setTimeOfDayVibe] = useState(”);
const [openToSurprise, setOpenToSurprise] = useState(”);
const [likes, setLikes] = useState(”);
const [dislikes, setDislikes] = useState(”);
const [ageGroup, setAgeGroup] = useState(”); // New state for age group
const [alcoholPreference, setAlcoholPreference] = useState(”); // New state for alcohol
const [plan, setPlan] = useState(”);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(”);
// Contact details for Shamrock Limousine
const SHAMROCK_EMAIL = ‘shamrocklimousine@hotmail.com’;
const SHAMROCK_CONTACT_NUMBER = ‘+17123269241’; // Single number for both text and call
/**
* Handles the generation of the date/event plan using the Gemini API.
* @param {Event} e – The form submission event.
*/
const generatePlan = async (e) => {
e.preventDefault(); // Prevent default form submission behavior
setLoading(true);
setPlan(”);
setError(”);
// Simplified validation: only show error if ALL fields are empty
const allFieldsEmpty = ![
eventType, likes, dislikes, foodPreference, sceneryPreference,
moviePreference, petPreference, musicGenre, dreamDestination,
timeOfDayVibe, openToSurprise, ageGroup, alcoholPreference
].some(field => field !== ”);
if (allFieldsEmpty) {
setError(‘Please provide at least some details to help us generate your perfect plan!’);
setLoading(false);
return;
}
// Construct the prompt for the AI model
const prompt = `
You are an expert date and event planner for Shamrock Limousine Service, a luxury limousine service.
Your goal is to create a unique and memorable experience that emphasizes the fun, convenience, and luxury of being chauffeured by Shamrock Limousine.
This experience should encourage genuine connection and discourage excessive screen time.
Based on the following details, suggest:
1. Where to go (specific places or types of venues that Shamrock Limousine can take them to).
2. What to do (activities at the location).
3. How long the couple/group should ideally spend in the Shamrock Limousine together, emphasizing conversation, enjoying the luxurious ride, and the convenience of not worrying about driving or parking.
4. What types of sights or points of interest the Shamrock Limousine driver should discreetly point out along the way (without making it feel like a tour guide, just enhancing the journey).
The overall tone should be sophisticated, comfortable, and focused on genuine experience. Make sure to integrate the benefits of using Shamrock Limousine throughout the plan.
User Preferences:
– Event Type: ${eventType || ‘Not specified’}
– Likes: ${likes || ‘Not specified’}
– Dislikes: ${dislikes || ‘None specified’}
– Age Group: ${ageGroup || ‘Not specified’}
– Alcohol Preference: ${alcoholPreference || ‘Not specified’}
– Food Preference: ${foodPreference || ‘Not specified’}
– Scenery Preference: ${sceneryPreference || ‘Not specified’}
– Movie Preference: ${moviePreference || ‘Not specified’}
– Pet Person: ${petPreference || ‘Not specified’}
– Music Genre: ${musicGenre || ‘Not specified’}
– Dream Destination (Fantasy): ${dreamDestination || ‘Not specified.’}
– Time of Day Vibe: ${timeOfDayVibe || ‘Not specified’}
– Open to Surprise: ${openToSurprise || ‘Not specified’}
Important: Remind them that the experience should be about genuine connection, not about social media or electronics. Encourage them to be present and enjoy each other’s company, letting the professional chauffeurs at Shamrock Limousine handle all the details.
`;
// Prepare the payload for the Gemini API call
const chatHistory = [{ role: “user”, parts: [{ text: prompt }] }];
const payload = { contents: chatHistory };
const apiKey = “”; // API key will be provided by Canvas runtime
const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey}`;
try {
const response = await fetch(apiUrl, {
method: ‘POST’,
headers: { ‘Content-Type’: ‘application/json’ },
body: JSON.stringify(payload)
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`API error: ${response.status} – ${errorData.error.message || ‘Unknown error’}`);
}
const result = await response.json();
if (result.candidates && result.candidates.length > 0 &&
result.candidates[0].content && result.candidates[0].content.parts &&
result.candidates[0].content.parts.length > 0) {
setPlan(result.candidates[0].content.parts[0].text);
} else {
setError(‘Could not generate a plan. Please try again.’);
console.error(“Unexpected API response structure:”, result);
}
} catch (err) {
setError(`Failed to generate plan: ${err.message}. Please check your inputs and try again.`);
console.error(“Error during API call:”, err);
} finally {
setLoading(false);
}
};
/**
* Handles sending the generated plan and user details via email.
*/
const sendPlanByEmail = () => {
if (!plan) {
customAlert(‘Please generate a plan first before sending it to Shamrock Limousine.’);
return;
}
const emailBody = `
Hello Shamrock Limousine Team,
I’d like to explore this custom event plan for my perfect experience with you!
— My Preferences & Generated Plan Details —
Name: ${name || ‘N/A’}
Email: ${email || ‘N/A’}
Phone: ${phone || ‘N/A’}
Event Type: ${eventType || ‘N/A’}
Likes: ${likes || ‘N/A’}
Dislikes: ${dislikes || ‘N/A’}
Age Group: ${ageGroup || ‘N/A’}
Alcohol Preference: ${alcoholPreference || ‘N/A’}
Food Preference: ${foodPreference || ‘N/A’}
Scenery Preference: ${sceneryPreference || ‘N/A’}
Movie Preference: ${moviePreference || ‘N/A’}
Pet Person: ${petPreference || ‘N/A’}
Music Genre: ${musicGenre || ‘N/A’}
Dream Destination (Fantasy): ${dreamDestination || ‘N/A’}
Time of Day Vibe: ${timeOfDayVibe || ‘N/A’}
Open to Surprise: ${openToSurprise || ‘N/A’}
— Your Shamrock Limousine Custom Plan —
${plan}
—
Please contact me to discuss how we can bring this experience to life!
I am excited about the fun and convenience of being chauffeured by Shamrock Limousine.
Best regards,
${name || ‘Valued Client’}
`.trim();
const mailtoLink = `mailto:${SHAMROCK_EMAIL}?subject=${encodeURIComponent(‘Inquiry: My Custom Event Plan with Shamrock Limousine’)}&body=${encodeURIComponent(emailBody)}`;
window.location.href = mailtoLink;
};
/**
* Handles sending the generated plan and user details via SMS.
*/
const sendPlanByText = () => {
if (!plan) {
customAlert(‘Please generate a plan first before sending it to Shamrock Limousine.’);
return;
}
// Shortened message for SMS due to character limits
const textBody = `
Shamrock Limo Plan Inquiry:
Name: ${name || ‘N/A’}
Event: ${eventType || ‘N/A’}
Likes: ${likes || ‘N/A’}
Details: ${plan.substring(0, 200)}… (Full plan available via email or copy/paste)
Contact: ${email || phone || ‘N/A’}
Ready to book my Shamrock Limousine experience!
`.trim();
const smsLink = `sms:${SHAMROCK_CONTACT_NUMBER}?body=${encodeURIComponent(textBody)}`;
window.location.href = smsLink;
};
/**
* Copies the generated plan to the clipboard.
*/
const copyPlanToClipboard = () => {
if (!plan) {
customAlert(‘Please generate a plan first to copy it.’);
return;
}
const fullPlanContent = `
Shamrock Limousine Custom Event Plan for ${name || ‘Valued Client’}:
— Your Preferences —
Event Type: ${eventType || ‘N/A’}
Likes: ${likes || ‘N/A’}
Dislikes: ${dislikes || ‘N/A’}
Age Group: ${ageGroup || ‘N/A’}
Alcohol Preference: ${alcoholPreference || ‘N/A’}
Food Preference: ${foodPreference || ‘N/A’}
Scenery Preference: ${sceneryPreference || ‘N/A’}
Movie Preference: ${moviePreference || ‘N/A’}
Pet Person: ${petPreference || ‘N/A’}
Music Genre: ${musicGenre || ‘N/A’}
Dream Destination (Fantasy): ${dreamDestination || ‘N/A’}
Time of Day Vibe: ${timeOfDayVibe || ‘N/A’}
Open to Surprise: ${openToSurprise || ‘N/A’}
— Generated Plan —
${plan}
—
Experience the fun and convenience of being chauffeured by Shamrock Limousine!
Contact Shamrock Limousine to book:
Email: ${SHAMROCK_EMAIL}
Phone/Text: ${SHAMROCK_CONTACT_NUMBER}
`.trim();
// Using document.execCommand(‘copy’) as navigator.clipboard.writeText() might not work in iframes
const textarea = document.createElement(‘textarea’);
textarea.value = fullPlanContent;
document.body.appendChild(textarea);
textarea.select();
try {
document.execCommand(‘copy’);
customAlert(‘Plan copied to clipboard!’);
} catch (err) {
console.error(‘Failed to copy text: ‘, err);
customAlert(‘Failed to copy plan. Please try manually selecting and copying the text.’);
} finally {
document.body.removeChild(textarea);
}
};
// Custom alert function (replaces native alert)
const customAlert = (message) => {
const existingAlert = document.getElementById(‘custom-alert’);
if (existingAlert) {
existingAlert.remove();
}
const alertDiv = document.createElement(‘div’);
alertDiv.id = ‘custom-alert’;
alertDiv.className = ‘fixed inset-0 bg-gray-900 bg-opacity-75 flex items-center justify-center z-50’;
alertDiv.innerHTML = `
${message}
`;
document.body.appendChild(alertDiv);
};
return (
{/* Larger logo */}
Tell us your preferences, and let’s craft your perfect, distraction-free experience with Shamrock Limousine.
{/* Main content area: Form and Results */}
{plan && (
Remember: This Shamrock Limousine experience is about genuine connection and unparalleled convenience. Put away your phones, engage with each other, and let our professional chauffeur handle every detail. Embrace the moment and the luxury of your ride!
‘) }} /> )}
{/* Footer */}
{/* Custom styles for loader */}
);
};
export default App;
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!