Skip to content
Myr

read.ts

This file

Path

apps/web/src/features/landing/read.ts

45 lines · 1.5 KiB · TypeScript

Last changed by

Merge redesign into mainoscabrielbefore adoptioncaedd21

History of this file

Take it

Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e

line 1why, one step back
1/**

Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72

lines 2–3why, one step back
2 * The list ignores the caller, so nobody's read is everyone's and the edge may
3 * keep it.

Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e

lines 4–5why, one step back
4 */
5import { Client } from "@repo/protocol/contracts";

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 6–7why, one step back
6import type { ProjectListing } from "@repo/protocol/domain/front-page";
7import { DateTime, Effect } from "effect";

Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e

line 8why, one step back
8

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 9–10why, one step back
9import { LANDINGS_SHOWN, LandingNow } from "./landing-now.ts";
10import { LandingProjects } from "./projects.ts";

Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e

line 11why, one step back
11

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 12–17why, one step back
12const readProjects = (
13 order: (projects: readonly ProjectListing[]) => LandingProjects14): Effect.Effect<LandingProjects, never, Client> =>15 Effect.gen(function* () {16 const client = yield* Client;17 const { projects } = yield* client.listProjects({});

Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e

line 18why, one step back
18

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 19–28why, one step back
19 return order(projects);
20 }).pipe(21 Effect.catchCause(() =>22 Effect.succeed(LandingProjects.cases.Unreachable.make({}))23 )24 );2526/** Every public project, as the platform lists them: Explore groups and orders them. */27export const readEveryProject = readProjects((projects) =>28 LandingProjects.cases.Listed.make({ projects })

Merge build/landing-ceiling into mainoscabrielbefore adoption1b5d02e

line 29why, one step back
29);

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 30–45why, one step back
30
31/** The landing's "landing now": the latest landings and refused answers, as the platform orders them, read at one instant. */32export const readLandingNow: Effect.Effect<LandingNow, never, Client> =33 Effect.gen(function* () {34 const client = yield* Client;35 const { landings } = yield* client.recentLandings({});3637 return LandingNow.cases.Listed.make({38 landings: landings.slice(0, LANDINGS_SHOWN),39 now: yield* DateTime.now,40 });41 }).pipe(42 Effect.catchCause(() =>43 Effect.succeed(LandingNow.cases.Unreachable.make({}))44 )45 );