tasks-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev 9b0d0f7b9a93
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone f6f2112e77bc8c011e38c83a
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
src/lib/filter.ts
// Search and filters, shared by the board, list and calendar views.
import { dueState, parseIds, parseChecklist, type Card, type Label } from "../../functions/lib/tasks";

export type DueFilter = "overdue" | "today" | "week" | "none" | "done";
export interface Filter { q: string; labels: string[]; people: string[]; due: DueFilter[] }
export const NO_FILTER: Filter = { q: "", labels: [], people: [], due: [] };
export const NOBODY = "__nobody";

export const filterCount = (f: Filter) => (f.q.trim() ? 1 : 0) + f.labels.length + f.people.length + f.due.length;

export function matches(card: Card, f: Filter, labels: Label[]): boolean {
  if (f.labels.length) {
    const ids = parseIds(card.labels);
    if (!f.labels.some((l) => ids.includes(l))) return false;
  }
  if (f.people.length) {
    const ids = parseIds(card.assignees);
    if (!f.people.some((p) => (p === NOBODY ? ids.length === 0 : ids.includes(p)))) return false;
  }
  if (f.due.length) {
    const s = dueState(card.due, card.done);
    const ok = f.due.some((d) =>
      d === "overdue" ? s === "overdue"
        : d === "today" ? s === "today"
          : d === "week" ? s === "today" || s === "soon"
            : d === "none" ? s === "none"
              : s === "done");
    if (!ok) return false;
  }
  const q = f.q.trim().toLowerCase();
  if (q) {
    const ids = parseIds(card.labels);
    const hay = [card.title, card.description, ...parseChecklist(card.checklist).map((x) => x.text), ...labels.filter((l) => ids.includes(l.id)).map((l) => l.name)].join("\n").toLowerCase();
    if (!q.split(/\s+/).every((w) => hay.includes(w))) return false;
  }
  return true;
}

Change history

Point OpenApps links to openapps.free
9b0d0f7b9a · 18 hours ago
Bind agent address in policy
25f84633c0 · 19 hours ago
Use OpenApps service URLs and add contribution strip
07519eb348 · 19 hours ago
Bounded source sync
3296872001 · 1 day ago
Bounded source sync
ac8d2f5d18 · 1 day ago
Bounded source sync
2a5b08a001 · 1 day ago
Bounded source sync
d2242ddf34 · 1 day ago