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

ENG-4673 fix(portal): drop graphql related prs on main #895

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 5 additions & 20 deletions apps/portal/app/.client/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,9 @@ import { wagmiConfig } from '@lib/utils/wagmi'
import type { PrivyClientConfig } from '@privy-io/react-auth'
import { PrivyProvider } from '@privy-io/react-auth'
import { WagmiProvider } from '@privy-io/wagmi'
import {
HydrationBoundary,
QueryClient,
QueryClientProvider,
} from '@tanstack/react-query'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

const queryClient = new QueryClient({
defaultOptions: {
queries: {
// Disable automatic refetching on window focus for SSR
refetchOnWindowFocus: false,
},
},
})
const queryClient = new QueryClient()

const privyConfig: PrivyClientConfig = {
embeddedWallets: {
Expand All @@ -33,11 +22,9 @@ const privyConfig: PrivyClientConfig = {
export default function Providers({
privyAppId,
children,
dehydratedState,
}: {
privyAppId: string
children: React.ReactNode
dehydratedState?: unknown
}) {
return (
<PrivyProvider
Expand All @@ -47,11 +34,9 @@ export default function Providers({
config={privyConfig}
>
<QueryClientProvider client={queryClient}>
<HydrationBoundary state={dehydratedState}>
<WagmiProvider config={wagmiConfig} reconnectOnMount={false}>
{children}
</WagmiProvider>
</HydrationBoundary>
<WagmiProvider config={wagmiConfig} reconnectOnMount={false}>
{children}
</WagmiProvider>
</QueryClientProvider>
</PrivyProvider>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useRef, useState } from 'react'

import {
Badge,
Expand Down Expand Up @@ -28,7 +28,6 @@ import {
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
import { multivaultAbi } from '@lib/abis/multivault'
import { useCreateAtom } from '@lib/hooks/useCreateAtom'
import { useCreateConfig } from '@lib/hooks/useCreateConfig'
import { useGetWalletBalance } from '@lib/hooks/useGetWalletBalance'
import { useImageUploadFetcher } from '@lib/hooks/useImageUploadFetcher'
import {
Expand Down Expand Up @@ -120,7 +119,17 @@ export function IdentityForm({
}
}, [state.status, transactionResponseData])

const { data: configData, isLoading: isLoadingConfig } = useCreateConfig()
const loaderFetcher = useFetcher<CreateLoaderData>()
const loaderFetcherUrl = '/resources/create'
const loaderFetcherRef = useRef(loaderFetcher.load)

useEffect(() => {
loaderFetcherRef.current = loaderFetcher.load
})

useEffect(() => {
loaderFetcherRef.current(loaderFetcherUrl)
}, [loaderFetcherUrl])

useEffect(() => {
logger('file changed', identityImageFile)
Expand Down Expand Up @@ -161,7 +170,7 @@ export function IdentityForm({
}
}, [imageUploadFetcher.data])

const fees = configData as CreateLoaderData
const fees = loaderFetcher.data as CreateLoaderData

const { data: walletClient } = useWalletClient()
const publicClient = usePublicClient()
Expand Down Expand Up @@ -741,7 +750,6 @@ export function IdentityForm({
disabled={
!address ||
loading ||
isLoadingConfig ||
!formTouched ||
['confirm', 'transaction-pending', 'awaiting'].includes(
state.status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const CreateIdentityReview: React.FC<CreateIdentityReviewProps> = ({
weight="normal"
className="text-neutral-50/50 flex items-center gap-1"
>
Estimated Cost: {totalFees.toFixed(4)} ETH
Estimated Fees: {totalFees.toFixed(4)} ETH
<InfoTooltip
content={
<div className="flex flex-col gap-2">
Expand Down
148 changes: 59 additions & 89 deletions apps/portal/app/components/home/home-stats-header.tsx
Original file line number Diff line number Diff line change
@@ -1,96 +1,76 @@
import React, { Suspense } from 'react'
import React from 'react'

import { ErrorStateCard, Separator, Text } from '@0xintuition/1ui'
import { useGetStatsQuery } from '@0xintuition/graphql'
import { Separator, Text } from '@0xintuition/1ui'

import { RevalidateButton } from '@components/revalidate-button'
import { HomeStatsHeaderSkeleton } from '@components/skeleton'
import { PATHS } from '@consts/paths'
import { formatBalance } from '@lib/utils/misc'
import { Await, Link } from '@remix-run/react'
import { Link } from '@remix-run/react'

interface HomeStatsHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}

export function HomeStatsHeader({ ...props }: HomeStatsHeaderProps) {
const { data: systemStats } = useGetStatsQuery(
{},
{
queryKey: ['GetStats'],
},
)
interface HomeStatsHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
totalIdentities: number
totalClaims: number
totalUsers: number
// totalVolume?: number omitting until we can support this
totalStaked?: number
totalSignals: number
}

export function HomeStatsHeader({
totalIdentities,
totalClaims,
totalUsers,
// totalVolume, omitting until we can support this
// totalStaked,
totalSignals,
...props
}: HomeStatsHeaderProps) {
return (
<Suspense fallback={<HomeStatsHeaderSkeleton />}>
<Await
resolve={systemStats}
errorElement={
<ErrorStateCard>
<RevalidateButton />
</ErrorStateCard>
}
>
{(resolvedStats) => {
if (!resolvedStats?.stats?.[0]) {
return <HomeStatsHeaderSkeleton />
}

const stats = resolvedStats.stats[0]
return (
<div
className="flex justify-between items-start md:items-center w-full py-4 px-6 bg-black rounded-xl theme-border"
{...props}
>
<div className="flex gap-8 max-lg:flex-col max-lg:gap-2">
<StatItem
label="Identities"
value={stats.totalAtoms}
link={PATHS.EXPLORE_IDENTITIES}
/>
<StatItem
label="Claims"
value={stats.totalTriples}
link={PATHS.EXPLORE_CLAIMS}
/>
<StatItem
label="Users"
value={stats.totalAccounts}
link={`${PATHS.EXPLORE_IDENTITIES}?isUser=true`}
/>
</div>
<Separator
orientation="vertical"
className="mx-8 h-12 w-px bg-gradient-radial from-white via-white/20"
/>
<div className="flex gap-8 max-lg:flex-col max-lg:gap-2">
{stats.contractBalance && (
<StatItem
label="TVL"
value={`${formatBalance(stats.contractBalance, 18)} ETH`}
/>
)}
<StatItem
label="Signals"
value={stats.totalSignals}
link={PATHS.GLOBAL_ACTIVITY}
/>
</div>
</div>
)
}}
</Await>
</Suspense>
<div
className="flex justify-between items-start md:items-center w-full py-4 px-6 bg-black rounded-xl theme-border"
{...props}
>
<div className="flex gap-8 max-lg:flex-col max-lg:gap-2">
<StatItem
label="Identities"
value={totalIdentities}
link={PATHS.EXPLORE_IDENTITIES}
/>
<StatItem
label="Claims"
value={totalClaims}
link={PATHS.EXPLORE_CLAIMS}
/>
{/* <StatItem label="Users" value={totalUsers} /> */}
</div>
<Separator
orientation="vertical"
className="mx-8 h-12 w-px bg-gradient-radial from-white via-white/20"
/>
<div className="flex gap-8 max-lg:flex-col max-lg:gap-2">
{/* {totalStaked && <StatItem label="TVL" value={`${totalStaked} ETH`} />} */}
<StatItem
label="Users"
value={totalUsers}
link={`${PATHS.EXPLORE_IDENTITIES}?isUser=true`}
/>
<StatItem
label="Signals"
value={totalSignals}
link={PATHS.GLOBAL_ACTIVITY}
/>
</div>
</div>
)
}

interface StatItemProps {
label: string
value: string | number
link?: string
link: string
}

function StatItem({ label, value, link }: StatItemProps) {
const content = (
<>
return (
<Link to={link} className="flex flex-col items-start">
<Text
variant="caption"
weight="regular"
Expand All @@ -101,16 +81,6 @@ function StatItem({ label, value, link }: StatItemProps) {
<Text variant="headline" weight="medium">
{value}
</Text>
</>
</Link>
)

if (link) {
return (
<Link to={link} className="flex flex-col items-start">
{content}
</Link>
)
}

return <div className="flex flex-col items-start">{content}</div>
}
2 changes: 1 addition & 1 deletion apps/portal/app/components/skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function ActivitySkeleton() {
export function HomeStatsHeaderSkeleton() {
return (
<div className="w-full">
<Skeleton className="w-full h-20" />
<Skeleton className="w-full h-24" />
</div>
)
}
Loading
Loading