-
Notifications
You must be signed in to change notification settings - Fork 31
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
Update GameDetails title to show the game score - closes #111 #112
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/willianjusten/nba-remix/CafZXWgj9M6ekdXT3hfvQPcJdtsj |
app/routes/game/$year/$gameId.tsx
Outdated
} | ||
|
||
export default function Game() { | ||
export default function GameDetails() { | ||
const { game: loaderGame } = useLoaderData() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want loaderGame
to be typed in within the React Component, then you should do:
const { game: loaderGame } = useLoaderData<LoaderData>()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops, missed this point indeed xD
app/routes/game/$year/$gameId.tsx
Outdated
const setTitle = (game: Game) => { | ||
document.title = `${game.vTeam.tn} ${game.vTeam.score} x ${game.hTeam.score} ${game.hTeam.tn} | NBA Remix` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to get game
data in meta tags to set the programmatic values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already use the meta tags values to the other data, I did this way because we want to refresh the values as soon as we get new data from the fetch without refreshing the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try something different after, I created this more to see if it works but definitely can be improved.
Description
This PR adds the option to show the game score right into the browser tab with its title. I also added the same typing that @vedovelli did on #109 and since we need this title to be updated even without being the active tab, I removed the logic to check the tab (note: this only occurs on this page, the index page will keep the refetch only when active)
After