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
14 changes: 13 additions & 1 deletion src/components/DeadlineCountdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { useState, useEffect } from "react";
const DEADLINE_HOURS = 72;

export function DeadlineCountdown({ lastPlotTime }: { lastPlotTime: string }) {
const [remaining, setRemaining] = useState(() => calcRemaining(lastPlotTime));
const [remaining, setRemaining] = useState<number | null>(() =>
typeof window === "undefined" ? null : calcRemaining(lastPlotTime),
);

useEffect(() => {
const interval = setInterval(() => {
Expand All @@ -14,6 +16,16 @@ export function DeadlineCountdown({ lastPlotTime }: { lastPlotTime: string }) {
return () => clearInterval(interval);
}, [lastPlotTime]);

if (remaining === null) {
return (
<div className="border-border bg-surface mt-4 rounded border px-3 py-2 text-xs">
<span className="text-muted">Deadline: </span>
<span className="text-accent font-medium">--:--:--</span>
<span className="text-muted ml-1">remaining</span>
</div>
);
}

if (remaining <= 0) {
return (
<div className="border-error/30 bg-error/5 mt-4 rounded border px-3 py-2 text-xs">
Expand Down
1 change: 1 addition & 0 deletions src/components/DonateWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function DonateWidget({ storylineId }: DonateWidgetProps) {
abi: storyFactoryAbi,
functionName: "donate",
args: [BigInt(storylineId), parsedAmount],
gas: BigInt(150_000),
});
setTxHash(hash);

Expand Down
2 changes: 2 additions & 0 deletions src/components/TradingWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function TradingWidget({ tokenAddress }: { tokenAddress: Address }) {
abi: mcv2BondAbi,
functionName: "mint",
args: [tokenAddress, parsedAmount, maxCost, address],
gas: BigInt(2_000_000),
});
setTxHash(hash);
setTxState("pending");
Expand Down Expand Up @@ -125,6 +126,7 @@ export function TradingWidget({ tokenAddress }: { tokenAddress: Address }) {
abi: mcv2BondAbi,
functionName: "burn",
args: [tokenAddress, parsedAmount, minRefund, address],
gas: BigInt(2_000_000),
});
setTxHash(hash);
setTxState("pending");
Expand Down
Loading