feat(documents): pick documents from Paperless-ngx or Papra in the vault and wherever documents are linked

A settings card under Integrations connects either system and tests it
before saving. An import button beside Upload in Documents, on a
condition's documents card, and beside Add in the visit and vaccination
document pickers opens a sheet that searches by name with tag and date
filters, shows what HealthLog already holds, and imports the ticked
documents one at a time with a result per row. The buttons appear only
for a person in their own record with a connection; strings in all
seven languages.
This commit is contained in:
Marc-André Bombeck committed 2026-09-26 13:26:18 +02:00
1 parent 92f2cc729f
commit d109d67889
21 files changed
+2200 -20

No files matched your search

+27 -13
View File
@@ -31,7 +31,7 @@
* carries the option's date, so two doses of one vaccine read as two
* different records.
*/
import { useMemo, useState } from "react";
import { useMemo, useState, type ReactNode } from "react";
import Link from "next/link";
import { Check, Plus, Search, X } from "lucide-react";
import type { LucideIcon } from "lucide-react";
@@ -164,6 +164,7 @@ export function EntityLinkPicker({
error = false,
errorLabel,
onRetry,
extraAction,
}: {
icon: LucideIcon;
title: string;
@@ -183,6 +184,13 @@ export function EntityLinkPicker({
error?: boolean;
errorLabel?: string;
onRetry?: () => void;
/**
* A second way to add, beside the add button: the documents pickers put
* "Import from Paperless-ngx / Papra" here. Shown even when there is
* nothing to link yet, because an empty vault is exactly when importing is
* the way forward. The element renders nothing when it has nothing to offer.
*/
extraAction?: ReactNode;
}) {
const { t } = useTranslations();
const [open, setOpen] = useState(false);
@@ -238,7 +246,10 @@ export function EntityLinkPicker({
slot={`${slot}-error`}
/>
) : options.length === 0 ? (
<p className="text-muted-foreground text-xs">{emptyLabel}</p>
<div className="space-y-2">
<p className="text-muted-foreground text-xs">{emptyLabel}</p>
{extraAction}
</div>
) : (
<div className="space-y-2">
{selectedChips.length > 0 ? (
@@ -312,17 +323,20 @@ export function EntityLinkPicker({
</p>
) : null}
<Button
type="button"
variant="outline"
size="sm"
className="min-h-9"
data-slot={`${slot}-add`}
onClick={() => setOpen(true)}
>
<Plus className="size-4" aria-hidden />
{t("links.picker.add")}
</Button>
<div className="flex flex-wrap items-center gap-2">
<Button
type="button"
variant="outline"
size="sm"
className="min-h-9"
data-slot={`${slot}-add`}
onClick={() => setOpen(true)}
>
<Plus className="size-4" aria-hidden />
{t("links.picker.add")}
</Button>
{extraAction}
</div>
</div>
)}