Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added username when send scout #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
41 changes: 38 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"deploy": "ng build --configuration production && firebase deploy --only hosting,firestore:rules",
"test": "ng test",
"firebase:environment": "node scripts/firebase.js",
"create": "node scripts/create.js && npm run firebase:environment && npm run deploy"
"create": "node scripts/create.js && npm run firebase:environment && npm run deploy",
"TBA:key": "node scripts/TBAkey.js"
},
"private": true,
"dependencies": {
Expand Down
23 changes: 23 additions & 0 deletions scripts/TBAkey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { writeFileSync } = require("fs")
const { join } = require("path")
const { exit } = require("process")
const { createInterface } = require("readline")

const rl = createInterface({
input: process.stdin,
output: process.stdout,
})

const prompt = (query) => new Promise((resolve) => rl.question(query, resolve))

const main = async () => {
const output = await prompt(
"Please create a TBA key and enter it here (If you paste the key from somwhere please press delete one time before press enter): "
)
const configuration = '{ "TBAKey" :' + '"' + output + '"' + "}"
writeFileSync(join("src", "environments", "secrets.json"), configuration)

exit(0)
}

main()
7 changes: 5 additions & 2 deletions src/app/components/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export class FormComponent implements OnInit {

get scout(): Scout {
const result: Scout = {}
result["Scouter"] = {}
result["Scouter"]["Name"] = this.authentication.user?.displayName
for (let i = 0; i < localStorage.length; i++) {
let fullKey = localStorage.key(i)
if (!fullKey?.startsWith(storagePrefix)) {
Expand All @@ -109,10 +111,9 @@ export class FormComponent implements OnInit {
}

const key = fullKey.substring(prefix.length + 1)

console.log(result)
result[prefix][key] = value
}

return result
}

Expand Down Expand Up @@ -193,6 +194,7 @@ export class FormComponent implements OnInit {
}

showTeams() {
console.log("i search teams from tba")
this.redTeams = []
this.blueTeams = []
if (
Expand All @@ -211,6 +213,7 @@ export class FormComponent implements OnInit {

this.redTeams = redTeams
this.blueTeams = blueTeams
console.log("this is the teams i find", redTeams, blueTeams)
}

async fetchScout(): Promise<void> {
Expand Down