From e804bab90a955ead0e41e983c57aac9c611ab8d2 Mon Sep 17 00:00:00 2001 From: Joy <138333978+joypan1@users.noreply.github.com> Date: Wed, 14 Feb 2024 19:47:37 -0500 Subject: [PATCH 1/4] about us --- pages/aboutus.html | 81 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 11 deletions(-) diff --git a/pages/aboutus.html b/pages/aboutus.html index 3c1ff1a..ca65e2c 100644 --- a/pages/aboutus.html +++ b/pages/aboutus.html @@ -5,23 +5,82 @@ About Us + +
+

Longmetal 7127

+
+
+ Teams + Team Details + About Us +
+
-

About Us

+

About Us

+ +
+

Our robot capabilities:

+
+ +

Autonomous

+ +
+

TeleOp

+ +
+

Human Player

+ +
  • prefer the coopertition button
  • +
  • don't attempt the spotlight
  • + +
    +
    +

    Our Stats:

    +
    +
    +

    Current Ranking:

    +
    +

    Average points scored:

    +
    - \ No newline at end of file + From d7f8d4ca08d07e852bb960492c6f4e10514b0662 Mon Sep 17 00:00:00 2001 From: Joy <138333978+joypan1@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:58:21 -0500 Subject: [PATCH 2/4] annotated to break down code --- index.html | 2 +- pages/aboutus.html | 3 +++ pages/teamdetails.js | 28 ++++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 6579167..dc22c2f 100644 --- a/index.html +++ b/index.html @@ -36,7 +36,7 @@

    Longmetal 7127 4

    Teams

    - +
    diff --git a/pages/aboutus.html b/pages/aboutus.html index ca65e2c..2363730 100644 --- a/pages/aboutus.html +++ b/pages/aboutus.html @@ -82,5 +82,8 @@

    Our Stats:


    Average points scored:


    + + + diff --git a/pages/teamdetails.js b/pages/teamdetails.js index bd2af40..86abeda 100644 --- a/pages/teamdetails.js +++ b/pages/teamdetails.js @@ -1,29 +1,49 @@ // Initialize IndexedDB database + +//NOTE: we need to rename all of the variables in here from the "To-Do List" template to our "Teams" + +//NOTE: I added ChatGPT-based explanations to break down this code because otherwise it's unintelligible lol + +// QUESTION: Are teams that are deleted from the site also deleted from the local DB? + const db = new Dexie("Todo App"); db.version(1).stores({ todos: "++id, todo, globalid" }); + // the database sets up an object "todos" (need to rename) that consists of: + // ++id - auto-incrementing primary key/field named "id" + // todo - a field called "todo" + // globalid - a field called "globalid," used to identify teams + // Function to extract query parameter from URL function getQueryParam(name) { const urlParams = new URLSearchParams(window.location.search); return urlParams.get(name); } + // URLs look like ... /scouting2024/pages/teamdetails.html?globalid=____ + // the ? denotes the start of URL/query parameters (which are used to pass data to web page thru URL) + // and globalid has a value (unique UTC time) that identifies the team (i.e. 1708014161661) + // Function to fetch team details using globalid async function fetchTeamDetails(globalid) { const team = await db.todos.where({ globalid: Number(globalid) }).first(); return team; } + // fetchTeamDetails is where info is pulled from local database + // Fetch globalid from URL query parameter const globalid = getQueryParam("globalid"); + // searches the URL parameters for a key called globalid and saved value in constant + // Fetch and display team details -if (globalid) { +if (globalid) { // if globalid isn't null, undef, empty, etc. fetchTeamDetails(globalid).then(team => { - if (team) { - const teamDetailsDiv = document.getElementById("team-details"); + if (team) { // if team details successfully fetched + const teamDetailsDiv = document.getElementById("team-details"); // there is a div with id "team-details" on team details page teamDetailsDiv.innerHTML = `

    Team Name: ${team.todo}

    `; - } else { + } else { // team details not fetched console.error("Team not found"); } }).catch(error => { From b3e7e8efa9a89eb31534e5b090a060a949397870 Mon Sep 17 00:00:00 2001 From: Joy <138333978+joypan1@users.noreply.github.com> Date: Thu, 15 Feb 2024 12:18:45 -0500 Subject: [PATCH 3/4] need to connect submit button to form submission --- pages/teamdetails.html | 5 ++++- pages/teamdetails.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pages/teamdetails.html b/pages/teamdetails.html index d610406..866bd0c 100644 --- a/pages/teamdetails.html +++ b/pages/teamdetails.html @@ -59,7 +59,10 @@

    Team Details

    - + + + + diff --git a/pages/teamdetails.js b/pages/teamdetails.js index 86abeda..2ec1102 100644 --- a/pages/teamdetails.js +++ b/pages/teamdetails.js @@ -37,6 +37,10 @@ const globalid = getQueryParam("globalid"); // searches the URL parameters for a key called globalid and saved value in constant +/*document.getElementById("submit").addEventListener("submit", function(event){ + print("hello world") +})*/ + // Fetch and display team details if (globalid) { // if globalid isn't null, undef, empty, etc. fetchTeamDetails(globalid).then(team => { From 62ccd83f6ea5d1655ec12a971aaeb8c2985a8186 Mon Sep 17 00:00:00 2001 From: jmurgolo Date: Fri, 16 Feb 2024 10:10:04 -0500 Subject: [PATCH 4/4] offline testing --- index.html | 20 +++++++++++++++++++- sw.js | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 sw.js diff --git a/index.html b/index.html index dc22c2f..aaeae78 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,25 @@ - +