Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions client/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import type { NextConfig } from "next";

// Determine if we're building for GitHub Pages
const isGitHubPages = process.env.GITHUB_PAGES === 'true' || process.env.GITHUB_ACTIONS === 'true';
// Determine if we're building for static GitHub Pages (only when explicitly set)
const isGitHubPages = process.env.DEPLOY_TARGET === 'github-pages';

// Base path for GitHub Pages deployment
const basePath = isGitHubPages ? '/Sharothee-Wedding-arvinwedsincia' : '';

const nextConfig: NextConfig = {
// Enable static export for GitHub Pages deployment
output: 'export',
// Only enable static export for GitHub Pages deployment
// For VPS/production deployment, we need server-side features (API routes, NextAuth)
...(isGitHubPages ? { output: 'export' as const } : {}),

// Configure for GitHub Pages subdirectory deployment
basePath: basePath,
assetPrefix: basePath,
// Configure for GitHub Pages subdirectory deployment (only when needed)
...(isGitHubPages ? {
basePath: basePath,
assetPrefix: basePath,
trailingSlash: true,
} : {}),

// Add trailing slash for GitHub Pages compatibility
trailingSlash: true,

// Output directory for static export
// Output directory
distDir: '.next',

// Optimize images - unoptimized for static export
// Optimize images - unoptimized only for static export
images: {
unoptimized: true,
unoptimized: isGitHubPages,
},

// Experimental features
Expand All @@ -33,6 +34,7 @@ const nextConfig: NextConfig = {
// Environment variables available to the browser
env: {
NEXT_PUBLIC_BASE_PATH: basePath,
NEXT_PUBLIC_API_AVAILABLE: isGitHubPages ? 'false' : 'true',
},
};

Expand Down
Binary file modified client/prisma/prisma/dev.db
Binary file not shown.
18 changes: 11 additions & 7 deletions client/src/lib/serverless-forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export function isStaticMode(): boolean {
if (typeof window === 'undefined') return false;
// Check if API routes are available by testing environment
const isGitHubPages = window.location.hostname.includes('github.io');
return isGitHubPages || !process.env.NEXT_PUBLIC_API_AVAILABLE;
const apiAvailable = process.env.NEXT_PUBLIC_API_AVAILABLE === 'true';
return isGitHubPages || !apiAvailable;
}

/**
Expand Down Expand Up @@ -150,6 +151,9 @@ async function submitViaWeb3Forms(
formData.append('subject', `${formType} Submission - Incia & Arvin's Wedding`);
formData.append('from_name', 'Wedding Website');

// Send notification email TO codestromhub@gmail.com
formData.append('email', 'codestromhub@gmail.com');

// Set from email to codestromhub@gmail.com
formData.append('from_email', 'codestromhub@gmail.com');

Expand All @@ -159,21 +163,21 @@ async function submitViaWeb3Forms(
// Add form-specific data
if (formType === 'RSVP') {
const rsvpData = data as RSVPFormData;
const userEmail = rsvpData.contact?.email || rsvpData.email || 'codestromhub@gmail.com';
const userEmail = rsvpData.contact?.email || rsvpData.email || 'Not provided';

// Send email to the user who submitted the form
formData.append('email', userEmail);
formData.append('name', rsvpData.guestName || 'Guest');
formData.append('message', formatRSVPMessage(rsvpData));
// Include submitter's email in the message content
formData.append('Submitter Email', userEmail);
Comment on lines +170 to +171
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'Submitter Email' as a field name may cause issues with Web3Forms processing. Form field names should typically use lowercase with underscores or hyphens (e.g., 'submitter_email' or 'user-email') to ensure consistent processing by email services.

Copilot uses AI. Check for mistakes.
} else {
const contactData = data as ContactFormData;
const userEmail = contactData.email || 'codestromhub@gmail.com';
const userEmail = contactData.email || 'Not provided';

// Send email to the user who submitted the form
formData.append('email', userEmail);
formData.append('name', contactData.name || 'Guest');
formData.append('message', contactData.message || '');
formData.append('phone', contactData.phone || '');
// Include submitter's email in the message content
formData.append('Submitter Email', userEmail);
Comment on lines +179 to +180
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'Submitter Email' as a field name may cause issues with Web3Forms processing. Form field names should typically use lowercase with underscores or hyphens (e.g., 'submitter_email' or 'user-email') to ensure consistent processing by email services.

Copilot uses AI. Check for mistakes.
}

// Submit to Web3Forms
Expand Down