diff --git a/web-app/src/components/SuggestionCard.tsx b/web-app/src/components/SuggestionCard.tsx index 4a0d8a4..d6c4d34 100644 --- a/web-app/src/components/SuggestionCard.tsx +++ b/web-app/src/components/SuggestionCard.tsx @@ -1,5 +1,4 @@ import React from "react"; -import { InformationCircleIcon } from "@heroicons/react/24/outline"; import { ReactTags } from "react-tag-autocomplete"; import { DocumentSuggestion, TagOption } from "../DocumentProcessor"; @@ -17,41 +16,74 @@ const SuggestionCard: React.FC = ({ onTitleChange, onTagAddition, onTagDeletion, -}) => ( -
-
-

- {suggestion.original_document.title} -

- +}) => { + const document = suggestion.original_document; + return ( +
+
+
+

+ {document.title} +

+

+ {document.content.length > 40 + ? `${document.content.substring(0, 40)}...` + : document.content} +

+
+ {document.tags.map((tag) => ( + + {tag} + + ))} +
+
+
+
+

{document.content}

+
+
+
+
+ onTitleChange(suggestion.id, e.target.value)} + className="w-full border border-gray-300 rounded px-2 py-1 mt-2 focus:outline-none focus:ring-2 focus:ring-blue-500" + /> +
+ ({ + id: index.toString(), + name: tag, + label: tag, + value: index.toString(), + })) || [] + } + suggestions={availableTags.map((tag) => ({ + id: tag.id, + name: tag.name, + label: tag.name, + value: tag.id, + }))} + onAdd={(tag) => + onTagAddition(suggestion.id, { + id: String(tag.label), + name: String(tag.value), + }) + } + onDelete={(index) => onTagDeletion(suggestion.id, index)} + allowNew={true} + placeholderText="Add a tag" + /> +
+
- onTitleChange(suggestion.id, e.target.value)} - className="w-full border border-gray-300 rounded px-2 py-1 mt-2 focus:outline-none focus:ring-2 focus:ring-blue-500" - /> -
- ({ - id: index.toString(), - name: tag, - label: tag, - value: index.toString(), - })) || [] - } - suggestions={availableTags.map(tag => ({ id: tag.id, name: tag.name, label: tag.name, value: tag.id }))} - onAdd={(tag) => onTagAddition(suggestion.id, { id: String(tag.label), name: String(tag.value) })} - onDelete={(index) => onTagDeletion(suggestion.id, index)} - allowNew={true} - placeholderText="Add a tag" - /> -
-
-); + ); +}; export default SuggestionCard; \ No newline at end of file