-
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.
feat(frontend): implement grant and claim proposal pages
- Loading branch information
1 parent
5f25112
commit 4c1539f
Showing
13 changed files
with
723 additions
and
33 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,95 @@ | ||
--- | ||
id: 0 | ||
name: Devnet deployment | ||
network: devnet | ||
stacks-node: "http://localhost:20443" | ||
bitcoin-node: "http://devnet:devnet@localhost:18443" | ||
plan: | ||
batches: | ||
- id: 0 | ||
transactions: | ||
- contract-publish: | ||
contract-name: extension-trait | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 1670 | ||
path: contracts/extension-trait.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: proposal-trait | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 1680 | ||
path: contracts/proposal-trait.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: core | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 22660 | ||
path: contracts/core.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: membership-token | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 17200 | ||
path: contracts/membership-token.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: bootstrap | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 15470 | ||
path: contracts/bootstrap.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: milestone-extension | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 26090 | ||
path: contracts/milestone-extension.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: grant-milestone-claim-proposal | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 4540 | ||
path: contracts/grant-milestone-claim-proposal.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: grant-proposal | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 9270 | ||
path: contracts/grant-proposal.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: hello-world | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 12460 | ||
path: contracts/hello-world.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: milestone-extension-proposal | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 7600 | ||
path: contracts/milestone-extension-proposal.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: proposal-voting | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 37540 | ||
path: contracts/proposal-voting.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
- contract-publish: | ||
contract-name: proposal-submission | ||
expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM | ||
cost: 16350 | ||
path: contracts/proposal-submission.clar | ||
anchor-block-only: true | ||
clarity-version: 2 | ||
epoch: "2.1" |
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,76 @@ | ||
import React, { useEffect } from 'react'; | ||
import { Editor, loader } from '@monaco-editor/react'; | ||
|
||
const CodeEditor = ({ onCodeChange }: any) => { | ||
function handleEditorChange(value, event) { | ||
console.log('here is the current model value:', value); | ||
if (onCodeChange) { | ||
onCodeChange(value); // Call the passed callback function with the current code value | ||
} | ||
} | ||
|
||
// Function to define Clarity language | ||
const defineClarityLanguage = (monaco) => { | ||
monaco.languages.register({ id: 'clarity' }); | ||
|
||
monaco.languages.setMonarchTokensProvider('clarity', { | ||
tokenizer: { | ||
root: [ | ||
// Comments | ||
[/(;;.*$)/, 'comment'], | ||
|
||
// Strings | ||
[/"/, { token: 'string.quote', bracket: '@open', next: '@string' }], | ||
|
||
// Keywords | ||
[ | ||
/\b(define-data-var|define-public|define-private|define-read-only|define-constant|begin|let|if|map-set|map-get\?|and|or|not|is-eq|unwrap-panic|unwrap-err-panic|unwrap-err!|unwrap!|asserts!|try!|ok|err)\b/, | ||
'keyword' | ||
], | ||
|
||
// Numbers - Clarity supports both signed and unsigned integers | ||
[/\bu?[0-9]+/, 'number'], | ||
|
||
// Brackets and Parentheses | ||
[/[{}()[\]]/, '@brackets'], | ||
|
||
// Operators | ||
[/[=<>!+\-*/%]/, 'operator'] | ||
], | ||
|
||
string: [ | ||
[/[^"]+/, 'string'], | ||
[/"/, { token: 'string.quote', bracket: '@close', next: '@pop' }] | ||
] | ||
} | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
loader.init().then((monaco) => { | ||
defineClarityLanguage(monaco); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<Editor | ||
height="50vh" | ||
theme="vs-dark" | ||
defaultLanguage="clarity" // Set to use the custom Clarity language | ||
defaultValue="(define-data-var count int 0) | ||
(define-public (add-number (number int)) | ||
(let | ||
( | ||
(current-count count) | ||
) | ||
(var-set count (+ 1 number)) | ||
(ok (var-get count)) | ||
) | ||
)" | ||
onChange={handleEditorChange} | ||
/> | ||
); | ||
}; | ||
|
||
export default CodeEditor; |
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,59 @@ | ||
import React from 'react'; | ||
import { NavLink, useParams } from 'react-router-dom'; | ||
import { SVGComponent } from './stacksSvg'; | ||
|
||
import { WalletConnectButton } from './walletConnect'; | ||
import { useAccount } from '@micro-stacks/react'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
|
||
const LeftMenu = () => { | ||
const { stxAddress } = useAccount(); | ||
const { slug } = useParams(); | ||
const getNavLinkClass = ({ isActive }: any) => { | ||
return isActive | ||
? 'flex items-center gap-5 bg-blue-500 rounded-xl font-bold text-md text-white py-3 px-4' | ||
: 'flex items-center gap-5 bg-white hover:bg-blue-50 rounded-xl font-bold text-md text-gray-900 py-3 px-4'; | ||
}; | ||
return ( | ||
<aside className="fixed inset-y-0 left-0 bg-white shadow-md w-80 h-screen"> | ||
<div className="flex flex-col justify-between h-full"> | ||
<div className="flex-grow"> | ||
<div className="px-4 py-6 text-center border-b flex flex-row items-center justify-center gap-2"> | ||
<SVGComponent /> | ||
<h1 className="text-xl font-normal leading-none"> | ||
<span className="text-blue-500">s</span>DAO | ||
</h1> | ||
</div> | ||
<div className="p-4"> | ||
<ul className="space-y-5"> | ||
{/* <li> | ||
<NavLink to={'/home'} className={getNavLinkClass}> | ||
<img src="../assets/home.png" alt="" width={50} /> | ||
Home | ||
</NavLink> | ||
</li> */} | ||
<li> | ||
<NavLink to={'/new-proposal'} className={getNavLinkClass}> | ||
<img src="../assets/proposal.png" alt="" width={50} /> | ||
New grant proposal | ||
</NavLink> | ||
</li> | ||
<li> | ||
<NavLink to={'/claim'} className={getNavLinkClass}> | ||
<img src="../assets/claim.png" alt="" width={50} /> | ||
Claim milestones | ||
</NavLink> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div className="p-10 pb-25"> | ||
<WalletConnectButton /> | ||
</div> | ||
</div> | ||
</aside> | ||
); | ||
}; | ||
|
||
export default LeftMenu; |
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,34 @@ | ||
import React from 'react'; | ||
|
||
export const SVGComponent = (props: any) => ( | ||
<svg | ||
id="Layer_1" | ||
xmlns="http://www.w3.org/2000/svg" | ||
xmlnsXlink="http://www.w3.org/1999/xlink" | ||
x="0px" | ||
y="0px" | ||
viewBox="0 0 25 25" | ||
style={{ | ||
enableBackground: 'new 0 0 159.8 159.8' | ||
}} | ||
xmlSpace="preserve" | ||
width={25} | ||
height={25} | ||
{...props} | ||
> | ||
<style type="text/css"> | ||
{'.st0{fill:#5546FF;}\n\t.st1{fill:#FFFFFF;}'} | ||
</style> | ||
<path | ||
className="st0" | ||
cx={79.9} | ||
cy={79.9} | ||
r={79.9} | ||
d="M25 12.5a12.5 12.5 0 0 1 -12.5 12.5A12.5 12.5 0 0 1 0 12.5a12.5 12.5 0 0 1 25 0z" | ||
/> | ||
<path | ||
className="st1" | ||
d="m17.6 19.087 -2.691 -4.224h3.864v-1.596H6.101v1.596h3.864l-2.691 4.224h2.002l3.16 -4.96 3.16 4.96H17.6zm1.173 -7.369v-1.596h-3.786l2.659 -4.177h-2.018l-3.192 5.037 -3.192 -5.037h-2.018l2.659 4.177h-3.786v1.611l12.672 -0.015z" | ||
/> | ||
</svg> | ||
); |
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,21 @@ | ||
import { useAuth } from '@micro-stacks/react'; | ||
import React from 'react'; | ||
|
||
export const WalletConnectButton = () => { | ||
const { openAuthRequest, isRequestPending, signOut, isSignedIn } = useAuth(); | ||
const label = isRequestPending | ||
? 'Loading...' | ||
: isSignedIn | ||
? 'Sign out' | ||
: 'Connect Stacks wallet'; | ||
return ( | ||
<button | ||
onClick={async () => { | ||
if (isSignedIn) await signOut(); | ||
else await openAuthRequest(); | ||
}} | ||
> | ||
{label} | ||
</button> | ||
); | ||
}; |
Oops, something went wrong.