Skip to content

Commit

Artifacts' home keeps its filters on one row beside the search box, and an artifact in someone else's Private shows whose it is instead of reading "Private".

syntaqxcommitted Parentcc6fc9bBrowse files
2 files+15−60/2 viewed
+11−2
1212 import { dayGroups } from "../../lib/folios";
1313 import { TimeAgo } from "../ui";
1414 import { Hint } from "../ui/hint";
15+import { useFoliosData } from "./actions";
1516 import { FolioThumbnail, KindIcon } from "./kinds";
1617 import { FolioMenu } from "./menu";
1718 import { AccessMark } from "./parts";
1819
20+/** Where it sits, in a word: its space; else your Private, or whose it is when it's someone else's. */
21+function placeOf(folio: Folio, me: string | undefined): string {
22+ if (folio.space) return folio.space.name;
23+ return `user:${folio.owner.id}` === me ? "Private" : folio.owner.display_name;
24+}
25+
1926 function Edited({ folio }: { folio: Folio }) {
2027 const by = folio.edited_by?.display_name;
2128 return (
2835 }
2936
3037 export function FolioRow({ slug, folio, onError }: { slug: string; folio: Folio; onError?: (message: string) => void }) {
38+ const me = useFoliosData()?.me.key;
3139 return (
3240 <li className="group relative flex items-center gap-3 px-3 py-2 transition-colors hover:bg-raised/60 sm:px-4">
3341 <KindIcon kind={folio.kind} />
4553 <span className="relative hidden shrink-0 sm:flex">
4654 <AccessMark folio={folio} />
4755 </span>
48− <span className="hidden w-32 shrink-0 truncate text-xs text-faint md:block">{folio.space?.name ?? "Private"}</span>
56+ <span className="hidden w-32 shrink-0 truncate text-xs text-faint md:block">{placeOf(folio, me)}</span>
4957 <span className="relative w-28 shrink-0 text-right max-sm:w-auto">
5058 <Edited folio={folio} />
5159 </span>
7684 }
7785
7886 export function FolioCard({ slug, folio, onError }: { slug: string; folio: Folio; onError?: (message: string) => void }) {
87+ const me = useFoliosData()?.me.key;
7988 return (
8089 <div className="group relative flex flex-col overflow-hidden rounded-xl border border-line bg-surface transition-colors hover:border-line-strong">
8190 <div className="pointer-events-none h-32 shrink-0 border-b border-line">
8998 {folio.title || "Untitled"}
9099 </Link>
91100 <span className="mt-0.5 flex items-center gap-1.5 text-[0.6875rem] text-faint">
92− <span className="truncate">{folio.space?.name ?? "Private"}</span>
101+ <span className="truncate">{placeOf(folio, me)}</span>
93102 <span aria-hidden="true">·</span>
94103 <span className="relative">
95104 <Edited folio={folio} />
+4−4
142142 value={search.get("kind") ?? "any"}
143143 onValueChange={(v) => set({ kind: v === "any" ? null : v })}
144144 options={[{ value: "any", label: "Any kind" }, ...FOLIO_KINDS.map((k) => ({ value: k, label: FOLIO_KIND_UI[k].label }))]}
145− className="h-9 min-w-32"
145+ className="h-9 w-36 max-md:w-full"
146146 />
147147 <SelectField
148148 aria-label="Space"
149149 value={search.get("space") ?? "any"}
150150 onValueChange={(v) => set({ space: v === "any" ? null : v })}
151151 options={[{ value: "any", label: "Any space" }, { value: "private", label: "Private" }, ...spaces.map((s) => ({ value: s.id, label: s.name }))]}
152− className="h-9 min-w-32"
152+ className="h-9 w-36 max-md:w-full"
153153 />
154154 <SelectField
155155 aria-label="Owner"
156156 value={search.get("owner") ?? "any"}
157157 onValueChange={(v) => set({ owner: v === "any" ? null : v })}
158158 options={[{ value: "any", label: "Anyone" }, ...(layout?.mentionables ?? []).filter((m) => m.kind === "user").map((m) => ({ value: m.name, label: m.name === layout?.me.name ? "You" : m.display_name }))]}
159− className="h-9 min-w-32"
159+ className="h-9 w-36 max-md:w-full"
160160 />
161161 {projects.length > 0 && (
162162 <SelectField
164164 value={search.get("project") ?? "any"}
165165 onValueChange={(v) => set({ project: v === "any" ? null : v })}
166166 options={[{ value: "any", label: "Any project" }, ...projects.map((p) => ({ value: p, label: p }))]}
167− className="h-9 min-w-40"
167+ className="h-9 w-44 max-md:w-full"
168168 />
169169 )}
170170 </>