diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..4d86f8d --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,4 @@ +## 2024-05-30 - Loading States on Async Buttons + +**Learning:** Providing immediate visual feedback during asynchronous actions is crucial for a smooth user experience. Without it, users may think the system is unresponsive. Adding a loading spinner (`Loader2` from `lucide-react`) and changing the text (e.g., from "Post" to "Posting...") provides clear confirmation that the action is being processed. Furthermore, toggling the `aria-busy` attribute correctly announces this temporary loading state to assistive technologies without altering visual presentation. +**Action:** Always implement a visual loading state (like a spinner) and set `aria-busy="true"` on buttons that trigger asynchronous operations, ensuring screen readers and visual users alike are informed of the system status. diff --git a/src/components/CommentsPanel.tsx b/src/components/CommentsPanel.tsx index 2a59588..5f2b6d9 100644 --- a/src/components/CommentsPanel.tsx +++ b/src/components/CommentsPanel.tsx @@ -1,6 +1,7 @@ 'use client' import { useEffect, useState } from 'react' +import { Loader2 } from 'lucide-react' import type { CommentRecord } from '@/lib/db/types' type Props = { entityType: 'event' | 'insight'; entityId: string } @@ -62,9 +63,11 @@ export default function CommentsPanel({ entityType, entityId }: Props) {