Search and tags look through the Archive, and archived cards say so

A search or a tag filter on the main board, and a tag's own view, now
list every note not in Trash (a new `all` board view on the server and in
the core), so finished work can still be looked up. Archive and Trash
keep a search inside themselves.

An archived note met anywhere but the Archive carries an "Archived" chip
at the top of its card, on the web and on Android.

Task #6315.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 16:23:08 -04:00
co-authored by Claude Opus 5.5
parent 5780220ff1
commit b98a0c315f
10 changed files with 107 additions and 18 deletions
+12
View File
@@ -52,6 +52,10 @@ const sharedLine = computed(() => {
return props.note.shared ? "Shared" : "";
});
// A search or a tag reaches into the Archive, so an archived card met anywhere but
// the Archive itself says so: put away, not current.
const showArchived = computed(() => props.note.archived && !props.note.trashed && notes.view !== "archived");
// --- Retention countdown, so someone browsing Trash can restore a note in time.
// Null when not trashed or retention is off. ---
const trashDays = computed(() =>
@@ -217,6 +221,14 @@ const tagColors = computed<Record<string, string>>(() => {
<!-- Tags first: a board is scanned, and tags say what a note is about. Above the
body rather than beside it, so they don't compete with its first line, the
note's name. -->
<div v-if="showArchived" class="mb-2">
<span
class="inline-flex items-center gap-1 rounded-full bg-black/5 px-2 py-0.5 text-xs font-medium text-neutral-600 dark:bg-white/10 dark:text-neutral-300"
>
<Icon name="archive" class="!h-3 !w-3" />
Archived
</span>
</div>
<div v-if="chipLabels.length" class="mb-2 flex flex-wrap gap-1">
<!-- Every chip carries the `#`, so a lifted chip reads as the `#todo` somebody
typed, as on Android. -->
+10 -2
View File
@@ -3,7 +3,9 @@ import { ref } from "vue";
import { repo } from "../adapters";
import { useUiStore } from "./ui";
export type NoteView = "active" | "archived" | "trash";
// `all` is the board and the Archive together: what a search or a tag looks through,
// so finished work stays findable after it has been put away. Never Trash.
export type NoteView = "active" | "archived" | "trash" | "all";
// Combinable facet filters for the board (mirrors the GET /api/notes query). All
// optional; empty = the plain, unfiltered board. The date bounds are Timeline's.
export interface NoteFacets {
@@ -118,7 +120,13 @@ export const useNotesStore = defineStore("notes", () => {
function belongsHere(n: Note): boolean {
const v = view.value;
const inView =
v === "trash" ? n.trashed : v === "archived" ? !n.trashed && n.archived : !n.trashed && !n.archived;
v === "trash"
? n.trashed
: v === "archived"
? !n.trashed && n.archived
: v === "all"
? !n.trashed
: !n.trashed && !n.archived;
if (!inView) return false;
if (activeFacets.value.shared === "with_me" && (n.permission ?? "owner") === "owner") return false;
if (activeLabel.value) return n.labels.some((lb) => lb.id === activeLabel.value);
+14 -9
View File
@@ -53,20 +53,25 @@ async function openFromQuery(id: string) {
void router.replace({ query: q });
}
function viewForRoute(name: unknown): NoteView {
if (name === "archive") return "archived";
if (name === "trash") return "trash";
return "active"; // board + label views
}
const currentView = computed<NoteView>(() => viewForRoute(route.name));
const currentLabel = computed<string | null>(() => (route.name === "label" ? String(route.params.id) : null));
// Facet filters live in the URL query on the board route (a filtered board = a lens).
const facets = computed(() => facetsFromQuery(route.query));
const facetKey = computed(() => JSON.stringify(facetsToQuery(facets.value))); // stable; ignores ?open=
const filtered = computed(() => route.name === "board" && facetCount(facets.value) > 0);
// A search or a tag looks through the Archive as well as the board, so finished work
// can still be looked up; each archived card says so. Archive and Trash keep a search
// inside themselves.
function viewForRoute(name: unknown): NoteView {
if (name === "archive") return "archived";
if (name === "trash") return "trash";
if (name === "label") return "all";
const f = facets.value;
return name === "board" && (f.q || f.label?.length) ? "all" : "active";
}
const currentView = computed<NoteView>(() => viewForRoute(route.name));
const currentLabel = computed<string | null>(() => (route.name === "label" ? String(route.params.id) : null));
// Quick-add + pinned/others split only on the main board (not archive/trash/label).
const isMainBoard = computed(() => route.name === "board");
const pinnedNotes = computed(() => notes.items.filter((n) => n.pinned));