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
100 changes: 50 additions & 50 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ function DetailPlaceholder({ onPick }) {
);
}

// Which contract am I looking at? Cheap to answer, and it fills the gap under
// the list when the detail rail is taller than the cards.
function ContractCard({ count }) {
function ContractInfo() {
const [copied, setCopied] = useState(false);
async function copy() {
try {
Expand All @@ -147,33 +145,24 @@ function ContractCard({ count }) {
}
if (!CONFIGURED) return null;
return (
<section className="panel contract-card" aria-label="Contract information">
<div className="contract-head">
<p className="eyebrow">Contract</p>
<span className="network">
<i />
Sepolia
</span>
<div className="contract-info" role="group" aria-label="Sepolia contract">
<div className="contract-identity">
<span className="contract-label">Sepolia contract</span>
<code className="contract-address">{CONTRACT_ADDRESS}</code>
</div>
<code className="contract-address">{CONTRACT_ADDRESS}</code>
<div className="contract-foot">
<span>
{count.toString()} project{count === 1n ? "" : "s"} on chain
</span>
<span className="contract-actions">
<button className="ghost tiny" onClick={copy}>
{copied ? "Copied ✓" : "Copy"}
</button>
<a
href={`${EXPLORER}/address/${CONTRACT_ADDRESS}`}
target="_blank"
rel="noreferrer"
>
Etherscan ↗
</a>
</span>
<div className="contract-actions">
<button type="button" className="ghost tiny" onClick={copy}>
{copied ? "Copied ✓" : "Copy address"}
</button>
<a
href={`${EXPLORER}/address/${CONTRACT_ADDRESS}`}
target="_blank"
rel="noreferrer"
>
Etherscan ↗
</a>
</div>
</section>
</div>
);
}

Expand Down Expand Up @@ -492,24 +481,32 @@ function ProjectDetails({ data, account, ready, busy, now, transact, onClose })
</p>
) : (
<form className="contribute-form" onSubmit={contribute}>
<label>
Support this project · {eth(remainingTarget)} ETH still needed
<input
name="amount"
aria-label="Contribution ETH"
inputMode="decimal"
placeholder={eth(remainingTarget)}
required
disabled={!ready || busy}
/>
</label>
<button className="primary" disabled={!ready || busy}>
Contribute ↗
</button>
<p className="form-note tight">
Contributions are capped at the target: anything above the
remaining {eth(remainingTarget)} ETH is returned in the same
transaction.
<div className="contribute-heading">
<label htmlFor="contribution-amount">Contribution amount</label>
<span className="contribute-remaining">
{eth(remainingTarget)} ETH remaining
</span>
</div>
<div className="contribute-entry">
<div className="contribute-amount">
<input
id="contribution-amount"
name="amount"
aria-label="Contribution amount in ETH"
aria-describedby="contribution-limit"
inputMode="decimal"
placeholder={eth(remainingTarget)}
required
disabled={!ready || busy}
/>
<span aria-hidden="true">ETH</span>
</div>
<button type="submit" className="primary" disabled={!ready || busy}>
Contribute <span aria-hidden="true">↗</span>
</button>
</div>
<p id="contribution-limit" className="form-note">
Any excess is returned in the same transaction.
</p>
</form>
))}
Expand Down Expand Up @@ -1034,7 +1031,7 @@ export default function App() {
// On wide screens it is a sticky rail and must not steal the scroll position.
useEffect(() => {
if (!activeDetail || !detailRef.current) return;
if (!window.matchMedia("(max-width: 1080px)").matches) return;
if (!window.matchMedia("(max-width: 1120px)").matches) return;
detailRef.current.scrollIntoView({ behavior: "smooth", block: "start" });
}, [activeDetail?.id]);

Expand Down Expand Up @@ -1211,6 +1208,7 @@ export default function App() {
backers approve with the weight they contributed, and funds
unlock 40% / 60% — no platform in the middle.
</p>
<ContractInfo />
</div>
<div className="flow">
<div className="flow-step">
Expand Down Expand Up @@ -1484,11 +1482,13 @@ export default function App() {
</button>
</div>
)}

{!loadError && <ContractCard count={count} />}
</div>

<aside className="detail-column" ref={detailRef}>
<aside
key={activeDetail?.id ?? "placeholder"}
className="detail-column"
ref={detailRef}
>
{activeDetail ? (
<ProjectDetails
key={`${activeDetail.id}-${account}`}
Expand Down
149 changes: 114 additions & 35 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
--radius-xs: 7px;
--shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
--shadow-md: 0 12px 32px -18px rgba(15, 23, 42, 0.35);
--maxw: 1180px;
--maxw: 1420px;

font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
"Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
Expand Down Expand Up @@ -715,13 +715,13 @@ button:disabled {
/* List and detail sit side by side so clicking a card never means scrolling. */
.workspace {
display: grid;
grid-template-columns: minmax(0, 1fr) 420px;
grid-template-columns: minmax(0, 1fr) clamp(420px, 37%, 504px);
gap: 24px;
align-items: start;
margin-top: 4px;
}
.workspace:not(.with-detail) {
grid-template-columns: minmax(0, 1fr) 360px;
grid-template-columns: minmax(0, 1fr) clamp(360px, 32%, 432px);
}
.list-column {
min-width: 0;
Expand All @@ -736,6 +736,31 @@ button:disabled {
scrollbar-width: thin;
scrollbar-color: var(--border-strong) transparent;
padding-bottom: 2px;
scroll-margin-top: 88px;
}
.workspace.with-detail .detail-column {
padding-bottom: 0;
border-radius: var(--radius);
animation: detail-glow-fade 500ms ease-out 2s backwards;
}
@keyframes detail-glow-fade {
from {
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5),
0 0 0 6px rgba(37, 99, 235, 0.1),
0 0 28px rgba(37, 99, 235, 0.17);
}
to {
box-shadow: none;
}
}
@media (prefers-reduced-motion: reduce) {
.workspace.with-detail .detail-column {
animation-duration: 0s;
}
}
.workspace.with-detail .detail-panel {
margin-top: 0;
box-shadow: none;
}
.detail-column::-webkit-scrollbar {
width: 8px;
Expand Down Expand Up @@ -791,39 +816,28 @@ button:disabled {
}

/* ---------------------------------------------------------------- contract */
.contract-card {
margin-top: 16px;
padding: 16px 18px;
background: var(--surface-2);
box-shadow: none;
}
.contract-head {
.contract-info {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
flex-wrap: wrap;
align-items: flex-end;
gap: 6px 14px;
margin-top: 18px;
font-size: 12px;
}
.contract-identity {
display: grid;
gap: 2px;
min-width: 0;
}
.contract-label {
color: var(--muted);
font-weight: 650;
}
.contract-address {
display: block;
padding: 9px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-xs);
background: var(--surface);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
color: var(--ink-2);
overflow-wrap: anywhere;
}
.contract-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 10px;
font-size: 12px;
color: var(--faint);
}
.contract-actions {
display: inline-flex;
align-items: center;
Expand Down Expand Up @@ -945,16 +959,74 @@ button:disabled {
}
.contribute-form,
.payout-form {
display: flex;
align-items: flex-end;
gap: 12px;
margin: 18px 0 4px;
padding: 16px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--surface-2);
}
.contribute-form label,
.contribute-form {
display: grid;
gap: 10px;
}
.contribute-heading {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: baseline;
gap: 4px 12px;
}
.contribute-heading label,
.contribute-form .form-note {
margin: 0;
}
.contribute-remaining {
padding: 2px 8px;
border-radius: 999px;
background: var(--accent-soft);
color: var(--accent-ink);
font-size: 12px;
font-weight: 600;
overflow-wrap: anywhere;
}
.contribute-entry {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.contribute-entry input,
.contribute-entry button {
width: 100%;
height: 44px;
}
.contribute-entry button {
white-space: nowrap;
}
.contribute-amount {
position: relative;
min-width: 0;
}
.contribute-amount input {
padding-inline-end: 46px;
}
.contribute-amount > span {
position: absolute;
inset-inline-end: 12px;
top: 50%;
transform: translateY(-50%);
color: var(--muted);
font-size: 12px;
font-weight: 600;
pointer-events: none;
}
.contribute-form .form-note {
color: var(--muted);
}
.payout-form {
display: flex;
align-items: flex-end;
gap: 12px;
}
.payout-form label {
flex: 1;
margin: 0;
Expand Down Expand Up @@ -1140,7 +1212,7 @@ button:disabled {
box-shadow: var(--shadow-sm);
}
.create-panel {
max-width: 860px;
max-width: 1032px;
margin-inline: auto;
margin-top: 28px;
}
Expand Down Expand Up @@ -1458,15 +1530,22 @@ footer .brand {
.detail-stats {
grid-template-columns: 1fr;
}
.contribute-form,
.payout-form {
flex-direction: column;
align-items: stretch;
}
.detail-column {
scroll-margin-top: 132px;
}
.toast {
right: 16px;
left: 16px;
bottom: 16px;
width: auto;
}
}
@media (max-width: 400px) {
.contribute-entry {
grid-template-columns: minmax(0, 1fr);
}
}
Loading