Skip to content
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
9 changes: 0 additions & 9 deletions apps/create/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ const App = () => {
Party Create
</NavLink>
<LandingLink />
<NavLink
to="/"
end
className={({ isActive }) =>
`party-nav-link text-sm font-medium ${isActive ? "active text-[#00d4ff]" : ""}`
}
>
Search
</NavLink>
{address && (
<NavLink
to={`/profile/${address}`}
Expand Down
3 changes: 2 additions & 1 deletion apps/create/src/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ export const Profile = () => {
<CardHeader>
<CardTitle>Tokens</CardTitle>
<CardDescription>
Party tokens you hold. Open to view, buy, or sell on this app.
Party tokens you hold. Open to view, buy, or sell on this app. Only ERC20 tokens are
included.
</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-6">
Expand Down
85 changes: 76 additions & 9 deletions apps/create/src/pages/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useForm } from "react-hook-form";
import { useNavigate } from "react-router";
import { Link, useNavigate } from "react-router";

import {
Button,
Expand All @@ -12,39 +12,106 @@ import {
Label
} from "@party-forever/ui";

interface FormData {
interface TokenFormData {
tokenAddress: string;
}

interface ProfileFormData {
address: string;
}

export const Search = () => {
const navigate = useNavigate();
const { register, handleSubmit } = useForm<FormData>();
const tokenForm = useForm<TokenFormData>();
const profileForm = useForm<ProfileFormData>();

const onSubmit = (data: FormData) => {
const onTokenSubmit = (data: TokenFormData) => {
navigate(`/${data.tokenAddress}`);
};

const onProfileSubmit = (data: ProfileFormData) => {
navigate(`/profile/${data.address.trim()}`);
};

return (
<div className="p-6 flex flex-col items-center gap-6">
<div className="p-6 flex flex-col lg:flex-row lg:items-start lg:justify-center gap-6">
<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>View token</CardTitle>
<CardTitle>View ERC20 token</CardTitle>
<CardDescription>
Enter a token address to buy, sell, or trade on Uniswap (Base)
Enter an ERC20 token address to buy, sell, or trade on Uniswap (Base)
</CardDescription>
</CardHeader>
<CardContent>
<form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-4">
<form onSubmit={tokenForm.handleSubmit(onTokenSubmit)} className="flex flex-col gap-4">
<div className="flex flex-col gap-2">
<Label htmlFor="token-address">Token address</Label>
<Input id="token-address" placeholder="0x..." {...register("tokenAddress")} />
<Input
id="token-address"
placeholder="0x..."
{...tokenForm.register("tokenAddress")}
/>
</div>
<Button type="submit" className="w-full">
View token
</Button>
</form>
<div className="mt-4 pt-4 border-t border-border">
<p className="text-sm text-muted-foreground mb-2">Example</p>
<Link
to="/0x90e3b08e50bf662154964c6051ab3ce64024ff24"
className="text-sm text-primary underline hover:no-underline hover:text-primary/80 break-all"
>
0x90e3b08e50bf662154964c6051ab3ce64024ff24
</Link>
</div>
</CardContent>
</Card>

<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>Profile</CardTitle>
<CardDescription>
Enter a wallet address to view Party ERC20 token holdings
</CardDescription>
</CardHeader>
<CardContent>
<form
onSubmit={profileForm.handleSubmit(onProfileSubmit)}
className="flex flex-col gap-4"
>
<div className="flex flex-col gap-2">
<Label htmlFor="profile-address">Wallet address</Label>
<Input
id="profile-address"
placeholder="0x..."
{...profileForm.register("address")}
/>
</div>
<Button type="submit" className="w-full">
View Profile
</Button>
</form>
<div className="mt-4 pt-4 border-t border-border">
<p className="text-sm text-muted-foreground mb-2">Example</p>
<Link
to="/profile/0xba5f2ffb721648Ee6a6c51c512A258ec62f1D6af"
className="text-sm text-primary underline hover:no-underline hover:text-primary/80 break-all"
>
0xba5f2ffb721648Ee6a6c51c512A258ec62f1D6af
</Link>
</div>
</CardContent>
</Card>

<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>NFTs</CardTitle>
<CardDescription>
Party NFTs are pinned on IPFS and available to view and trade via OpenSea.
</CardDescription>
</CardHeader>
</Card>
</div>
);
};
7 changes: 6 additions & 1 deletion apps/create/src/pages/TokenDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useState } from "react";
import { Link, useParams } from "react-router";
import { useConnectModal } from "@rainbow-me/rainbowkit";
import { parseEther } from "viem";
import { useAccount } from "wagmi";

Expand Down Expand Up @@ -53,6 +54,7 @@ const ERC20_BALANCE_ABI = [
export const TokenDetails = () => {
const { address } = useParams<{ address: string }>();
const { address: userAddress } = useAccount();
const { openConnectModal } = useConnectModal();

const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
Expand Down Expand Up @@ -215,7 +217,10 @@ export const TokenDetails = () => {
>
Sell
</Button>
<Button className="flex-1" onClick={() => setBuyModalOpen(true)}>
<Button
className="flex-1"
onClick={() => (userAddress ? setBuyModalOpen(true) : openConnectModal?.())}
>
Buy
</Button>
</div>
Expand Down