Skip to content

Reconcile phase branches onto seed + JFA UI conformance#2

Open
NetworkTheoryAppliedResearchInstitute wants to merge 16 commits into
seedfrom
p3011-governance-fixes
Open

Reconcile phase branches onto seed + JFA UI conformance#2
NetworkTheoryAppliedResearchInstitute wants to merge 16 commits into
seedfrom
p3011-governance-fixes

Conversation

@NetworkTheoryAppliedResearchInstitute

Copy link
Copy Markdown
Contributor

Consolidates the accumulated phase work onto the default branch (seed) and brings the frontend into JFA conformance.

Reconcile branches

p3011-governance-fixes is the linear tip of the phase chain (phase-2 → phase-3-lbtas → phase-4-escrow-gate → phase-4-plan-contracting → p3011-governance-fixes), 0 commits behind seed. This PR merges all of it onto seed so the reputation, contract, escrow-gate, plan-contracting, and governance UI live on the default branch.

JFA UI conformance (§7.3) — pairs with Agrinet #141

The backend retired the general fiat top-up (/payments/pix/create → 410) and now funds a specific transaction's escrow. The profile page is brought in line:

  • Removed the deposit UI — modal, "Depositar" button, doDeposit(), and the "Total deposited" stat. The in-network unit is earned and spend-only, never purchasable.
  • Honest balance labeling — the balance is earned in-network, credited from sales and refunds, not purchasable or redeemable for cash.
  • Platform-fee transparency — the wallet summary shows the current fee from GET /payments/fee (JFA open problem 7: transparent, contestable fees).

Reputation display was already conformant (LbtasDistribution/lib/lbtas.js: distribution, never averaged; dismissals surfaced). No averaging or single-score anywhere.

🤖 Generated with Claude Code

…etplace

- lib/postTypes.js: config-driven field sets for high-value types
  (Service, Direct Market, Product) + buildPostBody() → /posts payload
- components/posts/NewPostModal.js: type picker → per-type form +
  media upload (/posts/upload-media) → POST /posts
- components/posts/MyPosts.js: reusable owner view (list/create/delete)
- app/farm + app/services: wired to the user's own posts via MyPosts
- app/marketplace: switched /listings → /posts General Broadcast,
  category pills → post-type pills, NewListingModal → NewPostModal
- ListingCard: render media[] + post-type badge, tolerate no-price
  (service) posts, guard quantity/location
- i18n: Products + a few owner-view strings

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- lib/postTypes.js: plan_producer, plan_consumer, agrotourism field
  sets per whitepaper §4.5.3.2/.4 (PING rate, contract shares,
  planting/harvest dates, hydration/nutrition/health plans, event kind)
- marketplace: "Planos" pill groups both plan types client-side
  (single post_type param can't), + Agroturismo pill + demo rows
- My Farm now surfaces plan_consumer too so nothing created is orphaned

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reputation is rendered as the canonical LBTAS distribution (a row of the six
static levels -1..+4 with the live count beneath each, single divider) — never
an average. Matches the reference "How to Display LBTAS Ratings".

- lib/lbtas.js: client mirror of the scale (levels, labels, descriptions,
  totalOf, word count)
- components/ratings/LbtasDistribution.js: the static-levels / dynamic-counts display
- components/ratings/RatePrompt.js: -1..+4 selector + comment box that becomes
  required (<=500 words) when -1 is chosen -> POST /ratings/transactions/:id
- app/perfil: replace the meaningless "Rep: N" badge with the distribution
  (GET /ratings/me); add a Rate button to rateable transactions
- app/contracts: functional page — pending-rating prompt feed
  (GET /ratings/me/pending) + my reputation distribution
- i18n: rating UI strings

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ases escrow

- RatePrompt: releasesEscrow prop shows a "held payment released to seller"
  note, switches the CTA to "Confirm & release", and reports the payment-released
  toast when the API returns escrowReleased
- perfil: buyer's action on a paid tx is now "Confirm & rate"; the seller's
  "Liberar" button only appears once the buyer has rated (gate is server-enforced)
- contracts: pending buyer-side paid items flag releasesEscrow
- i18n: gate strings

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A buyer's -1 now warns that it opens a dispute and freezes payment (instead of
releasing), with a "Submit & open dispute" CTA and a "funds frozen" toast.
0..+4 keep the release note + "Confirm & release". Mirrors the backend change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The same user can be an excellent market seller and a poor agrotourism host —
ReputationPanel shows one LBTAS distribution per role (from /ratings/me roles[]),
replacing the single mixed distribution on the profile and contracts pages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replaces the bare release/refund buttons on the admin Disputes tab with a
resolution modal that:
- shows the transaction's LBTAS ratings (incl. the disputed -1 + justification),
  voided ones dimmed
- settles the money: release to seller or refund buyer
- on a bad-faith finding: voids the buyer's rating and lets the admin issue a
  replacement rating of the seller (-1 requires a comment), via the
  voidBuyerRating/adminRating payload on POST /admin/disputes/:id/resolve

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A plan post now shows a "Contract plan" (plan_producer) or "Fulfill request"
(plan_consumer) action that posts to /transactions/from-plan and routes to the
profile to pay — mirroring the listing-purchase flow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ransfer

Opened from a plan-contract transaction in the profile:
- PING schedule summary (cadence + checkpoints + next) and the producer's
  progress-update timeline (notes + photos)
- seller can post an update (note + photo upload via /posts/upload-media)
- buyer can sell/transfer the contract to another buyer's email at a negotiated
  price (POST /transactions/:id/transfer); PING reporting follows ownership

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- ListingDetail: a "Message" button (any post, hidden on your own) opens/continues
  the post's conversation via POST /conversations {post_id} and routes to the thread
- NewPostModal: edit mode — prefill from an existing post and PUT /posts/:id
- MyPosts: an Edit (✎) action on each owned post opens the editor; plans included
- i18n: Message / Edit / sign-in-to-message strings

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- ListingDetail: plans show "allocated / total contracted · N backers" (and a
  not-divisible note for contract_shares=none), from GET /posts/:id/contracts
- ContractModal: PING calendar — checkpoint chips, next highlighted, 📷 on
  checkpoints that received a producer report

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- plan forms: a Settlement select (On confirmation / At maturity)
- ContractModal: shows "🔒 Settles at maturity: <date>" when the contract holds
- profile: the confirm-and-rate button is hidden until the contract matures
  (the backend enforces the hold regardless)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- plan forms: Settlement gains "Progress payments (tranches)" + a tranche count field
- ContractModal: shows tranche progress (X/N released, amount released of total) and,
  for the buyer on a live contract, a "Release next payment" button (final tranche
  is released by the rating)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rnance footer

- ReputationPanel: show "N× rating dismissed (on record)" per role (V1 — never hide)
- My Contracts: "Flags received" — contest a -1 made against you, either direction
  (V2), via POST /ratings/:id/contest
- DisputeResolveModal: read the operator-local narrative field (V3)
- Footer: "Network & Governance" — names the Agrinet protocol + NTARI steward,
  states front-end standing / cheap exit (G1) and links a rule-contestation path (G2)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pairs with Agrinet PR #141 (backend retired the general fiat top-up).

- Remove the deposit UI (modal, "Depositar" button, doDeposit -> /payments/pix/create,
  "Total depositado" stat): the in-network unit is earned and spend-only, never
  purchasable.
- Balance card now labels the balance honestly: earned in-network, credited from
  sales and refunds, not purchasable or redeemable for cash.
- Wallet summary shows Spent / Received from sales / Refunded, plus the current
  platform fee fetched from GET /payments/fee (transparent, contestable fee).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants