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
5 changes: 5 additions & 0 deletions apps/web/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ export const wording = {
archived: "Archived",
},
lastActivity: (relative: string) => `Active ${relative}`,
view: {
label: "Show projects as",
grid: "Tiles",
rows: "List",
},
loading: "Reading your projects…",
emptyTitle: "No projects yet",
emptyLead: "Start one from New project; it shows here from then on.",
Expand Down
9 changes: 9 additions & 0 deletions apps/web/src/library-view-setting.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect, test } from "bun:test";
import { parseLibraryView } from "./library-view-setting.ts";

test("only the two layouts are read back; anything else leaves the default", () => {
expect(parseLibraryView("grid")).toBe("grid");
expect(parseLibraryView("rows")).toBe("rows");
expect(parseLibraryView("tiles")).toBeNull();
expect(parseLibraryView("")).toBeNull();
});
24 changes: 24 additions & 0 deletions apps/web/src/library-view-setting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* How the Projects page lays projects out, tiles or a list of one-liners, kept
* in this browser. Tiles until the person chooses.
*/
import {
useStoredPreference,
writeStoredPreference,
} from "./stored-preference.ts";

const LIBRARY_VIEW_KEY = "builder-library-view";

/** Tiles, or a list of one line per project. */
export type ViewMode = "grid" | "rows";

export const parseLibraryView = (raw: string): ViewMode | null =>
raw === "grid" || raw === "rows" ? raw : null;

export function useLibraryView(): ViewMode {
return useStoredPreference(LIBRARY_VIEW_KEY, parseLibraryView, "grid");
}

export function writeLibraryView(mode: ViewMode): void {
writeStoredPreference(LIBRARY_VIEW_KEY, mode);
}
53 changes: 53 additions & 0 deletions apps/web/src/pages/project-library.css
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,56 @@
),
color-mix(in oklab, var(--cover-b) 15%, var(--wb-card));
}

.library-page .library-view {
display: inline-flex;
gap: var(--space-1);
}

/* As a list: one line per project, a small swatch of its cover at the start,
the stage and last activity after the name, and the menu at the end. */
.library-page .library-grid[data-view="rows"] {
display: flex;
flex-direction: column;
gap: var(--space-2);
}

.library-page .library-grid[data-view="rows"] .library-card-open {
flex-direction: row;
align-items: center;
gap: var(--space-3);
padding: var(--space-2) var(--space-12) var(--space-2) var(--space-3);
}

.library-page .library-grid[data-view="rows"] .library-cover {
flex: none;
width: 2rem;
aspect-ratio: 1;
border-radius: var(--radius-lg);
}

.library-page .library-grid[data-view="rows"] .library-card-body {
display: flex;
flex: 1;
min-width: 0;
align-items: center;
gap: var(--space-3);
padding: 0;
}

.library-page .library-grid[data-view="rows"] .library-card-title {
flex: 1;
min-width: 0;
}

.library-page .library-grid[data-view="rows"] .library-card-meta {
flex-wrap: nowrap;
padding-right: 0;
white-space: nowrap;
}
Comment on lines +187 to +191

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 · In list view on narrow screens, the project name shrinks to nothing because the meta line cannot shrink

The stage badge and the 'Active …' time are kept on one line (flex-wrap: nowrap; white-space: nowrap) and have no way to shrink, so they always take their full width. The name is the only part that gives way (flex: 1; min-width: 0). The list has no media query to fall back on, so on a narrow screen the name is cut down to just an ellipsis, or the meta runs past the card edge and is clipped.

Turn on list view at a phone width (about 360px). Roughly 240px is left after the padding, swatch and gaps, and the badge plus 'Active 3 days ago' fill most of it.

Resolve this comment. Triage will not finish while it is open.


.library-page .library-grid[data-view="rows"] .library-card-menu {
top: 50%;
bottom: auto;
transform: translateY(-50%);
}
Loading