-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from matiasbenary/fixName
fix: show the name and run prettier
- Loading branch information
Showing
11 changed files
with
263 additions
and
216 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
export default function Form({ onSubmit, currentAccountId }) { | ||
return ( | ||
<form onSubmit={onSubmit} className="p-4 border rounded shadow-sm"> | ||
<fieldset id="fieldset"> | ||
<h2 className="mb-4">Guest Book</h2> | ||
<p>Sign the guest book, {currentAccountId}!</p> | ||
<div className="mb-3"> | ||
<label htmlFor="message" className="form-label"> | ||
Message: | ||
</label> | ||
<input | ||
autoComplete="off" | ||
autoFocus | ||
id="message" | ||
className="form-control" | ||
required | ||
/> | ||
</div> | ||
<div className="mb-3"> | ||
<label htmlFor="donation" className="form-label"> | ||
Donation (optional): | ||
</label> | ||
<div className="input-group"> | ||
<input | ||
autoComplete="off" | ||
defaultValue={"0"} | ||
id="donation" | ||
min="0" | ||
step="0.01" | ||
type="number" | ||
className="form-control" | ||
/> | ||
<span className="input-group-text" title="NEAR Tokens"> | ||
Ⓝ | ||
</span> | ||
</div> | ||
</div> | ||
<button type="submit" className="btn btn-primary w-100"> | ||
Sign Guest Book | ||
</button> | ||
</fieldset> | ||
</form> | ||
); | ||
return ( | ||
<form onSubmit={onSubmit} className="p-4 border rounded shadow-sm"> | ||
<fieldset id="fieldset"> | ||
<h2 className="mb-4">Guest Book</h2> | ||
<p>Sign the guest book, {currentAccountId}!</p> | ||
<div className="mb-3"> | ||
<label htmlFor="message" className="form-label"> | ||
Message: | ||
</label> | ||
<input | ||
autoComplete="off" | ||
autoFocus | ||
id="message" | ||
className="form-control" | ||
required | ||
/> | ||
</div> | ||
<div className="mb-3"> | ||
<label htmlFor="donation" className="form-label"> | ||
Donation (optional): | ||
</label> | ||
<div className="input-group"> | ||
<input | ||
autoComplete="off" | ||
defaultValue={"0"} | ||
id="donation" | ||
min="0" | ||
step="0.01" | ||
type="number" | ||
className="form-control" | ||
/> | ||
<span className="input-group-text" title="NEAR Tokens"> | ||
Ⓝ | ||
</span> | ||
</div> | ||
</div> | ||
<button type="submit" className="btn btn-primary w-100"> | ||
Sign Guest Book | ||
</button> | ||
</fieldset> | ||
</form> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
export default function Messages({ messages }) { | ||
return ( | ||
<div className="container"> | ||
<h2 className="my-4">Messages</h2> | ||
{messages.map((message, i) => ( | ||
<div | ||
key={i} | ||
className={`card mb-3 ${message.premium ? "border-primary" : ""}`} | ||
> | ||
<div className="card-body"> | ||
<h5 className="card-title"> | ||
<strong>{message.sender}</strong> | ||
{message.premium && ( | ||
<span className="badge bg-primary ms-2">Premium</span> | ||
)} | ||
</h5> | ||
<p className="card-text">{message.text}</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
return ( | ||
<div className="container"> | ||
<h2 className="my-4">Messages</h2> | ||
{messages.map((message, i) => ( | ||
<div | ||
key={i} | ||
className={`card mb-3 ${message.premium ? "border-primary" : ""}`} | ||
> | ||
<div className="card-body"> | ||
<h5 className="card-title"> | ||
<strong>{message.sender}</strong> | ||
{message.premium && ( | ||
<span className="badge bg-primary ms-2">Premium</span> | ||
)} | ||
</h5> | ||
<p className="card-text">{message.text}</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
export default function SignIn() { | ||
return ( | ||
<> | ||
<p> | ||
This app demonstrates a key element of NEAR’s UX: once an app has | ||
permission to make calls on behalf of a user (that is, once a user signs | ||
in), the app can make calls to the blockchain for them without prompting | ||
extra confirmation. So you’ll see that if you don’t include a donation, | ||
your message gets posted right to the guest book. | ||
</p> | ||
<p> | ||
But, if you do add a donation, then NEAR will double-check that you’re | ||
ok with sending money to this app. | ||
</p> | ||
<p>Go ahead and sign in to try it out!</p> | ||
</> | ||
); | ||
return ( | ||
<> | ||
<p> | ||
This app demonstrates a key element of NEAR’s UX: once an app has | ||
permission to make calls on behalf of a user (that is, once a user signs | ||
in), the app can make calls to the blockchain for them without prompting | ||
extra confirmation. So you’ll see that if you don’t include a donation, | ||
your message gets posted right to the guest book. | ||
</p> | ||
<p> | ||
But, if you do add a donation, then NEAR will double-check that you’re | ||
ok with sending money to this app. | ||
</p> | ||
<p>Go ahead and sign in to try it out!</p> | ||
</> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,23 +1,28 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { useEffect, useState } from "react"; | ||
|
||
import '@/styles/globals.css'; | ||
import { NearContext } from '@/context'; | ||
import { Navigation } from '@/components/Navigation'; | ||
import "@/styles/globals.css"; | ||
import { NearContext } from "@/context"; | ||
import { Navigation } from "@/components/Navigation"; | ||
|
||
import { Wallet } from '@/wallets/near'; | ||
import { NetworkId, GuestbookNearContract } from '@/config'; | ||
import { Wallet } from "@/wallets/near"; | ||
import { NetworkId, GuestbookNearContract } from "@/config"; | ||
|
||
const wallet = new Wallet({ createAccessKeyFor: GuestbookNearContract, networkId: NetworkId }); | ||
const wallet = new Wallet({ | ||
createAccessKeyFor: GuestbookNearContract, | ||
networkId: NetworkId, | ||
}); | ||
|
||
export default function MyApp({ Component, pageProps }) { | ||
const [signedAccountId, setSignedAccountId] = useState(''); | ||
const [signedAccountId, setSignedAccountId] = useState(""); | ||
|
||
useEffect(() => { wallet.startUp(setSignedAccountId) }, []); | ||
useEffect(() => { | ||
wallet.startUp(setSignedAccountId); | ||
}, []); | ||
|
||
return ( | ||
<NearContext.Provider value={{ wallet, signedAccountId }}> | ||
<Navigation /> | ||
<Component {...pageProps} /> | ||
</NearContext.Provider> | ||
); | ||
} | ||
} |
Oops, something went wrong.