Füge Validierung für E-Mail und benutzerdefinierte Eingaben hinzu; aktualisiere Firebase-Konfigurationsdateien
This commit is contained in:
5
.firebaserc
Normal file
5
.firebaserc
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"projects": {
|
||||||
|
"default": "skatabend0"
|
||||||
|
}
|
||||||
|
}
|
||||||
20
.github/workflows/firebase-hosting-merge.yml
vendored
Normal file
20
.github/workflows/firebase-hosting-merge.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# This file was auto-generated by the Firebase CLI
|
||||||
|
# https://github.com/firebase/firebase-tools
|
||||||
|
|
||||||
|
name: Deploy to Firebase Hosting on merge
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
build_and_deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: npm ci && npm run build
|
||||||
|
- uses: FirebaseExtended/action-hosting-deploy@v0
|
||||||
|
with:
|
||||||
|
repoToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_SKATABEND0 }}
|
||||||
|
channelId: live
|
||||||
|
projectId: skatabend0
|
||||||
21
.github/workflows/firebase-hosting-pull-request.yml
vendored
Normal file
21
.github/workflows/firebase-hosting-pull-request.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# This file was auto-generated by the Firebase CLI
|
||||||
|
# https://github.com/firebase/firebase-tools
|
||||||
|
|
||||||
|
name: Deploy to Firebase Hosting on PR
|
||||||
|
on: pull_request
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
jobs:
|
||||||
|
build_and_preview:
|
||||||
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: npm ci && npm run build
|
||||||
|
- uses: FirebaseExtended/action-hosting-deploy@v0
|
||||||
|
with:
|
||||||
|
repoToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_SKATABEND0 }}
|
||||||
|
projectId: skatabend0
|
||||||
16
firebase.json
Normal file
16
firebase.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"hosting": {
|
||||||
|
"public": "build",
|
||||||
|
"ignore": [
|
||||||
|
"firebase.json",
|
||||||
|
"**/.*",
|
||||||
|
"**/node_modules/**"
|
||||||
|
],
|
||||||
|
"rewrites": [
|
||||||
|
{
|
||||||
|
"source": "**",
|
||||||
|
"destination": "/index.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
21
src/App.js
21
src/App.js
@@ -3,7 +3,7 @@ import './App.css';
|
|||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const formSectionRef = useRef(null);
|
const formSectionRef = useRef(null);
|
||||||
const [customNumber, setCustomNumber] = useState();
|
const [customNumber, setCustomNumber] = useState(false);
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
|
|
||||||
|
|
||||||
@@ -24,11 +24,24 @@ function App() {
|
|||||||
setCustomNumber(e.target.value === 'custom' ? '' : e.target.value);
|
setCustomNumber(e.target.value === 'custom' ? '' : e.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const emailIsValid = (email1) => {
|
||||||
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email1)
|
||||||
|
}
|
||||||
|
|
||||||
const submit = (e) => {
|
const submit = (e) => {
|
||||||
e.preventDefault(); // Verhindert das Standardverhalten des Formulars
|
e.preventDefault(); // Verhindert das Standardverhalten des Formulars
|
||||||
if (email === ""){
|
if (!emailIsValid(email)){
|
||||||
|
alert("Bitte eine gültige E-Mailadresse eintrgen");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if(!customNumber){
|
||||||
|
alert("Bitte angeben wie viele Personen mitkommen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// send data
|
||||||
|
alert("Anmeldung gesendet.")
|
||||||
|
setEmail("")
|
||||||
|
setCustomNumber(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -54,7 +67,7 @@ function App() {
|
|||||||
<div id="form-section" ref={formSectionRef}>
|
<div id="form-section" ref={formSectionRef}>
|
||||||
<form>
|
<form>
|
||||||
<label>E-Mail:</label>
|
<label>E-Mail:</label>
|
||||||
<input type="email" name="email" placeholder="Deine E-Mail-Adresse" onChange={(e => setEmail(e.target.value))} />
|
<input type="email" name="email" placeholder="Deine E-Mail-Adresse" onChange={(e => setEmail(e.target.value))} value={email}/>
|
||||||
<br />
|
<br />
|
||||||
<label>Anzahl der Personen</label>
|
<label>Anzahl der Personen</label>
|
||||||
<div className="radio-group">
|
<div className="radio-group">
|
||||||
|
|||||||
Reference in New Issue
Block a user