Skip to content

Commit 876749f

Browse files
committed
ally: improved accessibility
1 parent 559ba8c commit 876749f

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

Frontend/src/components/collaboration-hub/ConnectModal.tsx

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,25 @@ const ConnectModal: React.FC<ConnectModalProps> = ({ open, onClose, onSend, matc
2626
if (!open) return null;
2727
const profile = mockProfileDetails;
2828
const totalIdeas = mockCollabIdeas.length;
29+
if (totalIdeas === 0) {
30+
return (
31+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-20">
32+
<div className="bg-white rounded-2xl shadow-xl w-auto min-w-[320px] max-w-full mx-2 p-0 sm:p-0 relative flex flex-col sm:flex-row overflow-hidden"
33+
role="dialog"
34+
aria-modal="true"
35+
aria-labelledby="connect-modal-title">
36+
<button className="absolute top-4 right-4 text-gray-400 hover:text-gray-700 z-10" onClick={onClose} aria-label="Close">×</button>
37+
<div className="flex flex-col items-center justify-center p-8 w-full">
38+
<h2 id="connect-modal-title" className="text-xl font-bold text-gray-900 mb-2">No Collaboration Ideas</h2>
39+
<p className="text-gray-600 mb-4">There are currently no AI-generated collaboration ideas available.</p>
40+
<Button onClick={onClose}>Close</Button>
41+
</div>
42+
</div>
43+
</div>
44+
);
45+
}
2946
const startIdx = (ideasPage * IDEAS_PER_PAGE) % totalIdeas;
30-
const ideasToShow = Array.from({ length: IDEAS_PER_PAGE }, (_, i) => mockCollabIdeas[(startIdx + i) % totalIdeas]);
47+
const ideasToShow = Array.from({ length: Math.min(totalIdeas, IDEAS_PER_PAGE) }, (_, i) => mockCollabIdeas[(startIdx + i) % totalIdeas]);
3148

3249
const handleNextIdeas = () => {
3350
setIdeasPage((prev) => prev + 1);
@@ -72,12 +89,16 @@ const ConnectModal: React.FC<ConnectModalProps> = ({ open, onClose, onSend, matc
7289
<div className="mb-4">
7390
<div className="font-semibold text-sm mb-2">AI-Generated Collaboration Ideas</div>
7491
<ul className="space-y-2">
75-
{ideasToShow.map((idea, idx) => (
76-
<li key={idx} className="bg-gray-50 rounded-lg p-3 border border-gray-100">
77-
<div className="font-semibold text-gray-800">{idea.title}</div>
78-
<div className="text-xs text-gray-600">{idea.description}</div>
79-
</li>
80-
))}
92+
{ideasToShow.length === 0 ? (
93+
<li className="text-gray-500 text-sm">No collaboration ideas available.</li>
94+
) : (
95+
ideasToShow.map((idea, idx) => (
96+
<li key={idx} className="bg-gray-50 rounded-lg p-3 border border-gray-100">
97+
<div className="font-semibold text-gray-800">{idea.title}</div>
98+
<div className="text-xs text-gray-600">{idea.description}</div>
99+
</li>
100+
))
101+
)}
81102
</ul>
82103
{totalIdeas > IDEAS_PER_PAGE && (
83104
<div className="flex justify-center mt-3">

0 commit comments

Comments
 (0)