feat: F014 compare view — side-by-side decision table with AI summary
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { useState } from 'react'
|
||||
import { Box, Button, Card, Stack, Typography } from '@mui/material'
|
||||
import { Box, Button, Card, Typography } from '@mui/material'
|
||||
import { useNavigate } from 'react-router'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useUnifiedResults } from '../../hooks/useUnifiedResults'
|
||||
import { useCompareStore } from '../../stores/compareStore'
|
||||
import { needService } from '../../services/needService'
|
||||
import {
|
||||
FeedEmptyState,
|
||||
@@ -39,7 +38,6 @@ export default function Results() {
|
||||
queryKey: ['needs'],
|
||||
queryFn: () => needService.getAll(),
|
||||
})
|
||||
const { addToCompare, removeFromCompare, clearCompare, isInCompare, compareTray } = useCompareStore()
|
||||
|
||||
const activeNeed = needResp?.data?.[0]
|
||||
|
||||
@@ -52,11 +50,6 @@ export default function Results() {
|
||||
const externalCount = results.filter(r => r.resultType === 'EXTERNAL_MARKET').length
|
||||
const futureCount = results.filter(r => r.resultType === 'FUTURE_AVAILABILITY').length
|
||||
|
||||
const handleCompare = (propertyId: string) => {
|
||||
if (isInCompare(propertyId)) removeFromCompare(propertyId)
|
||||
else addToCompare(propertyId)
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<ResultFeedHeader
|
||||
@@ -103,51 +96,9 @@ export default function Results() {
|
||||
) : sorted.length === 0 ? (
|
||||
<FeedEmptyState filtered={filterSource !== 'ALL'} />
|
||||
) : (
|
||||
<UnifiedResultFeed results={sorted} isInCompare={isInCompare} onCompare={handleCompare} />
|
||||
<UnifiedResultFeed results={sorted} />
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{compareTray.length > 0 && (
|
||||
<Box
|
||||
sx={{
|
||||
position: 'fixed',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bgcolor: '#1e3a5f',
|
||||
color: 'white',
|
||||
py: 1.5,
|
||||
px: 3,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
zIndex: 1200,
|
||||
boxShadow: '0 -4px 12px rgba(0,0,0,0.15)',
|
||||
}}
|
||||
>
|
||||
<Typography variant="body2" sx={{ fontWeight: 600 }}>
|
||||
{compareTray.length} Objekte zum Vergleich ausgewählt
|
||||
</Typography>
|
||||
<Stack direction="row" spacing={1}>
|
||||
<Button
|
||||
size="small"
|
||||
variant="outlined"
|
||||
sx={{ color: 'white', borderColor: 'rgba(255,255,255,0.5)' }}
|
||||
onClick={clearCompare}
|
||||
>
|
||||
Leeren
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
variant="contained"
|
||||
sx={{ bgcolor: 'white', color: '#1e3a5f', '&:hover': { bgcolor: '#f1f5f9' } }}
|
||||
onClick={() => navigate('/demand/compare')}
|
||||
>
|
||||
Vergleich starten
|
||||
</Button>
|
||||
</Stack>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user