diff --git a/.env b/.env index 8ffa39ae..04bf2b7b 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ NEXT_PUBLIC_POSTS_PAGE_SIZE=20 NEXT_PUBLIC_THEME=penx-theme-garden -DATABASE_URL=postgresql://user:demo@43.154.135.183:5437/demo +DATABASE_URL=postgresql://user:demo@43.154.135.183:5437/demo \ No newline at end of file diff --git a/.github/workflows/create-images.yml b/.github/workflows/create-images.yml index 8deb236e..4ae630d0 100644 --- a/.github/workflows/create-images.yml +++ b/.github/workflows/create-images.yml @@ -31,4 +31,4 @@ jobs: multiPlatform: true platform: linux/amd64,linux/arm64 username: ${{ secrets.GHCR_USERNAME }} - password: ${{ secrets.GHCR_TOKEN }} \ No newline at end of file + password: ${{ secrets.GHCR_TOKEN }} diff --git a/README.md b/README.md index 86eb5e05..1c12cb1f 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,5 @@ Deploy your blog in **10 minutes**! ## ⚖️ License + + diff --git a/app/(creator-fi)/CreatorFiLayout.tsx b/app/(creator-fi)/CreatorFiLayout.tsx index 13d9f468..c5e8a67c 100644 --- a/app/(creator-fi)/CreatorFiLayout.tsx +++ b/app/(creator-fi)/CreatorFiLayout.tsx @@ -2,7 +2,6 @@ import { PropsWithChildren, Suspense } from 'react' import { useQueryEthBalance } from '@/app/(creator-fi)/hooks/useEthBalance' -import { useQueryEthPrice } from '@/app/(creator-fi)/hooks/useEthPrice' import { ClientOnly } from '@/components/ClientOnly' import LoadingCircle from '@/components/icons/loading-circle' import { Profile } from '@/components/Profile/Profile' @@ -51,7 +50,6 @@ interface Props { } export function CreatorFiLayout({ children, space }: PropsWithChildren) { - useQueryEthPrice() useQueryEthBalance() return ( diff --git a/app/(creator-fi)/Space/SpaceNav.tsx b/app/(creator-fi)/Space/SpaceNav.tsx index cc3b6dd0..d4c3e3e0 100644 --- a/app/(creator-fi)/Space/SpaceNav.tsx +++ b/app/(creator-fi)/Space/SpaceNav.tsx @@ -29,7 +29,7 @@ export function SpaceNav({}: Props) { return (
- subscription + Membership diff --git a/app/(creator-fi)/Space/SpaceStats.tsx b/app/(creator-fi)/Space/SpaceStats.tsx index 63ecfea9..6e836b7d 100644 --- a/app/(creator-fi)/Space/SpaceStats.tsx +++ b/app/(creator-fi)/Space/SpaceStats.tsx @@ -1,11 +1,11 @@ 'use client' import { ReactNode } from 'react' +import { useSpaceContext } from '@/components/SpaceContext' import { Skeleton } from '@/components/ui/skeleton' -import { useEthPrice } from '@/app/(creator-fi)/hooks/useEthPrice' +import { useEthPrice } from '@/hooks/useEthPrice' import { precision } from '@/lib/math' import { useBalance } from 'wagmi' -import { useSpaceContext } from '@/components/SpaceContext' interface Props {} diff --git a/app/(creator-fi)/creator-fi/plans/AddPlanDialog/AddPlanForm.tsx b/app/(creator-fi)/creator-fi/plans/AddPlanDialog/AddPlanForm.tsx index e7bab384..4b5e9cb2 100644 --- a/app/(creator-fi)/creator-fi/plans/AddPlanDialog/AddPlanForm.tsx +++ b/app/(creator-fi)/creator-fi/plans/AddPlanDialog/AddPlanForm.tsx @@ -4,7 +4,7 @@ import { useMemo, useState } from 'react' import { useForm } from 'react-hook-form' import { NumberInput } from '@/app/(creator-fi)/components/NumberInput' import { editorDefaultValue } from '@/app/(creator-fi)/constants' -import { useEthPrice } from '@/app/(creator-fi)/hooks/useEthPrice' +import { usePlans } from '@/app/(creator-fi)/hooks/usePlans' import LoadingDots from '@/components/icons/loading-dots' import { useSpaceContext } from '@/components/SpaceContext' import { Button } from '@/components/ui/button' @@ -18,6 +18,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { useCheckChain } from '@/hooks/useCheckChain' +import { useEthPrice } from '@/hooks/useEthPrice' import { useWagmiConfig } from '@/hooks/useWagmiConfig' import { spaceAbi } from '@/lib/abi' import { addToIpfs } from '@/lib/addToIpfs' @@ -42,6 +43,7 @@ export function AddPlanForm() { const { ethPrice } = useEthPrice() const wagmiConfig = useWagmiConfig() const checkChain = useCheckChain() + const { refetch } = usePlans() const form = useForm>({ resolver: zodResolver(FormSchema), @@ -65,10 +67,12 @@ export function AddPlanForm() { const cid = await addToIpfs( JSON.stringify({ name: data.name, - benefits: JSON.stringify(editorDefaultValue), + benefits: editorDefaultValue, }), ) + // console.log('=======cid:', cid, 'ethPrice:', ethPrice) + const price = precision.token(Number(data.price) / ethPrice) const hash = await writeContract(wagmiConfig, { address: space.address as Address, @@ -80,6 +84,9 @@ export function AddPlanForm() { await waitForTransactionReceipt(wagmiConfig, { hash }) setIsOpen(false) + setTimeout(() => { + refetch() + }, 1500) toast.success('Add Plan successfully!') } catch (error) { const msg = extractErrorMessage(error) @@ -130,7 +137,7 @@ export function AddPlanForm() { diff --git a/app/(creator-fi)/creator-fi/plans/PlanItem.tsx b/app/(creator-fi)/creator-fi/plans/PlanItem.tsx index 5820dd5f..ced8c478 100644 --- a/app/(creator-fi)/creator-fi/plans/PlanItem.tsx +++ b/app/(creator-fi)/creator-fi/plans/PlanItem.tsx @@ -3,13 +3,13 @@ import { useMemberDialog } from '@/app/(creator-fi)/components/MemberDialog/useMemberDialog' import { Plan } from '@/app/(creator-fi)/domains/Plan' import { useAddress } from '@/app/(creator-fi)/hooks/useAddress' -import { useEthPrice } from '@/app/(creator-fi)/hooks/useEthPrice' import { useMembers } from '@/app/(creator-fi)/hooks/useMembers' import { useSubscriptions } from '@/app/(creator-fi)/hooks/useSubscriptions' import { PlateEditor } from '@/components/editor/plate-editor' import { useSpaceContext } from '@/components/SpaceContext' import { Button } from '@/components/ui/button' import { Card } from '@/components/ui/card' +import { useEthPrice } from '@/hooks/useEthPrice' import { useConnectModal } from '@rainbow-me/rainbowkit' import { EditIcon } from 'lucide-react' import { useAccount } from 'wagmi' @@ -35,7 +35,7 @@ export function PlanItem({ plan }: Props) { ) return ( - + {space.isFounder(address) && ( )} -
+
{plan.name}
@@ -58,8 +58,8 @@ export function PlanItem({ plan }: Props) {
-
- +
+