From 575f9ef15a3676bcaad5f5494da4f398646e485d Mon Sep 17 00:00:00 2001 From: andytudhope Date: Thu, 26 May 2022 11:09:51 +0200 Subject: [PATCH 1/5] Changes assets -> home, updates styles, adds kernel links --- packages/wallet/src/App.js | 14 +- packages/wallet/src/components/Import.jsx | 3 +- packages/wallet/src/views/Assets.jsx | 119 -------------- packages/wallet/src/views/Home.jsx | 190 ++++++++++++++++++++++ packages/wallet/src/views/Wallet.jsx | 2 +- packages/wallet/tailwind.config.js | 1 + 6 files changed, 201 insertions(+), 128 deletions(-) delete mode 100644 packages/wallet/src/views/Assets.jsx create mode 100644 packages/wallet/src/views/Home.jsx diff --git a/packages/wallet/src/App.js b/packages/wallet/src/App.js index 26bca88..04e872b 100644 --- a/packages/wallet/src/App.js +++ b/packages/wallet/src/App.js @@ -13,7 +13,7 @@ import NotFound from 'views/NotFound.jsx' import 'App.css' const Wallet = lazy(() => import('views/Wallet.jsx')) -const Assets = lazy(() => import('views/Assets.jsx')) +const Home = lazy(() => import('views/Home.jsx')) const Register = lazy(() => import('views/Register.jsx')) const Create = lazy(() => import('components/Create.jsx')) const Import = lazy(() => import('components/Import.jsx')) @@ -25,13 +25,13 @@ const App = () => { }> } /> - } /> - } /> + } /> + } /> - } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> }> } /> diff --git a/packages/wallet/src/components/Import.jsx b/packages/wallet/src/components/Import.jsx index 806dbbc..51b1316 100644 --- a/packages/wallet/src/components/Import.jsx +++ b/packages/wallet/src/components/Import.jsx @@ -16,7 +16,7 @@ const env = process.env.REACT_APP_DEPLOY_TARGET || 'PROD' const endpoint = process.env[`REACT_APP_AUTH_ENDPOINT_${env}`] const WALLET_STORE_VERSION = '1' -const SUCCESS_TO = '/assets' +const SUCCESS_TO = '/home' const authClient = async (jwtFn) => rpcClient.build({ rpcEndpoint: endpoint, jwtFn }) @@ -97,6 +97,7 @@ const Import = () => { Encrypted Wallet readFile(e)} diff --git a/packages/wallet/src/views/Assets.jsx b/packages/wallet/src/views/Assets.jsx deleted file mode 100644 index 208d230..0000000 --- a/packages/wallet/src/views/Assets.jsx +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 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 portalCards = [ - { - title: 'Claim', - description: 'Get set up with some test ETH', - url: '/claim' - }, - { - title: 'Explore', - description: 'Understand how transactions work', - url: '/explore' - }, - { - title: 'Deploy', - description: 'Create your own token now', - url: '/deploy' - }, - { - title: 'Mint', - description: 'Create an NFT in one go', - url: '/mint' - }, - { - title: 'Contact', - description: 'Keep your friends\' addresses safe', - url: '/contact' - }, - { - title: 'Contribute', - description: 'Learn how to improve this with us', - url: '/contribute' - }, - { - title: 'Interact', - description: 'Explore all the best contracts', - url: '/interact' - }, - { - title: 'Develop', - description: 'Write your own code!', - url: '/develop' - } -] - -const Assets = () => { - 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 ( - -
-
-
- Welcome, {nickname}. -
-
- You are already valuable, just as you are. -
-
- 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. -
-
- -
- {portalCards.map((portalCard, index) => { - return ( - -
-
{portalCard.title}
-
{portalCard.description}
-
-
- ) - })} -
-
-
- ) -} - -export default Assets diff --git a/packages/wallet/src/views/Home.jsx b/packages/wallet/src/views/Home.jsx new file mode 100644 index 0000000..702dcf8 --- /dev/null +++ b/packages/wallet/src/views/Home.jsx @@ -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 = [ + { + title: 'UnProfile', + description: 'Unprofile yourself', + url: 'https://staging.unprofile.kernel.community/', + 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 ( + +
+
+ kernel fingerprint +
+
+ kernel fingerprint +
+
+
+
+
+ Welcome, {nickname}. +
+
+
+ You are already valuable, just as you are. +
+
+ 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. +
+
+ +
+
+

For Everyone

+
+ {everyoneCards.map((everyoneCard, index) => { + return ( + +
+
{everyoneCard.title}
+
{everyoneCard.description}
+
+
+ ) + })} +
+
+
+

Kernel Additions

+
+ {kernelCards.map((kernelCard, index) => { + return ( + + ) + })} +
+
+
+
+
+ ) +} + +export default Home diff --git a/packages/wallet/src/views/Wallet.jsx b/packages/wallet/src/views/Wallet.jsx index 044937d..ec6ef8e 100644 --- a/packages/wallet/src/views/Wallet.jsx +++ b/packages/wallet/src/views/Wallet.jsx @@ -49,7 +49,7 @@ const Wallet = () => {  or  - + diff --git a/packages/wallet/tailwind.config.js b/packages/wallet/tailwind.config.js index 6773a4e..27856c8 100644 --- a/packages/wallet/tailwind.config.js +++ b/packages/wallet/tailwind.config.js @@ -8,6 +8,7 @@ module.exports = { colors: { kernel: { white: '#ffffff', + grey: '#eee', dark: '#212144', highlight: '#CBF0C1', yellow: { From 0cddc1d7c37c710b7b802dbe270d05dd9acdba50 Mon Sep 17 00:00:00 2001 From: andytudhope Date: Thu, 26 May 2022 18:22:59 +0200 Subject: [PATCH 2/5] Fix missing key formatting issue --- packages/wallet/src/views/Home.jsx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/wallet/src/views/Home.jsx b/packages/wallet/src/views/Home.jsx index 702dcf8..b8c3a0d 100644 --- a/packages/wallet/src/views/Home.jsx +++ b/packages/wallet/src/views/Home.jsx @@ -99,7 +99,7 @@ const kernelCards = [ description: 'Horizontal conversations', url: 'https://staging.chat.kernel.community/', active: false - }, + } ] const Home = () => { @@ -151,9 +151,10 @@ const Home = () => { {everyoneCards.map((everyoneCard, index) => { return ( -
+ } + >
{everyoneCard.title}
{everyoneCard.description}
@@ -167,16 +168,15 @@ const Home = () => {
From 1f66a4a538d1c54e9eb2131787798c3a0aa43819 Mon Sep 17 00:00:00 2001 From: andytudhope Date: Fri, 27 May 2022 11:46:16 +0200 Subject: [PATCH 3/5] Attend to comments --- packages/wallet/src/components/Create.jsx | 2 +- packages/wallet/src/views/Home.jsx | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/wallet/src/components/Create.jsx b/packages/wallet/src/components/Create.jsx index 09e90a9..558ab67 100644 --- a/packages/wallet/src/components/Create.jsx +++ b/packages/wallet/src/components/Create.jsx @@ -16,7 +16,7 @@ const env = process.env.REACT_APP_DEPLOY_TARGET || 'PROD' const endpoint = process.env[`REACT_APP_AUTH_ENDPOINT_${env}`] const WALLET_STORE_VERSION = '1' -const SUCCESS_TO = '/assets' +const SUCCESS_TO = '/home' const authClient = async (jwtFn) => rpcClient.build({ rpcEndpoint: endpoint, jwtFn }) diff --git a/packages/wallet/src/views/Home.jsx b/packages/wallet/src/views/Home.jsx index b8c3a0d..0cdf8e0 100644 --- a/packages/wallet/src/views/Home.jsx +++ b/packages/wallet/src/views/Home.jsx @@ -12,6 +12,7 @@ import { linesVector } from '@kernel/common' import Page from 'components/Page' +const env = process.env.REACT_APP_DEPLOY_TARGET || 'PROD' const WALLET_STORE_VERSION = '1' const getItem = (k) => JSON.parse(localStorage.getItem(k)) @@ -75,29 +76,29 @@ const everyoneCards = [ } ] -const kernelCards = [ +const memberCards = [ { title: 'UnProfile', description: 'Unprofile yourself', - url: 'https://staging.unprofile.kernel.community/', + url: `${env === 'STAGING' ? 'https://staging.unprofile.kernel.community/' : 'https://unprofile.kernel.community'}`, active: true }, { title: 'Adventure', description: 'Heed the call to adventure', - url: 'https://staging.adventures.kernel.community/', + url: `${env === 'STAGING' ? 'https://staging.adventures.kernel.community/' : 'https://adventures.kernel.community'}`, active: true }, { title: 'Explore', description: 'Connect with other Fellows', - url: 'https://staging.explore.kernel.community/', + url: `${env === 'STAGING' ? 'https://staging.explore.kernel.community/' : 'https://explore.kernel.community'}`, active: true }, { title: 'Chat', description: 'Horizontal conversations', - url: 'https://staging.chat.kernel.community/', + url: `${env === 'STAGING' ? 'https://staging.chat.kernel.community/' : 'https://chat.kernel.community'}`, active: false } ] @@ -166,15 +167,15 @@ const Home = () => {

Kernel Additions

- {kernelCards.map((kernelCard, index) => { + {memberCards.map((memberCard, index) => { return ( - +
-
{kernelCard.title}
-
{kernelCard.description}
+
{memberCard.title}
+
{memberCard.description}
) From 15d27ac1fed1024d447f7bbf697ff0cd4b35bbac Mon Sep 17 00:00:00 2001 From: andytudhope Date: Fri, 27 May 2022 12:32:59 +0200 Subject: [PATCH 4/5] Attend to Rory's comments --- packages/wallet/src/App.js | 11 +++--- packages/wallet/src/views/Home.jsx | 60 +++++++++++++++--------------- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/packages/wallet/src/App.js b/packages/wallet/src/App.js index 04e872b..bd9a2ed 100644 --- a/packages/wallet/src/App.js +++ b/packages/wallet/src/App.js @@ -25,13 +25,12 @@ const App = () => { }> } /> - } /> - } /> + } /> - } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> }> } /> diff --git a/packages/wallet/src/views/Home.jsx b/packages/wallet/src/views/Home.jsx index 0cdf8e0..7085d6e 100644 --- a/packages/wallet/src/views/Home.jsx +++ b/packages/wallet/src/views/Home.jsx @@ -13,6 +13,7 @@ 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)) @@ -80,29 +81,46 @@ const memberCards = [ { title: 'UnProfile', description: 'Unprofile yourself', - url: `${env === 'STAGING' ? 'https://staging.unprofile.kernel.community/' : 'https://unprofile.kernel.community'}`, + url: `https://${prefix}unprofile.kernel.community`, active: true }, { title: 'Adventure', description: 'Heed the call to adventure', - url: `${env === 'STAGING' ? 'https://staging.adventures.kernel.community/' : 'https://adventures.kernel.community'}`, + url: `https://${prefix}adventures.kernel.community`, active: true }, { title: 'Explore', description: 'Connect with other Fellows', - url: `${env === 'STAGING' ? 'https://staging.explore.kernel.community/' : 'https://explore.kernel.community'}`, + url: `https://${prefix}explore.kernel.community`, active: true }, { title: 'Chat', description: 'Horizontal conversations', - url: `${env === 'STAGING' ? 'https://staging.chat.kernel.community/' : 'https://chat.kernel.community'}`, + url: `https://${prefix}chat.kernel.community`, active: false } ] +const LinkCard = ({ cardConfig }) => { + const Card = cardConfig.map((card, index) => { + return ( + +
+
{card.title}
+
{card.description}
+
+
+ ) + }) + return Card +} + const Home = () => { const wallet = loadWallet() const [address] = useState(wallet.address) @@ -149,37 +167,17 @@ const Home = () => {

For Everyone

- {everyoneCards.map((everyoneCard, index) => { - return ( - -
-
{everyoneCard.title}
-
{everyoneCard.description}
-
-
- ) - })} +

Kernel Additions

-
- {memberCards.map((memberCard, index) => { - return ( - -
-
{memberCard.title}
-
{memberCard.description}
-
-
- ) - })} +
+
From 4e5ab78ffe09691d052482bc9902b7429c41476d Mon Sep 17 00:00:00 2001 From: andytudhope Date: Fri, 27 May 2022 22:50:50 +0200 Subject: [PATCH 5/5] just say ou https://www.youtube.com/watch?v=vW1hv37imjw --- packages/wallet/src/views/Home.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/wallet/src/views/Home.jsx b/packages/wallet/src/views/Home.jsx index 7085d6e..69b40f4 100644 --- a/packages/wallet/src/views/Home.jsx +++ b/packages/wallet/src/views/Home.jsx @@ -104,8 +104,8 @@ const memberCards = [ } ] -const LinkCard = ({ cardConfig }) => { - const Card = cardConfig.map((card, index) => { +const LinkCards = ({ cardConfig }) => { + return cardConfig.map((card, index) => { return (
{ ) }) - return Card } const Home = () => { @@ -167,7 +166,7 @@ const Home = () => {

For Everyone

-
@@ -175,7 +174,7 @@ const Home = () => {

Kernel Additions

-