-
Notifications
You must be signed in to change notification settings - Fork 12
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
Create a landing page #111
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,105 @@ | ||
"use client"; | ||
import { FC } from "react"; | ||
import { | ||
Box, | ||
Button, | ||
Center, | ||
Stack, | ||
Image, | ||
Card, | ||
Flex, | ||
Text, | ||
Anchor, | ||
SimpleGrid, | ||
Group, | ||
} from "@mantine/core"; | ||
import Link from "next/link"; | ||
import { useLatestState } from "../../model/reader"; | ||
import { AppBounty } from "../../model/state"; | ||
import { BountyStatusBadgeGroup } from "../../components/bountyStatus"; | ||
import { HasConnectedAccount } from "../../components/hasConnectedAccount"; | ||
import { useBlockTimestamp } from "../../hooks/block"; | ||
import { getBountyStatus } from "../../utils/bounty"; | ||
|
||
const Bounty: FC<{ | ||
index: number; | ||
bounty: AppBounty; | ||
blockTimestamp: bigint; | ||
}> = ({ index, bounty, blockTimestamp }) => { | ||
const bountyStatus = getBountyStatus(bounty, blockTimestamp); | ||
return ( | ||
<Anchor href={"/bounty/" + index} underline="never"> | ||
<Card> | ||
<Card.Section> | ||
<Image | ||
h={200} | ||
p={6} | ||
fit="contain" | ||
alt="Bounty Image" | ||
src={bounty.imgLink} | ||
fallbackSrc="/static/default_app.webp" | ||
/> | ||
</Card.Section> | ||
<Box w={400} mt="md"> | ||
<Group mb={10}> | ||
<Text truncate="end" fw={700} size="lg"> | ||
{bounty.name} | ||
</Text> | ||
<BountyStatusBadgeGroup bountyStatus={bountyStatus} /> | ||
</Group> | ||
<Text truncate="end" size="xs" c="dimmend"> | ||
{bounty.description} | ||
</Text> | ||
</Box> | ||
</Card> | ||
</Anchor> | ||
); | ||
}; | ||
|
||
const BountyList: FC = () => { | ||
const stateResult = useLatestState(); | ||
const blockTimestamp = useBlockTimestamp(); | ||
|
||
switch (stateResult.kind) { | ||
case "loading": | ||
return <Center>Loading list of bounties...</Center>; | ||
case "error": | ||
return <Center>{stateResult.message}</Center>; | ||
} | ||
|
||
const state = stateResult.response; | ||
|
||
return ( | ||
<SimpleGrid m="sm" cols={{ base: 1, sm: 2, lg: 3 }}> | ||
{state.bounties.map((bounty, index) => { | ||
return ( | ||
<Bounty | ||
key={index} | ||
index={index} | ||
bounty={bounty} | ||
blockTimestamp={blockTimestamp!} | ||
/> | ||
); | ||
})} | ||
</SimpleGrid> | ||
); | ||
}; | ||
|
||
const Explore: FC = () => { | ||
return ( | ||
<Stack> | ||
<HasConnectedAccount> | ||
<Flex mt={20} mr={20} justify="flex-end"> | ||
<Link href={"/bounty/create"}> | ||
<Button size="lg">Submit bounty</Button> | ||
</Link> | ||
</Flex> | ||
</HasConnectedAccount> | ||
<Center> | ||
<BountyList /> | ||
</Center> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default Explore; |
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,105 +1,44 @@ | ||
"use client"; | ||
import { FC } from "react"; | ||
import { | ||
Box, | ||
Button, | ||
Center, | ||
Stack, | ||
Image, | ||
Card, | ||
Flex, | ||
Text, | ||
Anchor, | ||
SimpleGrid, | ||
Group, | ||
} from "@mantine/core"; | ||
import Link from "next/link"; | ||
import { useLatestState } from "../model/reader"; | ||
import { AppBounty } from "../model/state"; | ||
import { BountyStatusBadgeGroup } from "../components/bountyStatus"; | ||
import { HasConnectedAccount } from "../components/hasConnectedAccount"; | ||
import { useBlockTimestamp } from "../hooks/block"; | ||
import { getBountyStatus } from "../utils/bounty"; | ||
|
||
const Bounty: FC<{ | ||
index: number; | ||
bounty: AppBounty; | ||
blockTimestamp: bigint; | ||
}> = ({ index, bounty, blockTimestamp }) => { | ||
const bountyStatus = getBountyStatus(bounty, blockTimestamp); | ||
const Home: FC = () => { | ||
return ( | ||
<Anchor href={"/bounty/" + index} underline="never"> | ||
<Card> | ||
<Card.Section> | ||
<Image | ||
h={200} | ||
p={6} | ||
fit="contain" | ||
alt="Bounty Image" | ||
src={bounty.imgLink} | ||
fallbackSrc="/static/default_app.webp" | ||
/> | ||
</Card.Section> | ||
<Box w={400} mt="md"> | ||
<Group mb={10}> | ||
<Text truncate="end" fw={700} size="lg"> | ||
{bounty.name} | ||
</Text> | ||
<BountyStatusBadgeGroup bountyStatus={bountyStatus} /> | ||
</Group> | ||
<Text truncate="end" size="xs" c="dimmend"> | ||
{bounty.description} | ||
</Text> | ||
</Box> | ||
</Card> | ||
</Anchor> | ||
); | ||
}; | ||
<Stack align="center"> | ||
<Card mt={20} ml={20} mr={20} withBorder> | ||
|
||
const BountyList: FC = () => { | ||
const stateResult = useLatestState(); | ||
const blockTimestamp = useBlockTimestamp(); | ||
<Stack mt="md" mb="md" align="center"> | ||
<Text size="40px">A Trustless</Text> | ||
<Text size="40px">Bug Bounty Platform</Text> | ||
</Stack> | ||
|
||
switch (stateResult.kind) { | ||
case "loading": | ||
return <Center>Loading list of bounties...</Center>; | ||
case "error": | ||
return <Center>{stateResult.message}</Center>; | ||
} | ||
<Text c="dimmed" w={720} mb="md"> | ||
Bug Buster accepts software written in any major programming language. | ||
Through a friendly web interface, hackers can test their exploits right | ||
on the browser, without even having to sign Web3 transactions! | ||
Once the hacker finds a valid exploit, they can finally send a transaction | ||
requesting the reward to be transferred to their account. | ||
All major wallets are supported! | ||
</Text> | ||
|
||
const state = stateResult.response; | ||
|
||
return ( | ||
<SimpleGrid m="sm" cols={{ base: 1, sm: 2, lg: 3 }}> | ||
{state.bounties.map((bounty, index) => { | ||
return ( | ||
<Bounty | ||
key={index} | ||
index={index} | ||
bounty={bounty} | ||
blockTimestamp={blockTimestamp!} | ||
/> | ||
); | ||
})} | ||
</SimpleGrid> | ||
); | ||
}; | ||
|
||
const Home: FC = () => { | ||
return ( | ||
<Stack> | ||
<HasConnectedAccount> | ||
<Flex mt={20} mr={20} justify="flex-end"> | ||
<Link href={"/bounty/create"}> | ||
<Button size="lg">Submit bounty</Button> | ||
<Group justify="space-between"> | ||
<Link href={"/explore"}> | ||
<Button size="lg">Explore Bounties</Button> | ||
</Link> | ||
<Link style={{ textDecoration: "none", color: "white"}} href={"https://github.com/crypto-bug-hunters/bugless/blob/main/README.md"}> | ||
<Text size="lg">Learn More</Text> | ||
</Link> | ||
</Flex> | ||
</HasConnectedAccount> | ||
<Center> | ||
<BountyList /> | ||
</Center> | ||
</Group> | ||
</Card> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default Home; | ||
export default Home; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know GitHub redirects to the current repository URL, but it's good to have it point to the correct one right off the bat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing! It was a copy and past from the old PR (before renaming). Good catch!!!