-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Why Handlers were broken, requiring full page refresh and login when submiting approval, using faucet, among other actions. ## How By updating event handler logic, namely: - adding a `isGuessCorrect` method that checks if the player's latest guess is correct and sets the winning condition / prevents new guesses to be submited; - implementing a `logout` event handler that complements wagmi `disconnect` with resetting all variables to an undefined state; - relocate and spread balance checkers throughout "gate" actions (`useFaucet`, `approveGame` and so on); - adds a Victory screen (to be styled and added later); Closes #14
- Loading branch information
Showing
19 changed files
with
3,030 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react"; | ||
|
||
export function SignOutIcon(): JSX.Element { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="24px" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M8.25 9V5.25A2.25 2.25 0 0 1 10.5 3h6a2.25 2.25 0 0 1 2.25 2.25v13.5A2.25 2.25 0 0 1 16.5 21h-6a2.25 2.25 0 0 1-2.25-2.25V15M12 9l3 3m0 0-3 3m3-3H2.25" | ||
/> | ||
</svg> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.admin { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.admin-button { | ||
display: flex; | ||
gap: 10px; | ||
align-items: center; | ||
padding: 10px; | ||
border: 1px solid var(--soft-white); | ||
border-radius: 100px; | ||
} | ||
|
||
.admin-options { | ||
position: fixed; | ||
top: 0px; | ||
left: 20%; | ||
display: flex; | ||
flex-direction: column; | ||
text-align: left; | ||
gap: 20px; | ||
border: 2px solid #424242; | ||
padding: 20px; | ||
background: #242424; | ||
} | ||
|
||
.change-word { | ||
display: flex; | ||
} | ||
|
||
.change-word input { | ||
margin: -10px; | ||
} | ||
|
||
.change-word input:focus, | ||
.change-word input:active, | ||
.change-word input:focus-visible { | ||
outline: none; | ||
box-shadow: none; | ||
} | ||
|
||
.change-word button { | ||
margin: -10px; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { useState } from "react" | ||
import { useAccount } from "wagmi" | ||
import './AdminPanel.css' | ||
import { changeWord } from "../../hooks/WordleHooks" | ||
|
||
export function AdminPanel() { | ||
const [newWord, setNewWord] = useState("") | ||
const [isOpen, setIsOpen] = useState(false) | ||
|
||
const { address } = useAccount() | ||
|
||
function handleChange (e) { | ||
setNewWord(e.target.value) | ||
} | ||
return ( | ||
<div className="admin"> | ||
{!isOpen && <button className="admin-button" onClick={() => setIsOpen(!isOpen)}>Admin</button>} | ||
{isOpen && <div className={'admin-options transition-in'}> | ||
<button className='close-button'onClick={() => setIsOpen(false)}>X</button> | ||
<p className='title'>Change word:</p> | ||
<div className={'change-word'}> | ||
<input placeholder="new word" onChange={handleChange}/> | ||
<button className={'change-word-button'} onClick={() => changeWord(address, newWord)}>Submit</button> | ||
</div> | ||
</div>} | ||
{isOpen && <div className="admin-overlay" onClick={() => setIsOpen(false)}></div>} | ||
</div> | ||
) | ||
} |
Oops, something went wrong.