refactor: replace split-panel with overlay Drawer on Properties and FutureAvailability
650px right Drawer overlays the list instead of compressing it — full list always visible, detail panel has adequate space. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useState } from 'react'
|
||||
import { Box, Chip, Paper, Typography } from '@mui/material'
|
||||
import { Box, Chip, Drawer, Typography } from '@mui/material'
|
||||
import { useFutureSignals } from '../../hooks/useFutureSignals'
|
||||
import {
|
||||
FutureSignalCard,
|
||||
@@ -94,50 +94,44 @@ export default function FutureAvailability() {
|
||||
filteredCount={filtered.length}
|
||||
/>
|
||||
|
||||
{/* Body */}
|
||||
<Box sx={{ flex: 1, display: 'flex', overflow: 'hidden' }}>
|
||||
{/* Signal list */}
|
||||
<Box sx={{ flex: 1, overflowY: 'auto', bgcolor: '#f8fafc' }}>
|
||||
{isLoading ? (
|
||||
<Box sx={{ p: 3 }}>
|
||||
{[0, 1, 2, 3].map(i => (
|
||||
<Box key={i} sx={{ p: 2, mb: 1, bgcolor: 'white', borderRadius: 1, height: 120 }} />
|
||||
))}
|
||||
</Box>
|
||||
) : filtered.length === 0 ? (
|
||||
<FutureSignalEmptyState context={signals.length === 0 ? 'no-signals' : 'filtered-empty'} />
|
||||
) : (
|
||||
<Box sx={{ bgcolor: 'white', borderRight: '1px solid #e2e8f0' }}>
|
||||
{filtered.map(signal => (
|
||||
<FutureSignalCard
|
||||
key={signal.id}
|
||||
signal={signal}
|
||||
isSelected={selectedSignal?.id === signal.id}
|
||||
onSelect={handleSelect}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{/* Detail panel */}
|
||||
{selectedSignal && (
|
||||
<Paper elevation={0} sx={{
|
||||
width: 360,
|
||||
flexShrink: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
borderRadius: 0,
|
||||
borderLeft: '1px solid #e2e8f0',
|
||||
overflow: 'hidden',
|
||||
}}>
|
||||
<FutureSignalDetailPanel
|
||||
signal={selectedSignal}
|
||||
onClose={() => setSelectedSignal(null)}
|
||||
/>
|
||||
</Paper>
|
||||
{/* Signal list — always full width */}
|
||||
<Box sx={{ flex: 1, overflowY: 'auto', bgcolor: '#f8fafc' }}>
|
||||
{isLoading ? (
|
||||
<Box sx={{ p: 3 }}>
|
||||
{[0, 1, 2, 3].map(i => (
|
||||
<Box key={i} sx={{ p: 2, mb: 1, bgcolor: 'white', borderRadius: 1, height: 120 }} />
|
||||
))}
|
||||
</Box>
|
||||
) : filtered.length === 0 ? (
|
||||
<FutureSignalEmptyState context={signals.length === 0 ? 'no-signals' : 'filtered-empty'} />
|
||||
) : (
|
||||
<Box sx={{ bgcolor: 'white' }}>
|
||||
{filtered.map(signal => (
|
||||
<FutureSignalCard
|
||||
key={signal.id}
|
||||
signal={signal}
|
||||
isSelected={selectedSignal?.id === signal.id}
|
||||
onSelect={handleSelect}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{/* Detail drawer */}
|
||||
<Drawer
|
||||
anchor="right"
|
||||
open={!!selectedSignal}
|
||||
onClose={() => setSelectedSignal(null)}
|
||||
slotProps={{ paper: { sx: { width: 650, boxShadow: '-4px 0 24px rgba(0,0,0,0.10)' } } }}
|
||||
>
|
||||
{selectedSignal && (
|
||||
<FutureSignalDetailPanel
|
||||
signal={selectedSignal}
|
||||
onClose={() => setSelectedSignal(null)}
|
||||
/>
|
||||
)}
|
||||
</Drawer>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from 'react'
|
||||
import { Box } from '@mui/material'
|
||||
import { Box, Drawer } from '@mui/material'
|
||||
import { PageHeader } from '../../components/layout'
|
||||
import { useProperties } from '../../hooks/useProperties'
|
||||
import { PropertyFilterBar, PropertyTable, PropertyDetailView } from '../../components/supply'
|
||||
@@ -59,36 +59,28 @@ export default function Properties() {
|
||||
/>
|
||||
<PropertyFilterBar filters={filters} onFiltersChange={setFilters} />
|
||||
|
||||
<Box sx={{ display: 'flex', flex: 1, overflow: 'hidden' }}>
|
||||
{/* Table */}
|
||||
<Box sx={{ flex: 1, overflowY: 'auto' }}>
|
||||
<PropertyTable
|
||||
properties={filtered}
|
||||
isLoading={isLoading}
|
||||
isError={isError}
|
||||
selectedId={selectedId}
|
||||
onSelect={setSelectedId}
|
||||
filters={filters}
|
||||
onFiltersChange={setFilters}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Detail panel */}
|
||||
{selectedId && (
|
||||
<Box
|
||||
sx={{
|
||||
width: 480,
|
||||
flexShrink: 0,
|
||||
borderLeft: '1px solid #e2e8f0',
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
<PropertyDetailView propertyId={selectedId} onClose={() => setSelectedId(null)} />
|
||||
</Box>
|
||||
)}
|
||||
<Box sx={{ flex: 1, overflowY: 'auto' }}>
|
||||
<PropertyTable
|
||||
properties={filtered}
|
||||
isLoading={isLoading}
|
||||
isError={isError}
|
||||
selectedId={selectedId}
|
||||
onSelect={setSelectedId}
|
||||
filters={filters}
|
||||
onFiltersChange={setFilters}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Drawer
|
||||
anchor="right"
|
||||
open={!!selectedId}
|
||||
onClose={() => setSelectedId(null)}
|
||||
slotProps={{ paper: { sx: { width: 650, boxShadow: '-4px 0 24px rgba(0,0,0,0.10)' } } }}
|
||||
>
|
||||
{selectedId && (
|
||||
<PropertyDetailView propertyId={selectedId} onClose={() => setSelectedId(null)} />
|
||||
)}
|
||||
</Drawer>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user