Compare commits

..
4 Commits
Author SHA1 Message Date
ginnoir 4ea9b86f8e chore: release v0.6.10
CI / checks (push) Skipped
Release Image / build-and-push (push) Successful in 7m45s
2026-07-18 17:25:59 -05:00
ginnoir 9b3bd02b0b feat: open notes in view mode with optional editor
default to reading the note; edit opens the form alone without a
side preview since the rich text editor already shows live content.
2026-07-18 17:25:50 -05:00
ginnoir 0be93d088b chore: release v0.6.9
CI / checks (push) Skipped
Release Image / build-and-push (push) Successful in 8m21s
2026-07-18 17:23:06 -05:00
ginnoir 832e7265c9 fix: build share urls from auth_url instead of localhost
docker build sets next_public_app_url to localhost; preferring it over
runtime auth_url made prod share links point at localhost:3000.
2026-07-18 17:22:58 -05:00
7 changed files with 122 additions and 30 deletions
+12
View File
@@ -1,5 +1,17 @@
# Changelog # Changelog
## [0.6.10](https://github.com/ginnoir/famapp/compare/v0.6.9...v0.6.10) (2026-07-18)
### Features
- open notes in view mode with optional editor ([9b3bd02](https://github.com/ginnoir/famapp/commit/9b3bd02b0bafc89a514ca8fd4434f9659b9ee4c2))
## [0.6.9](https://github.com/ginnoir/famapp/compare/v0.6.8...v0.6.9) (2026-07-18)
### Bug Fixes
- build share urls from auth_url instead of localhost ([832e726](https://github.com/ginnoir/famapp/commit/832e7265c9354edf86f28f72f129ee34da8c3d04))
## [0.6.8](https://github.com/ginnoir/famapp/compare/v0.6.7...v0.6.8) (2026-07-18) ## [0.6.8](https://github.com/ginnoir/famapp/compare/v0.6.7...v0.6.8) (2026-07-18)
### Bug Fixes ### Bug Fixes
+2
View File
@@ -16,7 +16,9 @@ ENV CI=true
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV DATABASE_URL=postgres://build:build@localhost:5432/build ENV DATABASE_URL=postgres://build:build@localhost:5432/build
ENV AUTH_SECRET=build-time-placeholder ENV AUTH_SECRET=build-time-placeholder
# Build-only placeholder. Runtime public URL is AUTH_URL from stack.env — never prefer this.
ENV NEXT_PUBLIC_APP_URL=http://localhost:3000 ENV NEXT_PUBLIC_APP_URL=http://localhost:3000
ENV AUTH_URL=http://localhost:3000
COPY . . COPY . .
RUN pnpm install --offline --frozen-lockfile RUN pnpm install --offline --frozen-lockfile
RUN --mount=type=cache,id=famapp-nextjs,target=/app/.next/cache \ RUN --mount=type=cache,id=famapp-nextjs,target=/app/.next/cache \
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "famapp", "name": "famapp",
"version": "0.6.8", "version": "0.6.10",
"private": true, "private": true,
"type": "module", "type": "module",
"packageManager": "pnpm@10.33.3", "packageManager": "pnpm@10.33.3",
+8
View File
@@ -0,0 +1,8 @@
/** Public origin for absolute links. AUTH_URL wins — Docker build sets NEXT_PUBLIC to localhost. */
export function getAppPublicUrl(): string {
const raw =
process.env.AUTH_URL?.trim() ||
process.env.NEXT_PUBLIC_APP_URL?.trim() ||
"http://localhost:3000";
return raw.replace(/\/$/, "");
}
+2 -3
View File
@@ -1,6 +1,7 @@
import { createHash, randomBytes } from "crypto"; import { createHash, randomBytes } from "crypto";
import { and, eq, isNull } from "drizzle-orm"; import { and, eq, isNull } from "drizzle-orm";
import type { ApiAuthContext } from "@/lib/api-auth"; import type { ApiAuthContext } from "@/lib/api-auth";
import { getAppPublicUrl } from "@/lib/app-url";
import { db } from "@/lib/db"; import { db } from "@/lib/db";
import { getEntityType, getRegistry } from "./registry"; import { getEntityType, getRegistry } from "./registry";
import { shareLinks } from "./schema"; import { shareLinks } from "./schema";
@@ -27,9 +28,7 @@ function hashToken(raw: string): string {
} }
function buildUrl(token: string): string { function buildUrl(token: string): string {
const base = return `${getAppPublicUrl()}/s/${token}`;
process.env["NEXT_PUBLIC_APP_URL"] ?? process.env["AUTH_URL"] ?? "http://localhost:3000";
return `${base}/s/${token}`;
} }
export function listShareableEntityTypes() { export function listShareableEntityTypes() {
+2 -3
View File
@@ -2,6 +2,7 @@
import { createHash, randomBytes } from "crypto"; import { createHash, randomBytes } from "crypto";
import { and, eq, isNull } from "drizzle-orm"; import { and, eq, isNull } from "drizzle-orm";
import { getAppPublicUrl } from "@/lib/app-url";
import { db } from "@/lib/db"; import { db } from "@/lib/db";
import { getCurrentSession } from "@/lib/session"; import { getCurrentSession } from "@/lib/session";
import { getEntityType } from "./registry"; import { getEntityType } from "./registry";
@@ -21,9 +22,7 @@ function hashToken(raw: string): string {
} }
function buildUrl(token: string): string { function buildUrl(token: string): string {
const base = return `${getAppPublicUrl()}/s/${token}`;
process.env["NEXT_PUBLIC_APP_URL"] ?? process.env["AUTH_URL"] ?? "http://localhost:3000";
return `${base}/s/${token}`;
} }
export async function createShareLink( export async function createShareLink(
+95 -23
View File
@@ -2,10 +2,9 @@
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { Pin, PinOff, Save, Trash2 } from "lucide-react"; import { Bell, Pencil, Pin, PinOff, Save, Trash2, X } from "lucide-react";
import { useState, useTransition } from "react"; import { useState, useTransition } from "react";
import { EntityComments } from "@/components/comments/entity-comments"; import { EntityComments } from "@/components/comments/entity-comments";
import { RichTextContent } from "@/components/rich-text";
import { DetailBackLink } from "@/components/detail-back-link"; import { DetailBackLink } from "@/components/detail-back-link";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
@@ -13,6 +12,7 @@ import { Label } from "@/components/ui/label";
import { ShareButton } from "@/components/share-button"; import { ShareButton } from "@/components/share-button";
import type { NoteDto } from "../server/queries"; import type { NoteDto } from "../server/queries";
import { createNote, deleteNote, setNotePinned, updateNote } from "../server/actions"; import { createNote, deleteNote, setNotePinned, updateNote } from "../server/actions";
import { NoteRichTextBody } from "./note-rich-text-body";
const RichTextEditor = dynamic( const RichTextEditor = dynamic(
() => import("@/components/rich-text/rich-text-editor").then((mod) => mod.RichTextEditor), () => import("@/components/rich-text/rich-text-editor").then((mod) => mod.RichTextEditor),
@@ -29,6 +29,7 @@ const RichTextEditor = dynamic(
export function NoteEditor({ note, currentUserId }: { note?: NoteDto; currentUserId?: string }) { export function NoteEditor({ note, currentUserId }: { note?: NoteDto; currentUserId?: string }) {
const router = useRouter(); const router = useRouter();
const [currentNote, setCurrentNote] = useState(note); const [currentNote, setCurrentNote] = useState(note);
const [editing, setEditing] = useState(!note);
const [title, setTitle] = useState(note?.title ?? ""); const [title, setTitle] = useState(note?.title ?? "");
const [body, setBody] = useState(note?.body ?? ""); const [body, setBody] = useState(note?.body ?? "");
const [remindAt, setRemindAt] = useState(toLocalDateTimeValue(note?.remindAt ?? null)); const [remindAt, setRemindAt] = useState(toLocalDateTimeValue(note?.remindAt ?? null));
@@ -36,6 +37,25 @@ export function NoteEditor({ note, currentUserId }: { note?: NoteDto; currentUse
const pinned = currentNote?.pinned ?? false; const pinned = currentNote?.pinned ?? false;
function beginEdit() {
if (!currentNote) return;
setTitle(currentNote.title);
setBody(currentNote.body);
setRemindAt(toLocalDateTimeValue(currentNote.remindAt));
setEditing(true);
}
function cancelEdit() {
if (!currentNote) {
router.push("/notes");
return;
}
setTitle(currentNote.title);
setBody(currentNote.body);
setRemindAt(toLocalDateTimeValue(currentNote.remindAt));
setEditing(false);
}
function saveNote() { function saveNote() {
startTransition(async () => { startTransition(async () => {
if (currentNote) { if (currentNote) {
@@ -46,6 +66,7 @@ export function NoteEditor({ note, currentUserId }: { note?: NoteDto; currentUse
remindAt: remindAt ? new Date(remindAt) : null, remindAt: remindAt ? new Date(remindAt) : null,
}); });
setCurrentNote(updated); setCurrentNote(updated);
setEditing(false);
return; return;
} }
@@ -73,38 +94,87 @@ export function NoteEditor({ note, currentUserId }: { note?: NoteDto; currentUse
}); });
} }
const displayTitle = currentNote?.title || title || "New note";
const updatedLabel = currentNote
? new Date(currentNote.updatedAt).toLocaleDateString(undefined, {
year: "numeric",
month: "long",
day: "numeric",
})
: null;
const reminderLabel = currentNote?.remindAt
? new Date(currentNote.remindAt).toLocaleString(undefined, {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "2-digit",
})
: null;
return ( return (
<div className="mx-auto grid w-full max-w-6xl gap-4 min-w-0"> <div className="mx-auto grid w-full max-w-3xl gap-4 min-w-0">
<DetailBackLink href="/notes" label="Notes" /> <DetailBackLink href="/notes" label="Notes" />
<header className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between"> <header className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
<div className="flex items-center gap-2 min-w-0 flex-1"> <div className="min-w-0 flex-1">
{pinned && <Pin className="size-3.5 text-[var(--accent)]" />} <div className="flex items-center gap-2 min-w-0">
<h2 className="serif text-[24px] font-medium tracking-tight truncate"> {pinned ? <Pin className="size-3.5 shrink-0 text-[var(--accent)]" /> : null}
{currentNote ? currentNote.title : "New note"} <h2 className="serif text-[24px] font-medium tracking-tight truncate">
</h2> {displayTitle}
</h2>
</div>
{!editing && currentNote ? (
<p className="muted text-[13px] mt-1 inline-flex flex-wrap items-center gap-x-2 gap-y-1">
{pinned ? <span>Pinned</span> : null}
{pinned && updatedLabel ? <span>·</span> : null}
{updatedLabel ? <span>Updated {updatedLabel}</span> : null}
{reminderLabel ? (
<>
<span>·</span>
<span className="inline-flex items-center gap-1">
<Bell className="size-3" />
{reminderLabel}
</span>
</>
) : null}
</p>
) : null}
</div> </div>
<div className="flex flex-wrap gap-2"> <div className="flex flex-wrap gap-2">
{currentNote ? ( {currentNote ? (
<Button variant="outline" size="sm" onClick={togglePinned} disabled={isPending}> <Button variant="outline" size="sm" onClick={togglePinned} disabled={isPending}>
{pinned ? <PinOff className="size-3.5" /> : <Pin className="size-3.5" />} {pinned ? <PinOff className="size-3.5" /> : <Pin className="size-3.5" />}
{pinned ? "Unpin note" : "Pin note"} {pinned ? "Unpin" : "Pin"}
</Button> </Button>
) : null} ) : null}
{currentNote ? <ShareButton entityType="notes.note" entityId={currentNote.id} /> : null} {currentNote ? <ShareButton entityType="notes.note" entityId={currentNote.id} /> : null}
{currentNote ? ( {currentNote ? (
<Button variant="destructive" size="sm" onClick={removeNote} disabled={isPending}> <Button variant="destructive" size="sm" onClick={removeNote} disabled={isPending}>
<Trash2 className="size-3.5" /> <Trash2 className="size-3.5" />
Delete note Delete
</Button> </Button>
) : null} ) : null}
<Button size="sm" onClick={saveNote} disabled={!title.trim() || isPending}> {editing ? (
<Save className="size-3.5" /> <>
Save note <Button variant="outline" size="sm" onClick={cancelEdit} disabled={isPending}>
</Button> <X className="size-3.5" />
Cancel
</Button>
<Button size="sm" onClick={saveNote} disabled={!title.trim() || isPending}>
<Save className="size-3.5" />
Save
</Button>
</>
) : (
<Button size="sm" onClick={beginEdit}>
<Pencil className="size-3.5" />
Edit
</Button>
)}
</div> </div>
</header> </header>
<div className="grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(280px,420px)] min-w-0"> {editing ? (
<section <section
className="grid gap-4 rounded-[var(--r-lg)] border-[0.5px] bg-[var(--card)] p-4 shadow-[var(--shadow-1)] min-w-0" className="grid gap-4 rounded-[var(--r-lg)] border-[0.5px] bg-[var(--card)] p-4 shadow-[var(--shadow-1)] min-w-0"
style={{ borderColor: "var(--hair)" }} style={{ borderColor: "var(--hair)" }}
@@ -138,16 +208,18 @@ export function NoteEditor({ note, currentUserId }: { note?: NoteDto; currentUse
/> />
</div> </div>
</section> </section>
) : currentNote ? (
<aside <section
className="rounded-[var(--r-lg)] border-[0.5px] bg-[var(--card)] p-4 text-[var(--ink)] shadow-[var(--shadow-1)] min-w-0" className="rounded-[var(--r-lg)] border-[0.5px] bg-[var(--card)] p-4 shadow-[var(--shadow-1)] min-w-0 text-[var(--ink)]"
style={{ borderColor: "var(--hair)" }} style={{ borderColor: "var(--hair)" }}
aria-label="Preview"
> >
<div className="eyebrow mb-3">Preview</div> {currentNote.body ? (
<RichTextContent html={body} /> <NoteRichTextBody noteId={currentNote.id} body={currentNote.body} />
</aside> ) : (
</div> <p className="text-sm muted">No body text.</p>
)}
</section>
) : null}
{currentNote && currentUserId ? ( {currentNote && currentUserId ? (
<EntityComments <EntityComments