Skip to content
Open
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
36 changes: 2 additions & 34 deletions apps/ai-credits-web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React, { useEffect, useMemo, useRef, useState } from 'react'
import {
AiCreditsWidget,
createBackendClient,
DEFAULT_DISCOUNT_CONFIG,
type DiscountConfig,
} from '@goodwidget/ai-credits-widget'
import React, { useMemo, useRef } from 'react'
import { AiCreditsWidget } from '@goodwidget/ai-credits-widget'
import type { EIP1193Provider } from '@goodwidget/core'
import {
DefaultAppKitProvider,
Expand Down Expand Up @@ -46,29 +41,6 @@ function envAddress(value: string | undefined): `0x${string}` | undefined {
return value ? (value as `0x${string}`) : undefined
}

function useDiscountConfig(backendUrl: string | undefined): DiscountConfig {
const [config, setConfig] = useState<DiscountConfig>(DEFAULT_DISCOUNT_CONFIG)

useEffect(() => {
if (!backendUrl) return

let cancelled = false

createBackendClient(backendUrl)
.getDiscountConfig()
.then((next) => {
if (!cancelled) setConfig(next)
})
.catch(() => {})

return () => {
cancelled = true
}
}, [backendUrl])

return config
}

function ReownAiCreditsWidget() {
const { open } = useAppKit()
const { disconnect } = useDisconnect()
Expand Down Expand Up @@ -324,10 +296,6 @@ function SecurityDetails() {
}

function LandingPage() {
const { depositBonusPercent, streamBonusPercent } = useDiscountConfig(
import.meta.env.VITE_AI_CREDITS_BACKEND_URL,
)

return (
<YStack
tag="main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { ChangeEvent } from 'react'
import { Theme, XStack, YStack } from 'tamagui'
import { Button, ButtonText, Card, Icon, Text } from '@goodwidget/ui'
import { InputError, InputFrame, InputLabel } from '@goodwidget/ui'
import { ProfileTextAreaField } from '../ProfileTextAreaField'
import type {
GovernanceHouse,
GovernanceProfileDraft,
Expand Down
Loading