Compare commits
@@ -18,6 +18,8 @@ FROM node:alpine AS runner
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
RUN apk add --no-cache tzdata
|
||||||
|
ENV TZ="Europe/Stockholm"
|
||||||
|
|
||||||
RUN mkdir -p data
|
RUN mkdir -p data
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Footer from '../components/Footer';
|
|||||||
import Header from '../components/Header';
|
import Header from '../components/Header';
|
||||||
import BeachRegistrationForm from './BeachRegistrationForm';
|
import BeachRegistrationForm from './BeachRegistrationForm';
|
||||||
|
|
||||||
export default function BeachClientPage({ config }: { config: any }) {
|
export default function BeachClientPage({ config, turnstileSiteKey }: { config: any, turnstileSiteKey: string }) {
|
||||||
const [timeInfo, setTimeInfo] = useState({
|
const [timeInfo, setTimeInfo] = useState({
|
||||||
dateStr: 'Laddar...',
|
dateStr: 'Laddar...',
|
||||||
matchStr: 'Laddar...',
|
matchStr: 'Laddar...',
|
||||||
@@ -200,7 +200,7 @@ export default function BeachClientPage({ config }: { config: any }) {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/* Rendera formuläret endast om anmälan är öppen */}
|
{/* Rendera formuläret endast om anmälan är öppen */}
|
||||||
{!timeInfo.isClosed && <BeachRegistrationForm config={config} />}
|
{!timeInfo.isClosed && <BeachRegistrationForm config={config} turnstileSiteKey={turnstileSiteKey} />}
|
||||||
|
|
||||||
<section className="w-full flex justify-center px-4 mt-10 mb-20">
|
<section className="w-full flex justify-center px-4 mt-10 mb-20">
|
||||||
<div className="bg-linear-to-br from-[#39979f] to-[#62b8bc] p-10 md:p-12 rounded-[40px] shadow-2xl w-full max-w-2xl text-center transform transition-transform duration-500 border border-blue-400/20 relative overflow-hidden group">
|
<div className="bg-linear-to-br from-[#39979f] to-[#62b8bc] p-10 md:p-12 rounded-[40px] shadow-2xl w-full max-w-2xl text-center transform transition-transform duration-500 border border-blue-400/20 relative overflow-hidden group">
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import React, { useRef, useActionState, useEffect } from 'react';
|
|||||||
import { FaUser, FaEnvelope, FaPhone, FaUsers, FaTrophy, FaCheckCircle, FaExclamationTriangle } from "react-icons/fa";
|
import { FaUser, FaEnvelope, FaPhone, FaUsers, FaTrophy, FaCheckCircle, FaExclamationTriangle } from "react-icons/fa";
|
||||||
import { submitRegistration } from './actions';
|
import { submitRegistration } from './actions';
|
||||||
|
|
||||||
export default function BeachRegistrationForm({ config }: { config: any }) {
|
export default function BeachRegistrationForm({ config, turnstileSiteKey }: { config: any, turnstileSiteKey: string }) {
|
||||||
const [state, formAction, isPending] = useActionState(submitRegistration, null);
|
const [state, formAction, isPending] = useActionState(submitRegistration, null);
|
||||||
const formRef = useRef<HTMLFormElement>(null);
|
const formRef = useRef<HTMLFormElement>(null);
|
||||||
const turnstileRef = useRef<TurnstileInstance>(null);
|
const turnstileRef = useRef<TurnstileInstance>(null);
|
||||||
@@ -130,13 +130,7 @@ export default function BeachRegistrationForm({ config }: { config: any }) {
|
|||||||
|
|
||||||
<input type="text" name="website" className="hidden" tabIndex={-1} />
|
<input type="text" name="website" className="hidden" tabIndex={-1} />
|
||||||
|
|
||||||
<div className="flex justify-center py-2">
|
<div className="flex justify-center py-2"><Turnstile ref={turnstileRef} siteKey={turnstileSiteKey} options={{ theme: 'light' }}/></div>
|
||||||
<Turnstile
|
|
||||||
ref={turnstileRef}
|
|
||||||
siteKey={process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY || ''}
|
|
||||||
options={{ theme: 'light' }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{state && (
|
{state && (
|
||||||
<div className={`flex items-center gap-3 p-5 rounded-2xl font-bold transition-all ${state.success ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'}`}>
|
<div className={`flex items-center gap-3 p-5 rounded-2xl font-bold transition-all ${state.success ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'}`}>
|
||||||
|
|||||||
@@ -82,7 +82,15 @@ export async function submitRegistration(prevState: any, formData: FormData) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const dateStr = new Date().toISOString().replace('T', ' ').substring(0, 19);
|
const dateStr = new Date().toLocaleString('sv-SE', {
|
||||||
|
timeZone: 'Europe/Stockholm',
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit'
|
||||||
|
});
|
||||||
const cleanMessage = rawData.message ? rawData.message.replace(/[\r\n;]/g, " ") : "";
|
const cleanMessage = rawData.message ? rawData.message.replace(/[\r\n;]/g, " ") : "";
|
||||||
|
|
||||||
// Mail till klubben
|
// Mail till klubben
|
||||||
|
|||||||
+7
-2
@@ -2,11 +2,16 @@
|
|||||||
import { getConfig } from '../lib/config';
|
import { getConfig } from '../lib/config';
|
||||||
import BeachClientPage from './BeachClientPage';
|
import BeachClientPage from './BeachClientPage';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: 'Beachturnering',
|
title: 'Beachturnering',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function BeachPage() {
|
export default async function BeachPage() {
|
||||||
const config = await getConfig();
|
const config = await getConfig();
|
||||||
return <BeachClientPage config={config} />;
|
|
||||||
}
|
const turnstileSiteKey = process.env.TURNSTILE_SITE_KEY || '';
|
||||||
|
|
||||||
|
return <BeachClientPage config={config} turnstileSiteKey={turnstileSiteKey} />;
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
NEXT_PUBLIC_TURNSTILE_SITE_KEY=1x00000000000000000000AA
|
TURNSTILE_SITE_KEY=1x00000000000000000000AA
|
||||||
TURNSTILE_SECRET=1x0000000000000000000000000000000AA
|
TURNSTILE_SECRET=1x0000000000000000000000000000000AA
|
||||||
|
|
||||||
ADMIN_PASSWORD=PASSWORD
|
ADMIN_PASSWORD=PASSWORD
|
||||||
|
|||||||
Generated
+501
-400
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@marsidev/react-turnstile": "^1.4.2",
|
"@marsidev/react-turnstile": "^1.4.2",
|
||||||
"next": "16.1.6",
|
"next": "^16",
|
||||||
"nodemailer": "^8.0.1",
|
"nodemailer": "^8.0.1",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
@@ -28,4 +28,4 @@
|
|||||||
"tailwindcss": "^4.2.1",
|
"tailwindcss": "^4.2.1",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user