a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix titles for local docs

+17 -9
+6 -6
app/(home-pages)/home/HomeLayout.tsx
··· 231 231 }} 232 232 > 233 233 <LeafletListItem 234 - title={props?.titles?.[leaflet.root_entity] || "Untitled"} 234 + title={props?.titles?.[leaflet.root_entity]} 235 235 archived={archived} 236 236 token={leaflet} 237 237 draftInPublication={ ··· 275 275 276 276 let sortedLeaflets = leaflets.sort((a, b) => { 277 277 if (sort === "alphabetical") { 278 - if (titles[a.token.root_entity] === titles[b.token.root_entity]) { 278 + let titleA = titles[a.token.root_entity] ?? "Untitled"; 279 + let titleB = titles[b.token.root_entity] ?? "Untitled"; 280 + 281 + if (titleA === titleB) { 279 282 return a.added_at > b.added_at ? -1 : 1; 280 283 } else { 281 - return titles[a.token.root_entity].toLocaleLowerCase() > 282 - titles[b.token.root_entity].toLocaleLowerCase() 283 - ? 1 284 - : -1; 284 + return titleA.toLocaleLowerCase() > titleB.toLocaleLowerCase() ? 1 : -1; 285 285 } 286 286 } else { 287 287 return a.added_at === b.added_at
+10 -2
app/(home-pages)/home/LeafletList/LeafletInfo.tsx
··· 1 1 "use client"; 2 - import { PermissionToken } from "src/replicache"; 2 + import { PermissionToken, useEntity } from "src/replicache"; 3 3 import { LeafletOptions } from "./LeafletOptions"; 4 4 import Link from "next/link"; 5 5 import { use, useState } from "react"; ··· 8 8 import { timeAgo } from "src/utils/timeAgo"; 9 9 import { usePublishLink } from "components/ShareOptions"; 10 10 import { Separator } from "components/Layout"; 11 + import { usePageTitle } from "components/utils/UpdateLeafletTitle"; 11 12 12 13 export const LeafletInfo = (props: { 13 14 title?: string; ··· 28 29 let prettyCreatedAt = props.added_at ? timeAgo(props.added_at) : ""; 29 30 let prettyPublishedAt = props.publishedAt ? timeAgo(props.publishedAt) : ""; 30 31 32 + // Look up root page first, like UpdateLeafletTitle does 33 + let firstPage = useEntity(props.leaflet_id, "root/page")[0]; 34 + let entityID = firstPage?.data.value || props.leaflet_id; 35 + let titleFromDb = usePageTitle(entityID); 36 + 37 + let title = props.title ?? titleFromDb ?? "Untitled"; 38 + 31 39 return ( 32 40 <div 33 41 className={`leafletInfo w-full min-w-0 flex flex-col ${props.className}`} 34 42 > 35 43 <div className="flex justify-between items-center shrink-0 max-w-full gap-2 leading-tight overflow-hidden"> 36 44 <h3 className="sm:text-lg text-base truncate w-full min-w-0"> 37 - {props.title} 45 + {title} 38 46 </h3> 39 47 <div className="flex gap-1 shrink-0"> 40 48 {props.isTemplate && props.display === "list" ? (
+1 -1
app/(home-pages)/home/LeafletList/LeafletListItem.tsx
··· 14 14 display: "list" | "grid"; 15 15 cardBorderHidden: boolean; 16 16 added_at: string; 17 - title: string; 17 + title?: string; 18 18 draftInPublication?: string; 19 19 published?: boolean; 20 20 publishedAt?: string;