From 5ca7dc96781878d5fc30499008322ae92f0d0e84 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Fri, 31 Oct 2025 00:38:52 +0100 Subject: [PATCH] cleanup --- frontend/src/documents/DocumentsTable.jsx | 135 ++++++++++++---------- frontend/src/styles.css | 49 ++++---- 2 files changed, 98 insertions(+), 86 deletions(-) diff --git a/frontend/src/documents/DocumentsTable.jsx b/frontend/src/documents/DocumentsTable.jsx index 6098180..7743b2f 100644 --- a/frontend/src/documents/DocumentsTable.jsx +++ b/frontend/src/documents/DocumentsTable.jsx @@ -665,6 +665,36 @@ const DocumentsTable = ({ const cardClasses = ['document-card', 'document']; if (isSelected) cardClasses.push('selected'); if (isDraggingDoc) cardClasses.push('is-dragging'); + const titleText = doc.title || doc.original_name; + const documentTypeNode = documentType + ? ( + { + event.stopPropagation(); + if (canToggleDocumentType) { + onDocumentTypeClick?.(documentType.id, documentType); + } + }} + onKeyDown={(event) => { + if (event.key === 'Enter' || event.key === ' ') { + event.preventDefault(); + event.stopPropagation(); + if (canToggleDocumentType) { + onDocumentTypeClick?.(documentType.id, documentType); + } + } + }} + > + ({documentType.name}) + + ) + : null; + return (
- {documentType ? ( - { - event.stopPropagation(); - if (canToggleDocumentType) { - onDocumentTypeClick?.(documentType.id, documentType); - } - }} - onKeyDown={(event) => { - if (event.key === 'Enter' || event.key === ' ') { - event.preventDefault(); - event.stopPropagation(); - if (canToggleDocumentType) { - onDocumentTypeClick?.(documentType.id, documentType); - } - } - }} - > - {documentType.name} - - ) : null} {correspondents.length > 0 ? ( {renderCorrespondentLinks(correspondents)} ) : null} - {doc.title || doc.original_name} + {titleText} + {documentTypeNode ? ( + <> + {' '} + {documentTypeNode} + + ) : null}
{visibleTags.length > 0 && (
@@ -917,6 +927,35 @@ const DocumentsTable = ({ const documentType = resolveDocumentType(doc); const isRowDocumentTypeActive = documentType?.id != null && activeDocumentTypeIdSet.has(documentType.id); const canToggleRowDocumentType = documentType?.id != null && typeof onDocumentTypeClick === 'function'; + const titleText = doc.title || doc.original_name; + const documentTypeNode = documentType + ? ( + { + event.stopPropagation(); + if (canToggleRowDocumentType) { + onDocumentTypeClick?.(documentType.id, documentType); + } + }} + onKeyDown={(event) => { + if (event.key === 'Enter' || event.key === ' ') { + event.preventDefault(); + event.stopPropagation(); + if (canToggleRowDocumentType) { + onDocumentTypeClick?.(documentType.id, documentType); + } + } + }} + > + ({documentType.name}) + + ) + : null; return ( @@ -946,38 +985,18 @@ const DocumentsTable = ({
- {documentType ? ( - { - event.stopPropagation(); - if (canToggleRowDocumentType) { - onDocumentTypeClick?.(documentType.id, documentType); - } - }} - onKeyDown={(event) => { - if (event.key === 'Enter' || event.key === ' ') { - event.preventDefault(); - event.stopPropagation(); - if (canToggleRowDocumentType) { - onDocumentTypeClick?.(documentType.id, documentType); - } - } - }} - > - {documentType.name} - - ) : null} {correspondents.length > 0 ? ( {renderCorrespondentLinks(correspondents)} ) : null} - {doc.title || doc.original_name} + {titleText} + {documentTypeNode ? ( + <> + {' '} + {documentTypeNode} + + ) : null}
{(doc.tags || []).length > 0 && ( @@ -1058,7 +1077,7 @@ const DocumentsTable = ({ type="button" className="icon-button" title="Rename" - aria-label={`Rename document ${doc.title || doc.original_name}`} + aria-label={`Rename document ${titleText}`} onClick={(event) => { event.stopPropagation(); const nextName = window.prompt( diff --git a/frontend/src/styles.css b/frontend/src/styles.css index 1c0c906..9e33b5f 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -2012,43 +2012,36 @@ button.danger:hover:not([disabled]) { color: inherit; } -.doc-type-label { - display: inline-flex; - align-items: center; - padding: 0.05rem 0.4rem; - margin-right: 0.35rem; - border-radius: 999px; - background: var(--surface-subtle); +.doc-name__primary { + font-weight: 600; +} + +.doc-type-inline { color: var(--muted); - font-size: 0.75rem; + font-size: 0.85em; line-height: 1.2; cursor: default; - gap: 0.25rem; } -.doc-type-label[role='button'] { - cursor: pointer; - color: var(--accent); - background: color-mix(in oklch, var(--accent) 12%, transparent); -} - -.doc-type-label[role='button']:hover, -.doc-type-label[role='button']:focus-visible { - color: var(--accent-strong, var(--accent)); - background: color-mix(in oklch, var(--accent) 20%, transparent); -} - -.doc-type-label[role='button']:focus-visible { - outline: 2px solid currentColor; - outline-offset: 2px; -} - -.doc-type-label.active { - background: color-mix(in oklch, var(--accent) 28%, transparent); +.doc-type-inline.active { color: var(--accent-strong, var(--accent)); font-weight: 600; } +.doc-type-inline[role='button'] { + cursor: pointer; +} + +.doc-type-inline[role='button']:hover, +.doc-type-inline[role='button']:focus-visible { + color: var(--accent-strong, var(--accent)); +} + +.doc-type-inline[role='button']:focus-visible { + outline: 2px solid currentColor; + outline-offset: 2px; +} + .doc-correspondent-link { background: none; background-color: transparent;