-
- {problem.narrative}
-
- {linkedConsultations.length > 0 && (
-
-
- Linked Consultations:
-
-
- {linkedConsultations.map((consultation) => (
-
- ))}
+
+ {isExpanded && (
+
+
+
+ {problem.narrative}
+ {linkedConsultations.length > 0 && (
+
+
+ Linked Consultations:
+
+
+ {linkedConsultations.map((consultation) => (
+
+ ))}
+
+
+ )}
- )}
-
- )}
+
+ )}
+
)
}
@@ -248,21 +264,36 @@ function MobileProblemCard({
export function ProblemsView({ onNavigate }: ProblemsViewProps) {
const [expandedId, setExpandedId] = useState
(null)
const { isMobile } = useBreakpoint()
+ const { setExpandedItem } = useAccessibility()
const activeProblems = problems.filter(
(p) => p.status === 'Active' || p.status === 'In Progress'
)
const resolvedProblems = problems.filter((p) => p.status === 'Resolved')
- const handleToggle = (id: string) => {
- setExpandedId(expandedId === id ? null : id)
- }
+ const handleToggle = useCallback(
+ (id: string) => {
+ const newExpandedId = expandedId === id ? null : id
+ setExpandedId(newExpandedId)
+
+ // Update breadcrumb context - pass the problem description as the expanded item ID
+ if (newExpandedId) {
+ const problem = problems.find((p) => p.id === newExpandedId)
+ if (problem) {
+ setExpandedItem(problem.description)
+ }
+ } else {
+ setExpandedItem(null)
+ }
+ },
+ [expandedId, setExpandedItem]
+ )
return (
-
+
-
+
Active Problems
@@ -285,31 +316,31 @@ export function ProblemsView({ onNavigate }: ProblemsViewProps) {
|
Status
|
Code
|
Problem
|
Since
|
Expand
|
@@ -330,13 +361,13 @@ export function ProblemsView({ onNavigate }: ProblemsViewProps) {
)}
{activeProblems.length === 0 && (
- No active problems
+ No active problems
)}
-
+
-
+
Resolved Problems
@@ -359,37 +390,37 @@ export function ProblemsView({ onNavigate }: ProblemsViewProps) {
|
Status
|
Code
|
Problem
|
Resolved
|
Outcome
|
Expand
|
@@ -410,7 +441,7 @@ export function ProblemsView({ onNavigate }: ProblemsViewProps) {
)}
{resolvedProblems.length === 0 && (
- No resolved problems
+ No resolved problems
)}