evanwinter / game-tracker Goto Github PK
View Code? Open in Web Editor NEWTrack game results among friends.
Home Page: https://game-tracker.netlify.com
License: MIT License
Track game results among friends.
Home Page: https://game-tracker.netlify.com
License: MIT License
Possible approaches:
Currently, they're unrelated; the app doesn't care who the logged-in user is. Keeping track of the logged-in user would enable things like an Account/Profile page, showing games the user has played in. It could also simplify the player selection step by only needing to choose their opponents and not themself.
Players would need to be created without them logging into the app themself, so there would need to be a distinction between an authenticated player and an anonymous player.
As far as nuts and bolts, I think it'd be a matter of shifting the player uid
to a random key instead of their name (leverage Firestore doc IDs here!), and adding an isAuthorized
property.
player: { uid: "evan winter" }
becomes...
players: { uid: <unique_key>, name: "evan winter", isAuthorized: false }
<unique_key> would be randomly generated upon creation.
In theory, anytime a player is being added from the UI, they're an AnonPlayer.
When a player signs in to the app, we need to add them as an AuthPlayer -- unless they're already created by someone else as an AnonPlayer.
We could do something like this in the Modal component:
afterLogIn(user) {
if (players.names.includes(user.name) && !isAuthorized) {
showModal("Is this you? Yes or No")
if (yes) isAuthorized = true
if (no) createNewAuthorizedUser(user)
}
}
createAuthorizedUser(user) {
return { uid: <random_key>, name: user.name, isAuthorized: true }
}
createAnonUser(name) {
return { uid: <random_key>, name: name, isAuthorized: false }
}
On Winner step, add some sort of "Include Scores" checkbox or toggle. If checked, display a list item for each player and an input for their score.
Think about how different games score things differently –– will this always (or almost always) work? I can't think of a situation where the score is something more complex than a single number for each player, but idk.
Data can be stored like this:
result = {
game: "Carcassone"
players: ["evan winter", "emily buchberger"],
winner: [],
isTie: false,
scores: {
"evan winter": 75,
"emily buchberger": 68
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.