Skip to content
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

Koral Protocol #88

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
1594872
docs: add GPL v3 LICENSE
cmdlucas Sep 23, 2022
e27ae30
docs: add project readme
cmdlucas Sep 23, 2022
a06d095
initial project dev setup
cmdlucas Oct 12, 2022
379b429
feat: setup foundation for colony smart contract
cmdlucas Oct 14, 2022
4d66c9d
feat: add contract deployer using proxy pattern
cmdlucas Oct 14, 2022
e5d4656
feat: push to ethernal after contract deployment
cmdlucas Oct 15, 2022
ebf6182
feat: setup ability to add or deactivate colony entities
cmdlucas Oct 17, 2022
7a0bda9
feat: untangle stop from resume function
cmdlucas Oct 18, 2022
5178226
docs: add comment about colony protocol status
cmdlucas Oct 18, 2022
220916b
docs: update project readme
cmdlucas Oct 18, 2022
df642f4
refactor: update app initial setup
cmdlucas Oct 18, 2022
aa78331
refactor: introduce core frontend dir
cmdlucas Oct 18, 2022
c8f58e8
chore: initial linting setup
cmdlucas Oct 18, 2022
5403e4c
chore: improve typing and formatting
cmdlucas Oct 18, 2022
6db75d5
feat: tco2 market view setup
cmdlucas Oct 19, 2022
257f721
feat: setup topbar
cmdlucas Oct 19, 2022
c4ebb3e
feat: setup market to read static toucan projects datas
cmdlucas Oct 20, 2022
6d417e8
refactor: remove unnecessary FC
cmdlucas Oct 20, 2022
e51947d
feat: introduced paginated view for projects in market
cmdlucas Oct 20, 2022
39f8a57
docs: add note about toucan projects source
cmdlucas Oct 20, 2022
a87610f
feat: update colony contract name
cmdlucas Oct 25, 2022
f71edd0
feat: introduce celo wallet connection
cmdlucas Oct 25, 2022
79e9fc6
refactor: introduce market repo and entity
cmdlucas Oct 25, 2022
0f3e32e
feat: update repo to directly query toucan subgraph
cmdlucas Oct 25, 2022
cb3d592
feat: update carbon button text
cmdlucas Oct 25, 2022
7711f52
feat: improve market projects item content
cmdlucas Oct 25, 2022
55b22c1
feat: fetch projects through tokens
cmdlucas Oct 26, 2022
6431cd7
feat: introduce offset page
cmdlucas Oct 28, 2022
50d3720
feat: switch from ethers to web3js cos of celo
cmdlucas Oct 29, 2022
067d14c
feat: introduce reward fetching
cmdlucas Oct 29, 2022
5d72b9a
feat: add reward claiming to colony
cmdlucas Oct 31, 2022
a8d3abe
feat: add reward claiming to client app
cmdlucas Oct 31, 2022
aff5027
feat: introduce means to fetch claimed rewards
cmdlucas Oct 31, 2022
a722f7c
feat: introduce fetching user rewards
cmdlucas Oct 31, 2022
dc41af6
feat: improve logic for no claimed rewards message
cmdlucas Oct 31, 2022
b9696a7
refactor: use constant route definition in nav
cmdlucas Nov 1, 2022
187743e
feat: improve reward claiming modal messages
cmdlucas Nov 1, 2022
8830302
feat: introduce nprogress in client app
cmdlucas Nov 1, 2022
3ea7999
feat: improve offset payment notes
cmdlucas Nov 1, 2022
4611afa
feat: introduce offset contribution to colony contract
cmdlucas Nov 1, 2022
6aea485
feat: add ability to pay for offset
cmdlucas Nov 1, 2022
f37f7f4
feat: prevent claiming rewards for non-supporting projects
cmdlucas Nov 1, 2022
38ec471
feat: rename user rewards header
cmdlucas Nov 1, 2022
d7dc093
feat: add ability to set min contribution amount
cmdlucas Nov 1, 2022
5f6f965
chore: remove unnecessary contracts from frontend app
cmdlucas Nov 2, 2022
cdf5e75
refactor: update project queries naming convention
cmdlucas Nov 2, 2022
715c52c
feat: introduce blockchain network segregation
cmdlucas Nov 2, 2022
669061c
feat: stop logging process env
cmdlucas Nov 2, 2022
6a7c2d4
feat: do not fail when env var is not defined
cmdlucas Nov 2, 2022
67b43fe
feat: add typechain dir
cmdlucas Nov 2, 2022
33d1d33
refactor: make app independent of hardhat
cmdlucas Nov 2, 2022
1672c5e
refactor: update rewards file name
cmdlucas Nov 2, 2022
bc69b3b
chore: only include core app dir in tsconfig
cmdlucas Nov 2, 2022
b75626d
feat: support vcu projects
cmdlucas Nov 2, 2022
dd8a6e5
chore: remove typechain setup from root install
cmdlucas Nov 2, 2022
575b23d
feat: make web3 available in app project
cmdlucas Nov 2, 2022
7f8b191
fix: use correct default network for celo
cmdlucas Nov 2, 2022
6bca460
feat: deploy colony to alfajores
cmdlucas Nov 2, 2022
2791d6c
docs: update project description
cmdlucas Nov 3, 2022
ac4a4dc
test: add tests for colony smart contract
cmdlucas Nov 5, 2022
3e6da77
docs: add usage guide to readme
cmdlucas Nov 5, 2022
c45d347
docs: update readme
cmdlucas Nov 9, 2022
4b37444
docs: add loom video to docs
cmdlucas Nov 10, 2022
a490ad1
fix: ensure appropriate render on mobile
cmdlucas Nov 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: improve reward claiming modal messages
cmdlucas committed Nov 1, 2022
commit 187743e15504a8494c02a43b4dfb1361e0f16a3e
56 changes: 35 additions & 21 deletions koral-earth/app/frontend/views/rewards/ClaimReward.tsx
Original file line number Diff line number Diff line change
@@ -7,13 +7,14 @@ import { Colony as IColony } from '../../../../typechain/contracts/colony/Colony
import { Modal, Spinner, Button, Badge, Alert } from 'react-bootstrap';
import { useRouter } from 'next/router';
import { Route } from '../../shared/routes';
import { Reward } from '../../../backend/reward/reward.entity';

type Props = {
rewardId: number;
reward: Reward;
onCloseModal: () => void;
};

export const ClaimReward: FC<Props> = ({ rewardId, onCloseModal }) => {
export const ClaimReward: FC<Props> = ({ reward, onCloseModal }) => {
const router = useRouter();
const { kit, account, connect } = useCelo();

@@ -33,30 +34,23 @@ export const ClaimReward: FC<Props> = ({ rewardId, onCloseModal }) => {
Colony.address
) as unknown as IColony;

const claim = await colony.methods.claimReward(rewardId).send({
const claim = await colony.methods.claimReward(reward.id).send({
from: account,
});

return claim.status;
});

useEffect(() => {
mutate();
}, [mutate]);

const closeModal = () => {
if (!isLoading) {
onCloseModal();
}
if (claimed) {
router.push(Route.userRewards);
}
};

return (
<Modal show={true} onHide={closeModal} centered>
<Modal.Header closeButton>
<Modal.Title>Claiming Reward...</Modal.Title>
<Modal.Title>Claim Reward: {reward.name}</Modal.Title>
</Modal.Header>
<Modal.Body>
<>
@@ -65,35 +59,55 @@ export const ClaimReward: FC<Props> = ({ rewardId, onCloseModal }) => {
<Badge bg="dark" text="light">
{account}
</Badge>
<p>
<small>
<i>This will be the account the reward will be assigned to.</i>
</small>
</p>
</p>
{isLoading && (
<>
<h6>
Hang tight! We&apos;re claiming the reward for you using your
connected account...
</h6>
<Spinner animation="border" color="info" />
<Alert variant="info" className="text-center">
<Spinner animation="border" color="info" />
<h6>
Hang tight! We&apos;re claiming the reward for you using your
connected account...
</h6>
</Alert>
</>
)}
{rewardClaimingError && (
<>
<h6>We failed to claim the reward for you.</h6>
<Alert variant="danger">
{(rewardClaimingError as Error).message}
<h6>We failed to claim the reward for you.</h6>
<span>&#10060; {(rewardClaimingError as Error).message}</span>
</Alert>
</>
)}
{claimed && (
<>
<h6>Reward claimed successfully using the connected account!</h6>
</>
<Alert variant="success">
&#10003; Reward claimed successfully!
</Alert>
)}
</>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={closeModal}>
Close
</Button>
{!claimed && !isLoading && (
<Button variant="primary" onClick={() => mutate()}>
Claim Reward
</Button>
)}
{claimed && (
<Button
variant="primary"
onClick={() => router.push(Route.userRewards)}
>
See claimed rewards
</Button>
)}
</Modal.Footer>
</Modal>
);
14 changes: 8 additions & 6 deletions koral-earth/app/frontend/views/rewards/Rewards.tsx
Original file line number Diff line number Diff line change
@@ -15,10 +15,12 @@ import { ClaimReward } from './ClaimReward';

const Rewards: PaginatedItemsComponent<Reward> = ({ currentItems }) => {
const [showModal, setShowModal] = useState<boolean>(false);
const [rewardToBeClaimed, setRewardToBeClaimed] = useState<number>(-1);
const [rewardToBeClaimed, setRewardToBeClaimed] = useState<
Reward | undefined
>(undefined);

const onClaimReward = (rewardId: number) => {
setRewardToBeClaimed(rewardId);
const onClaimReward = (reward: Reward) => {
setRewardToBeClaimed(reward);
setShowModal(true);
};

@@ -35,17 +37,17 @@ const Rewards: PaginatedItemsComponent<Reward> = ({ currentItems }) => {
<ListGroup key={index}>
<ListGroup.Item>Name: {reward.name}</ListGroup.Item>
<ListGroup.Item>Location: {reward.location}</ListGroup.Item>
<Button className="mt-3" onClick={() => onClaimReward(index)}>
<Button className="mt-3" onClick={() => onClaimReward(reward)}>
Claim Reward
</Button>
</ListGroup>
</Col>
))}
</Row>
))}
{showModal && (
{showModal && rewardToBeClaimed && (
<ClaimReward
rewardId={rewardToBeClaimed}
reward={rewardToBeClaimed}
onCloseModal={() => setShowModal(false)}
/>
)}
2 changes: 1 addition & 1 deletion koral-earth/app/frontend/views/user/rewards.tsx
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ const Rewards: PaginatedItemsComponent<Reward> = ({ currentItems }) => {
{rowsFromData(currentItems).map((rewards, index) => (
<Row key={index}>
{rewards.map((reward, index) => (
<Col className="md-3" key={index}>
<Col className="md-3 mb-5" key={index}>
<ListGroup key={index}>
<ListGroup.Item>Name: {reward.name}</ListGroup.Item>
<ListGroup.Item>Location: {reward.location}</ListGroup.Item>