Skip to content

Commit

Permalink
Merge pull request #38 from dappforce/dev/epic
Browse files Browse the repository at this point in the history
Channels Integration
  • Loading branch information
teodorus-nathaniel authored Sep 6, 2024
2 parents d810a9f + 5e20ef4 commit de0a3da
Show file tree
Hide file tree
Showing 104 changed files with 6,502 additions and 1,549 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ jobs:
GH_NEYNAR_API_KEY=${{ secrets.GH_NEYNAR_API_KEY }}
GH_NEXT_PUBLIC_TELEGRAM_BOT_ID=6523818125
GH_NEXT_PUBLIC_TELEGRAM_BOT_USERNAME=EpicAppBot
GH_NEXT_PUBLIC_DAPP_PUBLIC_KEY=7iXtxm8bXK7XGSvnHzYZSojYHYoNiMa4m59ZovYwBzy5
GH_DAPP_SECRET_KEY=${{ secrets.GH_DAPP_SECRET_KEY }}
target: runner
tags: |
${{ env.image }}
Expand Down Expand Up @@ -135,6 +137,8 @@ jobs:
GH_NEXT_PUBLIC_TELEGRAM_BOT_USERNAME=subsocial_staging_bot
GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID=e8dc01b0-046c-4698-98ac-05432050961d
GH_FRAMES_SECRET=JG/W96svVHQ3bdaEKWm1h8xJXqxDtqZ6t7tKCZNWhh0=
GH_NEXT_PUBLIC_DAPP_PUBLIC_KEY=GqJKFQavHPEvngh6hNwt9FbqcEYsNvduGvyQuT6ARTHk
GH_DAPP_SECRET_KEY=85Nb7L8gVozH99wYYu4Ggx64DVFKUXH15iwxSNGCgHBs
target: runner
tags: |
${{ env.image }}
Expand Down
4 changes: 3 additions & 1 deletion ci.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ NEXT_PUBLIC_IS_MAINTENANCE='$GH_NEXT_PUBLIC_IS_MAINTENANCE'
NEXT_PUBLIC_NEYNAR_CLIENT_ID='$GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID'
FRAMES_SECRET='$GH_FRAMES_SECRET'
NEYNAR_API_KEY='$GH_NEYNAR_API_KEY'
NEXT_PUBLIC_DAPP_PUBLIC_KEY='$GH_NEXT_PUBLIC_DAPP_PUBLIC_KEY'
DAPP_SECRET_KEY='$GH_DAPP_SECRET_KEY'
NEXT_PUBLIC_TELEGRAM_BOT_ID='$GH_NEXT_PUBLIC_TELEGRAM_BOT_ID'
NEXT_PUBLIC_TELEGRAM_BOT_USERNAME='$GH_NEXT_PUBLIC_TELEGRAM_BOT_USERNAME'
MODERATION_URL='$GH_MODERATION_URL'
Expand Down Expand Up @@ -48,4 +50,4 @@ NEXT_PUBLIC_OFFCHAIN_POSTING_HUBS='$GH_NEXT_PUBLIC_OFFCHAIN_POSTING_HUBS'
NEXT_PUBLIC_TELEGRAM_NOTIFICATION_BOT='$GH_NEXT_PUBLIC_TELEGRAM_NOTIFICATION_BOT'
NEXTAUTH_SECRET='$GH_NEXTAUTH_SECRET'
NEXTAUTH_URL='$GH_NEXTAUTH_URL'
NEXT_PUBLIC_BASE_URL='$GH_NEXT_PUBLIC_BASE_URL'
NEXT_PUBLIC_BASE_URL='$GH_NEXT_PUBLIC_BASE_URL'
7 changes: 7 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ARG GH_NEXT_PUBLIC_IS_MAINTENANCE
ARG GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID
ARG GH_FRAMES_SECRET
ARG GH_NEYNAR_API_KEY
ARG GH_NEXT_PUBLIC_DAPP_PUBLIC_KEY
ARG GH_NEXT_PUBLIC_TELEGRAM_BOT_ID
ARG GH_NEXT_PUBLIC_TELEGRAM_BOT_USERNAME
ARG GH_NEXT_PUBLIC_AMP_ID
Expand Down Expand Up @@ -56,6 +57,8 @@ ENV NEXTAUTH_URL=${GH_NEXTAUTH_URL} \
NEXT_PUBLIC_NEYNAR_CLIENT_ID=${GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID} \
FRAMES_SECRET=${GH_FRAMES_SECRET} \
NEYNAR_API_KEY=${GH_NEYNAR_API_KEY} \
NEXT_PUBLIC_DAPP_PUBLIC_KEY=${GH_NEXT_PUBLIC_DAPP_PUBLIC_KEY} \
DAPP_SECRET_KEY=${GH_DAPP_SECRET_KEY} \
NEXT_PUBLIC_TELEGRAM_BOT_ID=${GH_NEXT_PUBLIC_TELEGRAM_BOT_ID} \
NEXT_PUBLIC_TELEGRAM_BOT_USERNAME=${GH_NEXT_PUBLIC_TELEGRAM_BOT_USERNAME} \
NEXT_PUBLIC_SUBSTRATE_WSS=${GH_NEXT_PUBLIC_SUBSTRATE_WSS} \
Expand Down Expand Up @@ -119,6 +122,8 @@ ARG GH_NEXT_PUBLIC_BASE_PATH
ARG GH_NEXT_PUBLIC_IS_MAINTENANCE
ARG GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID
ARG GH_FRAMES_SECRET
ARG GH_NEXT_PUBLIC_DAPP_PUBLIC_KEY
ARG GH_DAPP_SECRET_KEY
ARG GH_NEYNAR_API_KEY
ARG GH_NEXT_PUBLIC_TELEGRAM_BOT_ID
ARG GH_NEXT_PUBLIC_TELEGRAM_BOT_USERNAME
Expand Down Expand Up @@ -154,6 +159,8 @@ ENV NEXTAUTH_URL=${GH_NEXTAUTH_URL} \
NEXT_PUBLIC_NEYNAR_CLIENT_ID=${GH_NEXT_PUBLIC_NEYNAR_CLIENT_ID} \
FRAMES_SECRET=${GH_FRAMES_SECRET} \
NEYNAR_API_KEY=${GH_NEYNAR_API_KEY} \
NEXT_PUBLIC_DAPP_PUBLIC_KEY=${GH_NEXT_PUBLIC_DAPP_PUBLIC_KEY} \
DAPP_SECRET_KEY=${GH_DAPP_SECRET_KEY} \
NEXT_PUBLIC_TELEGRAM_BOT_ID=${GH_NEXT_PUBLIC_TELEGRAM_BOT_ID} \
NEXT_PUBLIC_TELEGRAM_BOT_USERNAME=${GH_NEXT_PUBLIC_TELEGRAM_BOT_USERNAME} \
NEXT_PUBLIC_SUBSTRATE_WSS=${GH_NEXT_PUBLIC_SUBSTRATE_WSS} \
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
"@polkadot/react-identicon": "^3.6.5",
"@polkadot/util": "^12.1.2",
"@rainbow-me/rainbowkit": "^1.3.5",
"@solana/wallet-adapter-base": "^0.9.23",
"@solana/wallet-adapter-react": "^0.15.35",
"@solana/wallet-adapter-react-ui": "^0.9.35",
"@solana/wallet-adapter-wallets": "^0.19.32",
"@solana/web3.js": "^1.95.3",
"@subsocial/api": "^0.8.14",
"@subsocial/data-hub-sdk": "dappforce/subsocial-data-hub-sdk#staging",
Expand Down
Binary file added src/assets/emojis/confused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/emojis/success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/graphics/eth-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/graphics/phantom-wallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/BottomDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function BottomDrawer({
)}
<div className='mx-auto flex w-full max-w-screen-md flex-col gap-6 overflow-auto px-5 py-6 pb-6'>
<div className='flex flex-col gap-2'>
<span className='text-2xl font-medium'>{title}</span>
<span className={cx('text-2xl font-medium')}>{title}</span>
<span className='text-text-muted'>{description}</span>
</div>
<div className='flex w-full flex-col'>
Expand Down
39 changes: 39 additions & 0 deletions src/components/TabButtons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { cx } from '@/utils/class-names'
import Button from './Button'

export default function TabButtons({
className,
selectedTab,
setSelectedTab,
tabs,
}: {
className?: string
tabs: string[]
selectedTab: string
setSelectedTab: (tab: string) => void
}) {
return (
<div
className={cx(
'grid grid-cols-2 gap-px rounded-full bg-background-light text-sm font-medium',
className
)}
>
{tabs.map((tab) => (
<Button
key={tab}
variant={selectedTab === tab ? 'primary' : 'transparent'}
className={cx(
'h-10 py-0',
selectedTab === tab
? 'bg-background-primary/30'
: 'bg-background-light'
)}
onClick={() => setSelectedTab(tab)}
>
{tab}
</Button>
))}
</div>
)
}
105 changes: 105 additions & 0 deletions src/components/TaskCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import Diamond from '@/assets/emojis/diamond.png'
import Check from '@/assets/icons/check.svg'
import Card from '@/components/Card'
import { Skeleton } from '@/components/SkeletonFallback'
import { cx } from '@/utils/class-names'
import { formatNumber } from '@/utils/strings'
import Image, { ImageProps } from 'next/image'
import Link from 'next/link'
import { CSSProperties } from 'react'
import { FaChevronRight } from 'react-icons/fa6'

export default function TaskCard({
completed,
image,
reward,
title,
customAction,
onClick,
href,
openInNewTab,
isLoadingReward,
withoutDiamondIcon,
topBanner,
}: {
image: ImageProps['src']
title: React.ReactNode
reward: number | string
completed: boolean
customAction?: React.ReactNode
onClick?: () => void
href?: string
openInNewTab?: boolean
isLoadingReward?: boolean
withoutDiamondIcon?: boolean
topBanner?: {
icon: JSX.Element
text: string
className?: string
textStyle?: CSSProperties
textClassName?: string
}
}) {
const card = (
<Card className='flex cursor-pointer flex-col overflow-clip rounded-2xl p-0'>
{topBanner && (
<div className='bg-background'>
<div
className={cx(
'flex items-center justify-center gap-1 py-1.5 text-xs',
topBanner.className
)}
>
<span className='text-sm'>{topBanner.icon}</span>
<span
className={cx('font-medium', topBanner.textClassName)}
style={topBanner.textStyle}
>
{topBanner.text}
</span>
</div>
</div>
)}
<div
className='flex items-center gap-2.5 bg-background-light p-2.5 transition active:bg-background-lighter'
onClick={onClick}
>
<Image src={image} alt='' className='h-14 w-14' />
<div className='flex flex-col gap-1'>
<span className='font-bold'>{title}</span>
<div className='flex items-center gap-0.5'>
{!withoutDiamondIcon && (
<Image src={Diamond} alt='' className='relative top-px h-5 w-5' />
)}
{isLoadingReward ? (
<Skeleton className='w-12' />
) : (
<span className='text-text-muted'>
{typeof reward === 'number'
? `+${formatNumber(reward)}`
: reward}
</span>
)}
</div>
</div>
<div className='ml-auto flex items-center justify-center pr-1'>
{completed ? (
<Check />
) : customAction ? (
customAction
) : (
<FaChevronRight className='text-text-muted' />
)}
</div>
</div>
</Card>
)
if (href) {
return (
<Link target={openInNewTab ? '_blank' : undefined} href={href}>
{card}
</Link>
)
}
return card
}
14 changes: 14 additions & 0 deletions src/components/auth/common/evm/CommonEvmModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getLinkedIdentityQuery,
} from '@/services/datahub/identity/query'
import { useMyAccount, useMyGrillAddress } from '@/stores/my-account'
import { lastRedirectProtocol } from '@/utils/globals'
import { getCurrentUrlOrigin } from '@/utils/links'
import { openNewWindow, twitterShareUrl } from '@/utils/social-share'
import { IdentityProvider as SDKIdentityProvider } from '@subsocial/data-hub-sdk'
Expand Down Expand Up @@ -146,6 +147,19 @@ export const CommonEVMLoginContent = ({
className='w-full'
label={buttonLabel}
secondLabel='Sign Message'
hideButton={isSigning}
additionalSecondActionLabel={
isSigning && (
<Button
size='lg'
href={`${lastRedirectProtocol.protocol}://`}
target='_blank'
className='w-full'
>
Open wallet
</Button>
)
}
loadingText={!isSigned ? 'Pending Confirmation...' : 'Please wait...'}
/>
)
Expand Down
37 changes: 24 additions & 13 deletions src/components/auth/common/evm/CustomConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ type CustomConnectButtonProps = ButtonProps & {
className?: string
label?: React.ReactNode
secondLabel?: React.ReactNode
additionalSecondActionLabel?: React.ReactNode
withWalletActionImage?: boolean
onSuccessConnect: (evmAddress: string) => Promise<void>
isLoading: boolean
hideButton?: boolean
}

export const CustomConnectButton = ({
Expand All @@ -23,6 +25,8 @@ export const CustomConnectButton = ({
label = 'Connect Ethereum Address',
withWalletActionImage = true,
secondLabel,
additionalSecondActionLabel,
hideButton,
isLoading,
...buttonProps
}: CustomConnectButtonProps) => {
Expand Down Expand Up @@ -81,7 +85,7 @@ export const CustomConnectButton = ({
commonButtonProps.onClick?.(e as any)
}}
>
{usedLabel}
{label}
</Button>
)
}
Expand All @@ -102,17 +106,22 @@ export const CustomConnectButton = ({
}

return (
<Button
{...commonButtonProps}
onClick={async () => {
setHasInteractedOnce(true)
const connector = getConnector()
isTouchDevice() && (await openMobileWallet({ connector }))
onSuccess(account.address)
}}
>
{usedLabel}
</Button>
<>
{!hideButton && (
<Button
{...commonButtonProps}
onClick={async () => {
setHasInteractedOnce(true)
const connector = getConnector()
isTouchDevice() && (await openMobileWallet({ connector }))
onSuccess(account.address)
}}
>
{usedLabel}
</Button>
)}
{additionalSecondActionLabel}
</>
)
}}
</ConnectButton.Custom>
Expand All @@ -126,7 +135,9 @@ export const CustomConnectButton = ({
<LinkingDark className='hidden w-full dark:block' />
</div>

{customButton}
<div className='flex w-full flex-col items-center gap-2'>
{customButton}
</div>
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/common/evm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type OpenWalletProps = {
}

export const openMobileWallet = async ({ connector }: OpenWalletProps) => {
const getUri = connector.mobile?.getUri
const getUri = connector?.mobile?.getUri
if (getUri) {
const mobileUri = await getUri()

Expand Down
2 changes: 1 addition & 1 deletion src/components/chats/ChatForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export default function ChatForm({
const isSufficient = await refetch()
if (!isSufficient.data) {
refetch()
setOpenMessageModal('not-enough-balance', chatId)
setOpenMessageModal('not-enough-balance', { chatId })
return
}
resetForm()
Expand Down
Loading

0 comments on commit de0a3da

Please sign in to comment.