-
Notifications
You must be signed in to change notification settings - Fork 16
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
Changes assets -> home, updates styles, adds kernel links #24
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
575f9ef
Changes assets -> home, updates styles, adds kernel links
andytudhope 0cddc1d
Fix missing key formatting issue
andytudhope 1f66a4a
Attend to comments
andytudhope 15d27ac
Attend to Rory's comments
andytudhope 4e5ab78
just say ou https://www.youtube.com/watch?v=vW1hv37imjw
andytudhope 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
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 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,189 @@ | ||
/** | ||
* Copyright (c) Kernel | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import { ethers } from 'ethers' | ||
import { useEffect, useState } from 'react' | ||
import { linesVector } from '@kernel/common' | ||
|
||
import Page from 'components/Page' | ||
|
||
const env = process.env.REACT_APP_DEPLOY_TARGET || 'PROD' | ||
const prefix = env === 'STAGING' ? 'staging.' : '' | ||
const WALLET_STORE_VERSION = '1' | ||
|
||
const getItem = (k) => JSON.parse(localStorage.getItem(k)) | ||
|
||
const loadWallet = () => { | ||
const wallet = getItem('wallet') | ||
if (wallet.version !== WALLET_STORE_VERSION) { | ||
throw new Error('unsupported wallet') | ||
} | ||
return wallet | ||
} | ||
|
||
const everyoneCards = [ | ||
{ | ||
title: 'Claim', | ||
description: 'Get set up with some test ETH', | ||
url: '/claim', | ||
active: false | ||
}, | ||
{ | ||
title: 'Transact', | ||
description: 'Understand how transactions work', | ||
url: '/transact', | ||
active: false | ||
}, | ||
{ | ||
title: 'Deploy', | ||
description: 'Create your own token now', | ||
url: '/deploy', | ||
active: false | ||
}, | ||
{ | ||
title: 'Mint', | ||
description: 'Create an NFT in one go', | ||
url: '/mint', | ||
active: false | ||
}, | ||
{ | ||
title: 'Contact', | ||
description: 'Keep your friends\' addresses safe', | ||
url: '/contact', | ||
active: false | ||
}, | ||
{ | ||
title: 'Contribute', | ||
description: 'Learn how to improve this with us', | ||
url: '/contribute', | ||
active: false | ||
}, | ||
{ | ||
title: 'Interact', | ||
description: 'Explore all the best contracts', | ||
url: '/interact', | ||
active: false | ||
}, | ||
{ | ||
title: 'Develop', | ||
description: 'Write your own code!', | ||
url: '/develop', | ||
active: false | ||
} | ||
] | ||
|
||
const memberCards = [ | ||
{ | ||
title: 'UnProfile', | ||
description: 'Unprofile yourself', | ||
url: `https://${prefix}unprofile.kernel.community`, | ||
active: true | ||
}, | ||
{ | ||
title: 'Adventure', | ||
description: 'Heed the call to adventure', | ||
url: `https://${prefix}adventures.kernel.community`, | ||
active: true | ||
}, | ||
{ | ||
title: 'Explore', | ||
description: 'Connect with other Fellows', | ||
url: `https://${prefix}explore.kernel.community`, | ||
active: true | ||
}, | ||
{ | ||
title: 'Chat', | ||
description: 'Horizontal conversations', | ||
url: `https://${prefix}chat.kernel.community`, | ||
active: false | ||
} | ||
] | ||
|
||
const LinkCard = ({ cardConfig }) => { | ||
const Card = cardConfig.map((card, index) => { | ||
return ( | ||
<a key={index} href={`${card.active ? card.url : '#'}`}> | ||
<div className={ | ||
`${card.active ? 'bg-kernel-dark text-kernel-white' : 'bg-kernel-grey'} p-5 rounded shadow-md` | ||
} | ||
> | ||
<div className='text-xl mb-2'>{card.title}</div> | ||
<div className='text-base mb-1'>{card.description}</div> | ||
</div> | ||
</a> | ||
) | ||
}) | ||
return Card | ||
} | ||
|
||
const Home = () => { | ||
const wallet = loadWallet() | ||
const [address] = useState(wallet.address) | ||
const [nickname] = useState(wallet.nickname) | ||
/* eslint-disable no-unused-vars */ | ||
const [signer, setSigner] = useState(null) | ||
/* eslint-disable no-unused-vars */ | ||
const [balance, setBalance] = useState(0) | ||
|
||
useEffect(() => { | ||
// TODO: pass in context | ||
const defaultProvider = new ethers.providers.CloudflareProvider() | ||
const voidSigner = new ethers.VoidSigner(address, defaultProvider) | ||
setSigner(voidSigner) | ||
voidSigner.getBalance().then((e) => setBalance(ethers.utils.formatEther(e))) | ||
}, [address]) | ||
|
||
return ( | ||
<Page> | ||
<div className='relative'> | ||
<div className='hidden lg:block lg:fixed lg:-top-24 lg:-left-52 lg:z-0'> | ||
<img alt='kernel fingerprint' src={linesVector} width={383} height={412} /> | ||
</div> | ||
<div className='hidden lg:block lg:fixed lg:-top-12 lg:-right-52 lg:z-0'> | ||
<img alt='kernel fingerprint' src={linesVector} width={442} height={476} /> | ||
</div> | ||
</div> | ||
<div className='mt-32 mx-8 sm:mx-24 xl:mx-48'> | ||
<div className='text-center'> | ||
<div className='font-heading lg:text-5xl text-5xl text-primary lg:py-5'> | ||
Welcome, {nickname}. | ||
</div> | ||
<hr /> | ||
<div className='text-2xl my-4 text-secondary'> | ||
You are already valuable, just as you are. | ||
</div> | ||
<div className='my-4 text-secondary'> | ||
This portal will help you learn how to realize some of that value in the | ||
world of web3. We're so happy you're with us. | ||
</div> | ||
</div> | ||
|
||
<div className='my-4 px-4 grid grid-cols-1 md:grid-cols-2 md:my-16 md:px-16'> | ||
<div> | ||
<h3 className='font-heading text-center text-3xl text-primary py-5'>For Everyone</h3> | ||
<div className='grid grid-cols-1 md:grid-cols-2 md:gap-x-8 gap-y-8 border-0 md:border-r border-kernel-grey md:pr-12'> | ||
<LinkCard | ||
cardConfig={everyoneCards} | ||
/> | ||
</div> | ||
</div> | ||
<div> | ||
<h3 className='font-heading text-center text-3xl text-primary py-5'>Kernel Additions</h3> | ||
<div className='grid grid-cols-1 md:grid-cols-2 md:gap-x-8 gap-y-8 md:pl-12'> | ||
<LinkCard | ||
cardConfig={memberCards} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</Page> | ||
) | ||
} | ||
|
||
export default Home |
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
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.
LinksCard
orLinkCards
depending on how you're thinking about it.const Card
is unnecessary; you can justreturn cardConfig.map((...
and remove line 121.