Skip to content

Commit

Permalink
Merge pull request #30 from Infinity-Times-Two/dev
Browse files Browse the repository at this point in the history
FIX: Editing a game populates the form
  • Loading branch information
Jamesllllllllll authored Apr 16, 2024
2 parents 5811a62 + 676d913 commit a5d4e98
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/app/components/createGame/NewGameForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ export default function NewGameForm({ editGame }: { editGame?: string }) {
}
let gameData: Game = defaultGameData;

if (localStorageData) {
gameData = JSON.parse(localStorageData);
setNewGame(gameData);
} else if (editGame === singleGame.id) {
if (editGame === singleGame.id) {
gameData = singleGame;
setNewGame(gameData);
saveForm(gameData);
} else {
} else if (localStorageData) {
gameData = JSON.parse(localStorageData);
setNewGame(gameData);
} else {
if (user.firstName === '') {
gameData.author = 'Anonymous';
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ export default function FillInTheBlankChallenge({
required
/>
</div>
<div className='flex flex-row'>
{error && (

{error && (
<div className='flex flex-row'>
<div role='alert' className='alert alert-warning mx-4 self-center'>
<svg
xmlns='http://www.w3.org/2000/svg'
Expand All @@ -201,8 +202,8 @@ export default function FillInTheBlankChallenge({
</svg>
<span>{errorMessage}</span>
</div>
)}
</div>
</div>
)}
<Card>
<div
className={`flex flex-col gap-2 flex-wrap justify-center min-h-[100px] w-full ${
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/ui/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Card({
}) {

return (
<div className='w-full sm:mx-8'>
<div className='w-full'>
<div className='rounded-md bg-black font-semibold m-2 self-start'>
<div
className={`card ${
Expand Down

0 comments on commit a5d4e98

Please sign in to comment.