"""HTML views for the source-grounded ioby offline experience.""" from __future__ import annotations from html import escape from typing import Any, Iterable, Mapping from urllib.parse import quote PROJECT = { "slug": "make-block-bloom", "title": "Make the Block Bloom", "summary": "Rebuilding our green spaces, healing our connections with each other and with the land", "leader": "Kofi Thomas", "location": "50 Goodwin Place Brooklyn, NY 11207", "raised": "$32,161.00", "goal": "$32,086.00", } def money(cents: int) -> str: return f"${cents / 100:,.2f}" def _account_links(account: Mapping[str, Any] | None) -> str: if account: name = escape(str(account.get("display_name") or "Local account")) return ( '
' + name + '
' ) return '
Local donor sign in
' def layout( title: str, body: str, account: Mapping[str, Any] | None = None, *, description: str = "ioby brings neighborhood projects to life, block by block.", closure: bool = True, body_class: str = "", ) -> str: closure_bar = ( '
' "ioby has closed its doors. Read more here.
" if closure else "" ) return f""" {escape(title)} - ioby {closure_bar}
{body}
{_account_links(account)} """ def home(account: Mapping[str, Any] | None = None) -> str: cards = _project_cards() body = f"""

NEIGHBOR-LED CHANGE

Crowdfunding for community-led change.

Explore thousands of projects that brought neighbors together and made communities stronger.

Find a project to support
Neighbors gathering in New York

Ideas from neighbors, backed by neighbors

Browse archived community projects and use the local WebsiteBench donation simulation.

{cards}

View all projects

{footer()}""" return layout("Crowdfunding for community-led change", body, account) def _project_cards() -> str: projects = ( ( "crystal-gardens.jpg", "Ended 03/16/2024", "p5", "$6,133.63", "$6,433.63", "The Crystal Gardens: An Immersive Healing Art Exhibition", "Focusing on the mental health in our community while providing access to positive coping mechanisms.", "Cleveland, OH", "/project/crystal-gardens-immersive-healing-art-exhibition/", ), ( "resource-center.jpg", "77 days left", "p2", "$12,240.00", "$12,500.00", "10th Street Neighborhood Resource Center", "Help us raise funds for the planning, organizing, and art space open for residents of the Historic 10th Street District!", "Dallas, TX", "/project/10th-street-neighborhood-resource-center/", ), ( "lemonade-stand.jpg", "Ended 07/31/2024", "p71", "$1,191.63", "$4,081.63", "Sweet & Sassy Girls - Lemonade Stand", "The Sweet & Sassy girls will raise money at the annual lemonade stand to purchase school uniforms for children in need.", "Brooklyn, NY", "/project/sweet-sassy-girls-lemonade-stand/", ), ) result: list[str] = [] for image, ended, progress, needed, goal, title, summary, location, href in projects: result.append( f"""
{ended}

{needed} still needed of {goal}

{escape(title)}

{'' + escape(summary) + '' if title.startswith('The Crystal Gardens') else escape(summary)}

●  {escape(location)}

""" ) return "".join(result) def _make_block_bloom_card() -> str: """Render the archived New York greening project required by Core 768.""" return f"""
Neighbors learning together in a community gardenEnded 06/29/2021

{PROJECT['raised']} raised of {PROJECT['goal']}

{escape(PROJECT['title'])}

{escape(PROJECT['summary'])}

●  Brooklyn, NY

""" def project_catalog( *, query: str = "", state: str = "", impact: str = "", account: Mapping[str, Any] | None = None, ) -> str: no_results = query.strip().casefold() == "zzzz-no-match-websitebench" selected_state = state == "NY" selected_greening = impact == "greening" if no_results: count, pages, cards = "0", "0", "" elif selected_greening: # The frozen source scope includes one directly observed greening # project that satisfies the selected New York donation journey. # Do not keep showing unrelated default cards after this filter. count, pages, cards = "1", "1", _make_block_bloom_card() elif selected_state: count, pages, cards = "1", "1", _make_block_bloom_card() else: count, pages, cards = "3879", "259", _project_cards() empty = ( '

No projects found

Try another search or clear your filters to return to available projects.

Clear filters
' if no_results else f'
{cards}
' ) body = f"""

Find a project to support

Clear filters

{count} results | Page {'0' if no_results else '1'} out of {pages}

{empty}
{footer()}""" return layout("Find a project to support", body, account) def new_york(account: Mapping[str, Any] | None = None) -> str: body = f"""

‹ PLACES

New York

New Yorkers dancing together at a community gathering

ioby was founded in Brooklyn, New York over fifteen years ago as a tool to address the climate crisis. Top down solutions were not meeting the urgent needs of neighbors, who felt compelled to take action for a more sustainable planet. From there, ioby bloomed to support a vast array of social impact projects that focused on racial equity, queer liberation, immigrant justice, and so much more.

Given our Brooklyn roots, New York remains one of the primary hubs of ioby’s work. Since 2008, leaders have raised almost $9M on ioby across the state.

Explore a greening project
{_project_cards()}
{footer()}""" return layout("New York", body, account, body_class="places-page") def project_detail( account: Mapping[str, Any] | None = None, *, saved: bool = False, notice: str = "", ) -> str: save_label = "Saved" if saved else "Save project" notice_html = f'

{escape(notice)}

' if notice else "" body = f"""
This project was eligible for matching funds through 2021 NYC COVID-19 Just Recovery Match Fund
Neighbors learning together in a community garden

{PROJECT['title']}

{PROJECT['summary']}

Leader
{PROJECT['leader']}
Location
{PROJECT['location']}
{notice_html}

About this project

Make the Block Bloom brought neighbors together to rebuild green spaces, grow food, and strengthen connections to the land. The archived project was led by Kofi Thomas in Brooklyn, New York.

Why this matters

Healthy public green space supports learning, wellbeing, and lasting relationships between neighbors.

Project updates

Thank you, neighbors

The campaign reached its goal. This offline record preserves the public impact story.

Budget

Garden materials, neighborhood workshops, plants, tools, and project coordination.

Donor recognition

Supporters could choose public recognition or remain anonymous.

WebsiteBench local simulation

The source campaign is closed. The button below starts a local-only donation journey; no money is moved and no message is sent.

Donate $10 locally
{footer()}""" return layout(PROJECT["title"], body, account, description=PROJECT["summary"]) def simple_project(title: str, account: Mapping[str, Any] | None = None) -> str: body = f'

‹ Projects

{escape(title)}

This archived project is represented in the catalogue. The complete local donation simulation is available for Make the Block Bloom.

{footer()}' return layout(title, body, account) def donation_amount( account: Mapping[str, Any] | None = None, *, error: str = "", values: Mapping[str, Any] | None = None, ) -> str: values = values or {} err = f'' if error else "" amount = escape(str(values.get("amount") or "10"), quote=True) cadence = str(values.get("cadence") or "one-time") body = f"""

‹ Back to project

LOCAL SANDBOX · NO REAL DONATION

Support Make the Block Bloom

  1. Amount
  2. Details
  3. Sandbox
  4. Review
{err}
Choose a donation amount
Minimum $1.00. This amount remains entirely local.
Frequency
""" return layout("Choose donation amount", body, account, closure=False, body_class="flow-page") def donation_details( donation: Mapping[str, Any], account: Mapping[str, Any] | None = None, *, error: str = "", values: Mapping[str, Any] | None = None, ) -> str: values = values or donation err = f'' if error else "" def val(key: str) -> str: return escape(str(values.get(key) or ""), quote=True) anon = str(values.get("recognition") or "public") == "anonymous" body = f"""

LOCAL SANDBOX · NO REAL DONATION

Your details

  1. Amount
  2. Details
  3. Sandbox
  4. Review
{err}
{money(int(donation['amount_cents']))} {escape(str(donation['cadence']))} for {escape(str(donation['project_title']))}
Recognition preference
""" return layout("Donor details", body, account, closure=False, body_class="flow-page") def donation_payment( donation: Mapping[str, Any], account: Mapping[str, Any] | None = None, *, error: str = "", ) -> str: err = f'' if error else "" body = f"""

LOCAL SANDBOX · NO PAYMENT CREDENTIALS

Choose a sandbox outcome

  1. Amount
  2. Details
  3. Sandbox
  4. Review
{err}
{money(int(donation['amount_cents']) + int(donation['tip_cents']))} total · {escape(str(donation['project_title']))}
Local payment scenario

Do not enter card numbers, bank details, or payment credentials. This clone does not collect them.

""" return layout("Local payment sandbox", body, account, closure=False, body_class="flow-page") def donation_review( donation: Mapping[str, Any], account: Mapping[str, Any] | None = None, *, error: str = "" ) -> str: err = f'' if error else "" body = f"""

FINAL LOCAL REVIEW

Review your donation

  1. Amount
  2. Details
  3. Sandbox
  4. Review
{err}
Project
{escape(str(donation['project_title']))}
Amount
{money(int(donation['amount_cents']))}
Frequency
{escape(str(donation['cadence']))}
Donor
{escape(str(donation['donor_name']))}
Recognition
{escape(str(donation['recognition']))}
Payment
Approved local sandbox simulation
""" return layout("Review local donation", body, account, closure=False, body_class="flow-page") def receipt(donation: Mapping[str, Any], account: Mapping[str, Any] | None = None) -> str: body = f"""

✓

LOCAL SIMULATION CONFIRMED

Thank you for supporting a neighborhood idea

Exactly one local donation record was created.

Receipt
{escape(str(donation['receipt_number']))}
Project
{escape(str(donation['project_title']))}
Amount
{money(int(donation['amount_cents']))}
Frequency
{escape(str(donation['cadence']))}
Status
Confirmed · local sandbox
Not a tax receipt. No funds were transferred to ioby or the project. This record exists only inside the WebsiteBench offline clone.

Back to the project Donation history

""" return layout("Local donation receipt", body, account, closure=False, body_class="flow-page") def sign_in(*, email: str = "", error: str = "", next_url: str = "/account") -> str: err = f'' if error else "" body = f"""

LOCAL ACCOUNT

Sign in

Use a site-isolated local donor account. No identity provider is contacted.

{err}

Forgot password?

New here? Create a local account

Return to projects

""" return layout("Sign in", body, closure=False, body_class="flow-page") def register( *, values: Mapping[str, Any] | None = None, error: str = "", code: str = "" ) -> str: values = values or {} err = f'' if error else "" if code: body = f"""

LOCAL OUTBOX

Verify your local account

{err}

No email was sent. For this offline simulation, use the code shown below.

{escape(code)}
""" else: body = f"""

LOCAL ACCOUNT

Create an account

Use a synthetic address such as donor@example.test. Verification stays in the local outbox.

{err}

Return to sign in

""" return layout("Create local account", body, closure=False, body_class="flow-page") def recover(*, message: str = "", error: str = "", code: str = "") -> str: err = f'' if error else "" info = f'

{escape(message)}

' if message else "" complete = ( f"""{escape(code)}
""" if code else "" ) request = "" if code else '
The public response is the same whether or not a local account exists.
' body = f'

LOCAL RECOVERY

Reset your password

No real email is sent. A code is exposed only in this browser\'s local outbox.

{err}{info}{request}{complete}

Return to sign in

' return layout("Reset local password", body, closure=False, body_class="flow-page") def account_dashboard(account: Mapping[str, Any], donations: Iterable[Mapping[str, Any]], recurring: Iterable[Mapping[str, Any]], notice: str = "") -> str: donations = list(donations) recurring = list(recurring) notice_html = f'

{escape(notice)}

' if notice else "" body = f"""
{notice_html}

SITE-ISOLATED LOCAL ACCOUNT

Welcome, {escape(str(account.get('display_name') or 'donor'))}

{escape(str(account.get('email') or account.get('email_normalized') or ''))}

{len(donations)}confirmed local donations{sum(1 for plan in recurring if plan['status']=='active')}active local recurring plans♥saved projects

Return to projects

{footer()}""" return layout("Local donor account", body, account) def donation_history(account: Mapping[str, Any], donations: Iterable[Mapping[str, Any]]) -> str: rows = [] for item in donations: rows.append(f"""

{escape(str(item['confirmed_at']))}

{escape(str(item['project_title']))}

{money(int(item['amount_cents']))} · {escape(str(item['cadence']))} · Confirmed

Open receipt
""") empty = '

No donations yet

Browse projects
' body = f'

‹ Account

Donation history

{"".join(rows) if rows else empty}

Back to projects

{footer()}' return layout("Donation history", body, account) def recurring_plans(account: Mapping[str, Any], plans: Iterable[Mapping[str, Any]], notice: str = "") -> str: rows = [] for plan in plans: action = 'Canceled' if plan['status'] == 'canceled' else f'
' rows.append(f'

{escape(str(plan["project_title"]))}

{money(int(plan["amount_cents"]))} monthly · {escape(str(plan["status"]))}

Next: {escape(str(plan.get("next_local_run") or "none"))}

{action}
') notice_html = f'

{escape(notice)}

' if notice else "" body = f'

‹ Account

Recurring donation settings

{notice_html}{"".join(rows) or "

No recurring plans.

"}
These plans are local records only. They never charge a payment method.
{footer()}' return layout("Recurring donation settings", body, account) def _reference_cards(items: Iterable[tuple[str, str, str]], *, kind: str = "") -> str: cards = [] colors = ("sky", "orange-card", "green-card", "navy-card") for index, (label, title, href) in enumerate(items): cards.append( f'
' f'

{escape(label)}

' f'

{escape(title)}

Learn more
' ) return f"
{''.join(cards)}
" def match_programs(account: Mapping[str, Any] | None = None) -> str: items = ( ("Past program", "2020 Cuyahoga Arts & Culture Match Fund", "/match/2020-cuyahoga-arts-culture/"), ("Past program", "2020 Doors Open Pittsburgh Match Challenge", "/match/2020-doors-open-pittsburgh/"), ("Past program", "2020 Healthy Neighborhoods Challenge", "/match/2020-healthy-neighborhoods/"), ("Past program", "2021 Con Edison Power Up Neighborhood Match", "/match/2021-con-edison-power-up/"), ("Past program", "2021 Cuyahoga Arts & Culture Match Fund", "/match/2021-cuyahoga-arts-culture/"), ("Past program", "2021 Detroit Match Program", "/match/2021-detroit/"), ) body = f"""

COMMUNITY FUNDS GO FURTHER

Match Programs

ioby partnered with local organizations to match donations to eligible neighborhood projects.

How match funding worked at ioby

Match programs brought flexible funding and one-on-one support to resident-led work. Explore a selection of the programs preserved in the public archive.

Learn how match funding worked at ioby

Past

{_reference_cards(items, kind="match-cards")}
{footer()}""" return layout("Match Programs", body, account, body_class="match-page") def places(account: Mapping[str, Any] | None = None) -> str: items = ( ("PLACE", "Arkansas", "/places/arkansas/"), ("PLACE", "Cleveland", "/places/cleveland/"), ("PLACE", "Detroit", "/places/detroit/"), ("PLACE", "New York", "/places/newyorkcity/"), ("PLACE", "Pittsburgh", "/places/pittsburgh/"), ) body = f"""

Places

Neighbors led change in communities across the country. Explore places where ioby supported local leaders and projects.

{_reference_cards(items, kind="place-cards")}
{footer()}""" return layout("Places", body, account, body_class="places-page") def how_it_worked(account: Mapping[str, Any] | None = None) -> str: items = ( ("START HERE", "Currently Crowdfunding? Your questions answered here", "/how-it-works/currently-crowdfunding/"), ("OUR SERVICES", "Fees", "/how-it-works/fees/"), ("OUR SERVICES", "Criteria", "/how-it-works/criteria/"), ("OUR SERVICES", "Fiscal Sponsorship", "/how-it-works/fiscal-sponsorship/"), ("OUR SERVICES", "Match Funding", "/how-it-works/match-funding/"), ("OUR SERVICES", "Coaching", "/how-it-works/coaching/"), ) body = f"""

How It Worked

ioby gave neighborhood leaders the tools and support to plan, fund, and carry out positive change.

About Our Services

Leaders received fiscal sponsorship, coaching, fundraising tools, and access to match opportunities throughout their campaigns.

{_reference_cards(items, kind="service-cards")}
{footer()}""" return layout("How It Worked", body, account, body_class="how-page") def about(account: Mapping[str, Any] | None = None) -> str: links = ( ("MORE ABOUT US", "Reports", "/about/reports/"), ("MORE ABOUT US", "Transparency", "/about/transparency/"), ("POLICIES", "Privacy Policy", "/about/privacy/"), ("POLICIES", "Terms & Conditions", "/about/terms/"), ) values = ( ("Neighborhood wisdom", "Residents understand their communities and should lead the change they want to see."), ("Racial equity", "Community investment works best when resources and decisions stay close to neighbors."), ("Collective power", "Small donations, practical tools, and shared effort can build lasting local impact."), ) value_html = "".join(f'

{escape(title)}

{escape(copy)}

' for title, copy in values) body = f"""

More than just crowdfunding.
Community-led positive change.

Our Mission

ioby mobilized neighbors who had good ideas to become powerful civic leaders who planned, funded, and made positive change in their own neighborhoods.

Our Values

{value_html}

More about us

{_reference_cards(links, kind="about-cards")}
{footer()}""" return layout("About", body, account, body_class="about-page") def resources(account: Mapping[str, Any] | None = None) -> str: items = ( ("Guides", "Making It Rain", "/resources/making-it-rain/"), ("Guides", "Recipes For Change", "/resources/recipes-for-change/"), ("Guides", "Leader Toolkit", "/resources/leader-toolkit/"), ("Announcement", "Closing Our Doors", "/resources/closing/"), ("Ideas", "Report from The Field: The Northwest Arkansas Neighborhood Match Program", "/resources/report-from-the-field-the-northwest-arkansas-neighborhood-match-program/"), ("Leader Stories", "10 Climate-Conscious Projects We Love", "/resources/10-climate-conscious-projects-we-love/"), ("Guides", "ioby’s Comprehensive Guide to End-of-Year Fundraising", "/resources/iobys-comprehensive-guide-to-end-of-year-fundraising/"), ("Guides", "Active Transit Toolkit", "/resources/active-transit-toolkit/"), ("Ideas", "Sustaining Justice in our Neighborhoods, Block by Block", "/resources/sustaining-justice-in-our-neighborhoods-block-by-block/"), ) body = f"""

Resources

Guides, ideas, and stories from community leaders.

{_reference_cards(items, kind="resource-cards")}
{footer()}""" return layout("Resources", body, account, body_class="resources-page") def reference_detail(section: str, title: str, account: Mapping[str, Any] | None = None) -> str: body = f'

{escape(section.upper())}

{escape(title)}

This page is an offline archival summary of a route observed on the public ioby site. It does not contact the former service or send messages.

Back to {escape(section.replace("-", " ").title())}

{footer()}' return layout(title, body, account) def generic_page(title: str, heading: str, copy: str, account: Mapping[str, Any] | None = None) -> str: body = f'

{escape(heading)}

{escape(copy)}

Find a project

{footer()}' return layout(title, body, account) def not_found(account: Mapping[str, Any] | None = None) -> str: body = """

404

Page not found

Try one of these pages instead:

""" return layout("Page not found", body, account, closure=False) def footer() -> str: return """"""