-
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
Changes from 2 commits
575f9ef
0cddc1d
1f66a4a
15d27ac
4e5ab78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
/** | ||
* 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 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 kernelCards = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep in mind this is not specific to the Kernel. The concepts we use is different roles represented by a single number visualized by concentric circles. What you are trying to express in this model is showing different links based on a user's role, but there is no concept of the Kernel in the code base. The intended way to use this is there's some threshold where you graduate to an outer circle represented as a decrease in the number that is your role. We are still missing the Therefore, this should be renamed as |
||
{ | ||
title: 'UnProfile', | ||
description: 'Unprofile yourself', | ||
url: 'https://staging.unprofile.kernel.community/', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This url is going to cause issues when deploying to a different environment other than staging. There is an environment variable We should make the URLs dependent on the target. There's an open issue to update the footer to include links to the apps and the code should be shared across both use cases. #19 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @andytudhope you may beat Alon to this, so if you want to use the guidance in #19 ("How to get the correct domains") to create a helper that returns the correct url for each app, go ahead. just let him know so that he can reuse it for the footer. |
||
active: true | ||
}, | ||
{ | ||
title: 'Adventure', | ||
description: 'Heed the call to adventure', | ||
url: 'https://staging.adventures.kernel.community/', | ||
active: true | ||
}, | ||
{ | ||
title: 'Explore', | ||
description: 'Connect with other Fellows', | ||
url: 'https://staging.explore.kernel.community/', | ||
active: true | ||
}, | ||
{ | ||
title: 'Chat', | ||
description: 'Horizontal conversations', | ||
url: 'https://staging.chat.kernel.community/', | ||
active: false | ||
} | ||
] | ||
|
||
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'> | ||
{everyoneCards.map((everyoneCard, index) => { | ||
return ( | ||
<a key={index} href={`${everyoneCard.active ? everyoneCard.url : '#'}`}> | ||
<div className={ | ||
`${everyoneCard.active ? 'bg-kernel-dark text-kernel-white' : 'bg-kernel-grey'} p-5 rounded shadow-md` | ||
} | ||
> | ||
<div className='text-xl mb-2'>{everyoneCard.title}</div> | ||
<div className='text-base mb-1'>{everyoneCard.description}</div> | ||
</div> | ||
</a> | ||
) | ||
})} | ||
</div> | ||
</div> | ||
<div> | ||
<h3 className='font-heading text-center text-3xl text-primary py-5'>Kernel Additions</h3> | ||
<div className='grid grid-cols-1 gap-y-8'> | ||
{kernelCards.map((kernelCard, index) => { | ||
return ( | ||
<a key={index} href={`${kernelCard.active ? kernelCard.url : '#'}`} className='w-full md:w-72 my-0 mx-auto'> | ||
<div className={ | ||
`${kernelCard.active ? 'bg-kernel-dark text-kernel-white' : 'bg-kernel-grey'} p-5 rounded shadow-md` | ||
} | ||
> | ||
<div className='text-xl mb-2'>{kernelCard.title}</div> | ||
<div className='text-base mb-1'>{kernelCard.description}</div> | ||
</div> | ||
</a> | ||
) | ||
})} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is now being duplicated, you can break out this returned component into a named component defined at the top level, like
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</Page> | ||
) | ||
} | ||
|
||
export default Home |
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.
is there any problem with just having the one
/home
route and deleting/home/overview
?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 think we'll want more pages under
home
so I feel comfortable leaving this here.