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

feat: header + welcome section #114

Merged
merged 25 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
def034f
chore: remove annoying styled plugin
gabitoesmiapodo Jun 12, 2024
3981df2
chore: remove some unused components
gabitoesmiapodo Jun 13, 2024
2fc0d9d
refactor: update and enhance several aspects from the CSS variables
gabitoesmiapodo Jun 13, 2024
7b8d357
refactor: remove InnerContainer as it's not needed for this particula…
gabitoesmiapodo Jun 13, 2024
93e98a3
feat: update header looks and main menu items
gabitoesmiapodo Jun 13, 2024
7fd7aba
feat: add basic examples component
gabitoesmiapodo Jun 13, 2024
e5290da
feat: add clouds component
gabitoesmiapodo Jun 13, 2024
2b6cc00
feat: add ghost component
gabitoesmiapodo Jun 13, 2024
142df1a
feat: add welcome section
gabitoesmiapodo Jun 13, 2024
f56f80f
refactor: update home
gabitoesmiapodo Jun 13, 2024
c7a15d2
refactor: main menu
gabitoesmiapodo Jun 13, 2024
04b52e6
chore: update db-ui-toolkit version
gabitoesmiapodo Jun 13, 2024
bd850d3
Merge branch 'main' into feat/#107-header-#108-welcome-section
gabitoesmiapodo Jun 13, 2024
9383ceb
refactor: move examples to a more appropriate folder
gabitoesmiapodo Jun 13, 2024
0aade01
refactor: move components to a less threatening and less confusing fo…
gabitoesmiapodo Jun 13, 2024
a80d49b
feat: add custom avatar
gabitoesmiapodo Jun 13, 2024
29375c1
feat: add secondary button
gabitoesmiapodo Jun 13, 2024
56b8882
chore: update theme for primary and secondary buttons
gabitoesmiapodo Jun 13, 2024
1dd0049
feat: add github and docs button for the welcome page
gabitoesmiapodo Jun 13, 2024
33502b2
feat: rename WelcomSection to Welcome, add text and buttons
gabitoesmiapodo Jun 13, 2024
1a688b4
refactor: welcome section buttons to use some common code
gabitoesmiapodo Jun 13, 2024
f94818f
feat: add github clone copy string thing
gabitoesmiapodo Jun 13, 2024
222c5de
fix: component overflowing issue
gabitoesmiapodo Jun 13, 2024
1e19420
fix: avatar typings
gabitoesmiapodo Jun 13, 2024
5abd8a3
fix: menu items constant type
gabitoesmiapodo Jun 14, 2024
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
2 changes: 0 additions & 2 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "stylelint-config-standard",
"customSyntax": "postcss-styled-syntax",
"plugins": ["stylelint-order"],
"rules": {
"number-max-precision": 8,
"selector-class-pattern": [
Expand All @@ -10,7 +9,6 @@
"message": "Class selectors should be in camelCase (e.g., myClassName)"
}
],
"order/order": ["custom-properties", "declarations", "rules", "at-rules"],
"custom-property-empty-line-before": null,
"no-empty-source": null
}
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@tanstack/react-query": "^5.36.0",
"@tanstack/react-router": "^1.32.5",
"connectkit": "^1.7.3",
"db-ui-toolkit": "github:BootNodeDev/db-ui-toolkit#0.0.7",
"db-ui-toolkit": "github:BootNodeDev/db-ui-toolkit",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠

"modern-normalize": "^2.0.0",
"next-themes": "^0.3.0",
"react": "^18.3.1",
Expand Down Expand Up @@ -79,7 +79,6 @@
"prettier": "^3.2.5",
"stylelint": "^16.5.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-order": "^6.0.4",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vitest": "^1.6.0"
Expand Down
33 changes: 5 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/images/bg-body.svg

This file was deleted.

20 changes: 20 additions & 0 deletions src/constants/menuItems.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type MenuItem = {
href?: string
label: string
to?: string
}

export const menuItems: MenuItem[] = [
{
label: 'Home',
to: '/#top',
},
{
label: 'Documentation',
href: 'https://docs.dappboster.io',
},
{
label: 'Examples',
to: '/#examples',
},
]
28 changes: 22 additions & 6 deletions src/lib/wallets/connectkit.config.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import React from 'react'

import { getDefaultConfig, ConnectKitProvider, ConnectKitButton, Types } from 'connectkit'
import { createConfig } from 'wagmi'
import { Address } from 'viem'
import { normalize } from 'viem/ens'
import { createConfig, useEnsName, useEnsAvatar } from 'wagmi'

import { env } from '@/src/env'
import { chains, transports } from '@/src/lib/networks.config'
import CustomAvatar from '@/src/sharedComponents/ui/Avatar'
import ConnectButton from '@/src/sharedComponents/ui/ConnectButton'
import Avatar from '@/src/sharedComponents/web3/Avatar'
import Avatar from '@/src/sharedComponents/Avatar'
import ConnectButton from '@/src/sharedComponents/ConnectButton'

const UserAvatar: React.FC<{
address: Address
size: number
}> = ({ address, size }) => {
const { data: ensName } = useEnsName({ address })

const { data: avatarImg } = useEnsAvatar({
name: ensName ? normalize(ensName) : undefined,
})

return <Avatar address={address} ensImage={avatarImg} ensName={ensName} size={size} />
}

export const WalletProvider = ({ children }: { children: React.ReactNode }) => {
return (
<ConnectKitProvider
options={{
customAvatar: CustomAvatar as React.FC<Types.CustomAvatarProps>,
customAvatar: Avatar as React.FC<Types.CustomAvatarProps>,
}}
>
{children}
Expand All @@ -27,7 +43,7 @@ export const ConnectWalletButton = () => {
<ConnectButton disabled={isConnecting} onClick={show}>
{isConnected ? (
<>
{address && <Avatar address={address} size={25} />}
{address && <UserAvatar address={address} size={25} />}
{truncatedAddress}
</>
) : (
Expand Down
17 changes: 0 additions & 17 deletions src/pageComponents/about/index.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions src/pageComponents/contact/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react'
import { Mock, describe, expect, it, vi } from 'vitest'
import { useEnsName, useEnsAvatar } from 'wagmi'

import Avatar from '@/src/sharedComponents/web3/Avatar'
import Avatar from '@/src/pageComponents/home/Examples/Items/Avatar'

// Mock wagmi hooks
vi.mock('wagmi', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import { Address } from 'viem'
import { normalize } from 'viem/ens'
import { useEnsName, useEnsAvatar } from 'wagmi'

import CustomAvatar from '@/src/sharedComponents/ui/Avatar'
import BaseAvatar from '@/src/sharedComponents/Avatar'

interface AvatarProps {
interface Props {
address: Address
size: number
}

/**
* Avatar WEB3 component using wagmi hooks to fetch ENS name and avatar image for the provided address.
* Avatar component using wagmi hooks to fetch ENS name and avatar image for the provided address.
*
* @param {string} props.address - The address
* @param {number} props.size - The size of the avatar
* @example <Avatar address="0x1234567890abcdef1234567890abcdef12345678" />
*/
const Avatar = ({ address, size }: AvatarProps) => {
const Avatar = ({ address, size }: Props) => {
const { data: ensName } = useEnsName({ address })

const { data: avatarImg } = useEnsAvatar({
name: ensName ? normalize(ensName) : undefined,
})

return <CustomAvatar address={address} ensImage={avatarImg} ensName={ensName} size={size} />
return <BaseAvatar address={address} ensImage={avatarImg} ensName={ensName} size={size} />
}

export default Avatar
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from 'styled-components'

import { Button } from 'db-ui-toolkit'

import { BigNumberInput } from '@/src/sharedComponents/web3/BigNumberInput'
import { BigNumberInput } from '@/src/sharedComponents/BigNumberInput'

const Wrapper = styled.div`
display: flex;
Expand All @@ -24,7 +24,7 @@ const decimals = 6
const max = '1.999998'
const min = '0.000001'

export const ADemoInput = () => {
const DemoInput = () => {
const [value, setValue] = useState('1.123')
const [disabled, setDisabled] = useState(false)
const [error, setError] = useState<{ value: string; message: string } | null>()
Expand Down Expand Up @@ -79,3 +79,5 @@ export const ADemoInput = () => {
</Wrapper>
)
}

export default DemoInput
31 changes: 31 additions & 0 deletions src/pageComponents/home/Examples/Items/EnsName.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Text } from 'db-ui-toolkit'
import { Address } from 'viem'
import { useEnsName } from 'wagmi'
import { mainnet } from 'wagmi/chains'

interface Props {
address: Address
}

const EnsName = ({ address }: Props) => {
const { data, error, status } = useEnsName({
address: address,
chainId: mainnet.id,
})

return (
<Text>
{status === 'pending' ? (
<>Loading ENS name</>
) : status === 'error' ? (
<>Error fetching ENS name: {error.message}</>
) : (
<>
<b>ENS name:</b> {data}
</>
)}
</Text>
)
}

export default EnsName
20 changes: 20 additions & 0 deletions src/pageComponents/home/Examples/Items/Hash.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Address } from 'viem'

import BaseHash from '@/src/sharedComponents/Hash'

interface Props {
hash: Address
}

const Hash = ({ hash }: Props) => {
return (
<BaseHash
explorerURL={`https://etherscan.io/address/${hash}`}
hash={hash}
onCopy={() => console.log('Copied!')}
showCopyButton
/>
)
}

export default Hash
41 changes: 41 additions & 0 deletions src/pageComponents/home/Examples/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react'
import styled from 'styled-components'

import { InnerContainer as Inner, ContainerPadding } from 'db-ui-toolkit'
import { useAccount } from 'wagmi'

import Avatar from '@/src/pageComponents/home/Examples/Items/Avatar'
import BigNumberInput from '@/src/pageComponents/home/Examples/Items/BigNumberInput'
import EnsName from '@/src/pageComponents/home/Examples/Items/EnsName'
import Hash from '@/src/pageComponents/home/Examples/Items/Hash'

const Wrapper = styled.section`
background-color: var(--landing-page-main-background-color);
flex-grow: 1;
`

const InnerContainer = styled(Inner)`
align-items: center;
flex-direction: column;
padding-bottom: 100px;
padding-top: 100px;

${ContainerPadding}
`

const Examples: React.FC = ({ ...restProps }) => {
const { address = '0x87885AaEEdED51C7e3858a782644F5d89759f245' } = useAccount()

return (
<Wrapper id="examples" {...restProps}>
<InnerContainer>
<EnsName address={address} />
<Hash hash={address} />
<Avatar address={address} size={30} />
<BigNumberInput />
</InnerContainer>
</Wrapper>
)
}

export default Examples
Loading
Loading