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
8 changes: 1 addition & 7 deletions frontend/app/dashboard/group/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ import { useStellar } from "@/components/web3-provider";
import { useRecentPools } from "@/hooks/useRecentPools";

interface Pool {
id: string
name: string
type: 'rotational' | 'target' | 'flexible'
contract_address: string
token_address: string
creator_address: string
id: string;
name: string;
type: "rotational" | "target" | "flexible";
contract_address: string;
token_address: string;
creator_address: string;
}

const isPendingAddress = (addr: string) =>
Expand Down Expand Up @@ -123,7 +118,6 @@ export default function GroupPage({
poolAddress={pool.contract_address}
poolType={pool.type}
tokenAddress={pool.token_address}
creatorAddress={pool.creator_address}
isPaused={isPaused}
poolAdmin={poolAdmin}
onPauseChange={refreshPoolState}
Expand Down
18 changes: 14 additions & 4 deletions frontend/components/create-group/flexible-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
validatePositiveAmount,
validateWithdrawalFee,
} from "@/lib/form-validation"
import type { DuplicatePrefill } from "@/app/dashboard/create/[type]/page"

function isValidStellarAddress(addr: string) {
return /^G[A-Z2-7]{55}$/.test(addr)
Expand All @@ -30,16 +31,25 @@ const TREASURY = process.env.NEXT_PUBLIC_FACTORY_CONTRACT_ID || ""
type FieldErrors = Partial<Record<"name" | "minimumDeposit" | "withdrawalFee", string>>
type Touched = Partial<Record<"name" | "minimumDeposit" | "withdrawalFee", boolean>>

export function FlexibleForm() {
export function FlexibleForm({ prefill }: { prefill?: DuplicatePrefill }) {
const router = useRouter()
const { address } = useStellar()
const [token, setToken] = useState<SelectedToken>({ address: "native", symbol: "XLM", decimals: 7 })
const [members, setMembers] = useState<string[]>([""])
const [memberErrors, setMemberErrors] = useState<string[]>([""])
const initialMembers = prefill?.members?.filter((m: string) => m !== address) ?? [""]
const [members, setMembers] = useState<string[]>(
initialMembers.length > 0 ? initialMembers : [""]
)
const [memberErrors, setMemberErrors] = useState<string[]>(
initialMembers.length > 0 ? initialMembers.map(() => "") : [""]
)
const [error, setError] = useState("")
const [step, setStep] = useState<"idle" | "deploying" | "initializing" | "registering" | "saving">("idle")
const [formData, setFormData] = useState({
name: "", description: "", minimumDeposit: "", enableYield: false, withdrawalFee: "1",
name: prefill?.name || "",
description: prefill?.description || "",
minimumDeposit: prefill?.amount || "",
enableYield: false,
withdrawalFee: "1",
})
const [fieldErrors, setFieldErrors] = useState<FieldErrors>({})
const [touched, setTouched] = useState<Touched>({})
Expand Down
19 changes: 15 additions & 4 deletions frontend/components/create-group/target-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
validatePositiveAmount,
validateDeadline,
} from "@/lib/form-validation"
import type { DuplicatePrefill } from "@/app/dashboard/create/[type]/page"

function isValidStellarAddress(addr: string) {
return /^G[A-Z2-7]{55}$/.test(addr)
Expand All @@ -38,15 +39,25 @@ async function dateToLedger(date: Date): Promise<number> {
type FieldErrors = Partial<Record<"name" | "targetAmount" | "deadline", string>>
type Touched = Partial<Record<"name" | "targetAmount" | "deadline", boolean>>

export function TargetForm() {
export function TargetForm({ prefill }: { prefill?: DuplicatePrefill }) {
const router = useRouter()
const { address } = useStellar()
const [token, setToken] = useState<SelectedToken>({ address: "native", symbol: "XLM", decimals: 7 })
const [members, setMembers] = useState<string[]>([""])
const [memberErrors, setMemberErrors] = useState<string[]>([""])
const initialMembers = prefill?.members?.filter((m: string) => m !== address) ?? [""]
const [members, setMembers] = useState<string[]>(
initialMembers.length > 0 ? initialMembers : [""]
)
const [memberErrors, setMemberErrors] = useState<string[]>(
initialMembers.length > 0 ? initialMembers.map(() => "") : [""]
)
const [error, setError] = useState("")
const [step, setStep] = useState<"idle" | "deploying" | "initializing" | "registering" | "saving">("idle")
const [formData, setFormData] = useState({ name: "", description: "", targetAmount: "", deadline: "" })
const [formData, setFormData] = useState({
name: prefill?.name || "",
description: prefill?.description || "",
targetAmount: prefill?.amount || "",
deadline: "",
})
const [fieldErrors, setFieldErrors] = useState<FieldErrors>({})
const [touched, setTouched] = useState<Touched>({})
const errorRef = useRef<HTMLDivElement>(null)
Expand Down
Loading
Loading