feat(editor): cite references from the finding edit form only

This commit is contained in:
bchanot committed 2026-11-14 14:11:13 +01:00
1 parent afc1051313
commit f0e49fd447
16 files changed
+519 -395

No files matched your search

@@ -20,15 +20,14 @@ export interface TileHandlers {
goTo: (key: ElementKey) => void
}
/** What a tile of the citations panel adds: the finding it belongs to and « Retirer ». */
/** What a tile of the citations panel adds: the finding it belongs to. */
export interface PanelTile {
current: ElementKey
onRemove: () => void
}
export interface TileProps {
host: ReferenceHost
/** Set for the citations panel: « ce constat » marks, « Retirer de ce constat ». */
/** Set for the citations panel: « ce constat » marks. */
panel?: PanelTile
reference: Reference
/** Position in the whole bibliography, not in a filtered list. */
@@ -99,34 +98,18 @@ function TileHeader({ base, props }: { base: string; props: TileProps }) {
)
}
/** The panel's actions (P7): « Modifier » and « Retirer de ce constat », nothing else. */
function PanelActions({
props,
panel,
}: {
props: TileProps
panel: PanelTile
}) {
/** The panel's one action (P7): « Modifier ». Removing a citation is the edit form's. */
function PanelActions({ props }: { props: TileProps }) {
const t = useT()
return (
<div className="flex flex-wrap items-center gap-2">
<ActionButton
readOnly={false}
variant="secondary"
size="sm"
onClick={(event) => props.on.edit(event.currentTarget)}
>
{t('editor.references.edit')}
</ActionButton>
<ActionButton
readOnly={false}
variant="secondary"
size="sm"
onClick={panel.onRemove}
>
{t('editor.references.remove_citation')}
</ActionButton>
</div>
<ActionButton
readOnly={false}
variant="secondary"
size="sm"
onClick={(event) => props.on.edit(event.currentTarget)}
>
{t('editor.references.edit')}
</ActionButton>
)
}
@@ -135,7 +118,7 @@ function TileActions({ props }: { props: TileProps }) {
const t = useT()
const { position, count, citers, readOnly, movable, on } = props
if (readOnly) return null
if (props.panel) return <PanelActions props={props} panel={props.panel} />
if (props.panel) return <PanelActions props={props} />
return (
<>
<div className="flex flex-wrap items-center gap-2">