diff --git a/src/firebase_instance.py b/src/firebase_instance.py index 20cc58c..7e6bd76 100644 --- a/src/firebase_instance.py +++ b/src/firebase_instance.py @@ -26,8 +26,8 @@ "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_secret": os.getenv("OAUTH_TOKEN"), - "redirect_uris": ["http://localhost:5000/api/oauth2callback"] if os.getenv("FLASK_ENV") == "development" else ["https://roboregistry.vercel.app/api/oauth2callback"], - "javascript_origins": ["http://localhost:5000"] if os.getenv("FLASK_ENV") == "development" else ["https://roboregistry.vercel.app"] + "redirect_uris": ["http://localhost:5000/api/oauth2callback"] if os.getenv("FLASK_ENV") == 'development' else ["https://roboregistry.vercel.app/api/oauth2callback"], + "javascript_origins": ["http://localhost:5000"] if os.getenv("FLASK_ENV") == 'development' else ["https://roboregistry.vercel.app"] } } diff --git a/src/static/internal_api.js b/src/static/internal_api.js index 8823e70..a6f8ce8 100644 --- a/src/static/internal_api.js +++ b/src/static/internal_api.js @@ -40,3 +40,35 @@ async function fetchDashboard() { count++; } } + +const controller = new AbortController(); +async function setTeamData(number) { + const signal = controller.signal; + + let data = null; + while (!data) { + const response = await fetch(`/api/get_team_data/${number}`, { signal }); + try { + data = await response.json(); + } catch (e) { + console.warn(`API: Could not fetch info for team ${number}. Retrying...`); + } + } + + const target = document.getElementById(number); + if (!data.valid) { + // Team is not FIRST registered, ask for a name manually + target.innerHTML = `
`; + return; + } + + // Team is registered, display info + if (data.data.length > 1) { + // TODO: More than one team, display a dropdown + } else { + // Only one team, display info + const team = data.data[0]; + const suffix = team.program === "FIRST Tech Challenge" ? "FTC" : team.program === "FIRST Robotics Competition" ? "FRC" : "FLL"; + target.innerHTML = `${team.nickname} (${suffix})`; + } +} diff --git a/src/static/styles.css b/src/static/styles.css index 2b7b09b..86d7b09 100644 --- a/src/static/styles.css +++ b/src/static/styles.css @@ -1,6 +1,9 @@ * { font-family: "Inter", sans-serif; opacity: 1; +} + +*:not(.fade) { animation: fadeIn 250ms; } diff --git a/src/templates/event/register.html.jinja b/src/templates/event/register.html.jinja index cbb00f2..450610c 100644 --- a/src/templates/event/register.html.jinja +++ b/src/templates/event/register.html.jinja @@ -16,32 +16,61 @@ Register for: {{ event.name }}

-

We'll need to get some information, so we can gauge how many teams are coming to this +

We'll need to get some information, so we can gauge how many people are coming to this event.

- + placeholder="e.g. FIRST, Murray Bridge High School, General Public" required>
- +
- - + +
- Incase of unexpected event changes, the event owner will be able to contact your preferred contact email + Incase of unexpected event changes, the event owner can choose to contact your preferred contact email and/or phone number listed here.

Cancel - + + {% endblock %} @@ -90,7 +123,8 @@ Register for: {{ event.name }} {% block scripts %} - + {% endblock %} \ No newline at end of file diff --git a/src/templates/layout.html.jinja b/src/templates/layout.html.jinja index 791ee64..dcc4dc2 100644 --- a/src/templates/layout.html.jinja +++ b/src/templates/layout.html.jinja @@ -24,13 +24,82 @@ {% block navbar %}{% endblock %} +
{% block body %}{% endblock %}