asks.tsx
This file
Path
apps/web/src/features/project/asks.tsx
97 lines · 2.5 KiB · TypeScript
Last changed by
Merge redesign into mainoscabrielbefore adoptioncaedd21
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
line 1why, one step back1import type { Ask, AskListing } from "@repo/protocol/domain/ask";Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 2why, one step back2import type { AskId, ProjectName } from "@repo/protocol/ids";Merge build/1500-design-draws into mainoscabrielbefore adoption9bc46b7
line 3why, one step back3import type { DateTime } from "effect";Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 4–5why, one step back4import type { ReactNode } from "react";5Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 6–9why, one step back6import { arrange } from "../front/families.ts";7import type { AskProgress } from "../shared/ask-progress.ts";8import { FamilyStrip } from "../shared/family.tsx";9import { AskRow, RowList } from "../shared/row.tsx";Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 10why, one step back10Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 11–14why, one step back11export const openToTake = (listing: AskListing) =>12 !listing.claimed &&13 listing.blockedBy.length === 0 &&14 listing.reserve === undefined;Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 15why, one step back15Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 16–21why, one step back16export const openAsks = (listings: readonly AskListing[]) => {17 const finales = new Set(18 arrange(listings).flatMap((item) =>19 item.kind === "family" ? [item.finale] : []20 )21 );Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 22why, one step back22Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 23–25why, one step back23 return listings.filter(24 ({ ask, blockedBy }) => !(finales.has(ask) && blockedBy.length > 0)25 );Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 26–27why, one step back26};27Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
line 28why, one step back28export const AskList = ({Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 29why, one step back29 asks,Merge build/1500-design-draws into mainoscabrielbefore adoption9bc46b7
line 30why, one step back30 now,Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
line 31why, one step back31 parents,Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 32why, one step back32 project,Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 33–35why, one step back33 selected,34 stamps,35 states,Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 36why, one step back36}: {Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
line 37why, one step back37 readonly asks: readonly AskListing[];Merge build/1500-design-draws into mainoscabrielbefore adoption9bc46b7
line 38why, one step back38 readonly now: DateTime.Utc;Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 39why, one step back39 readonly project: ProjectName;Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 40–43why, one step back40 readonly parents: readonly Ask[];41 readonly states: ReadonlyMap<AskId, AskProgress>;42 readonly stamps: ReadonlySet<AskId>;43 readonly selected: string | undefined;Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 44why, one step back44}) => {Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 45–48why, one step back45 const row = (listing: AskListing, strip?: ReactNode) => (46 <AskRow47 key={listing.ask}48 listing={listing}Merge build/1500-design-draws into mainoscabrielbefore adoption9bc46b7
line 49why, one step back49 now={now}Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 50–55why, one step back50 progress={states.get(listing.ask)}51 project={project}52 selected={selected === listing.ask}53 strip={strip}54 />55 );Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 56why, one step back56Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 57–62why, one step back57 return (58 <RowList label="Open asks">59 {arrange(asks).flatMap((item) => {60 if (item.kind === "ask") {61 return [row(item.listing)];62 }Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 63why, one step back63Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
line 64why, one step back64 const parent = parents.find(({ id }) => id === item.parent.ask);Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 65why, one step back65Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 66–71why, one step back66 if (parent === undefined) {67 return [68 row(item.parent),69 ...item.members.map((member) => row(member)),70 ];71 }Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
line 72why, one step back72Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 73–90why, one step back73 return [74 row(75 item.parent,76 <FamilyStrip77 expanded78 finale={item.finale}79 parent={parent}80 project={project}81 stamps={stamps}82 states={states}83 wants={84 new Map(item.members.map((member) => [member.ask, member.want]))85 }86 />87 ),88 ];89 })}90 </RowList>Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 91–93why, one step back91 );92};93Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd
lines 94–97why, one step back94export const askListIds = (asks: readonly AskListing[]) =>95 arrange(asks).map((item) =>96 item.kind === "ask" ? item.listing.ask : item.parent.ask97 );