Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions devboard/client/src/components/Task/TaskModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ const TaskModal = ({
await updateTask(task._id, { snippets: updatedSnippets });
};

const renderWithMentions = (text) =>
text.split(/(@\w+)/g).map((part, i) =>
part.startsWith("@") ? (
<span
key={i}
className="text-purple-300 bg-purple-950/50 border border-purple-800/50 rounded px-1 py-0.5"
>
{part}
</span>
) : (
<span key={i}>{part}</span>
)
);

useEffect(() => {
window.history.pushState(null, "", window.location.href);
const handlePop = () => {
Expand Down Expand Up @@ -192,6 +206,12 @@ const TaskModal = ({
? "s"
: ""}
</p>
{/* Live preview with @username mentions highlighted */}
{form.description.trim() && (
<p className="text-xs text-[#a0a0a5] mt-1.5 whitespace-pre-wrap break-words">
{renderWithMentions(form.description)}
</p>
)}

{aiError && (
<p className="text-xs text-red-400 mt-1">{aiError}</p>
Expand Down