feat: hide Matchability tab on Inserate detail drawer
PropertyDetailView gets hideTabs prop — MyListings passes ['Matchability'] since the Suchabo chip already covers the match/contact use case inline. Tab content now keys by name not index, so removal doesn't shift panels. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,11 +28,13 @@ import { PropertyMarketSignalsTab } from './PropertyMarketSignalsTab'
|
|||||||
interface PropertyDetailViewProps {
|
interface PropertyDetailViewProps {
|
||||||
propertyId: string
|
propertyId: string
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
|
hideTabs?: Array<'Matchability' | 'Marktsignale'>
|
||||||
}
|
}
|
||||||
|
|
||||||
const TABS = ['Übersicht', 'Matchability', 'Marktsignale'] as const
|
const ALL_TABS = ['Übersicht', 'Matchability', 'Marktsignale'] as const
|
||||||
|
|
||||||
export function PropertyDetailView({ propertyId, onClose }: PropertyDetailViewProps) {
|
export function PropertyDetailView({ propertyId, onClose, hideTabs = [] }: PropertyDetailViewProps) {
|
||||||
|
const TABS = ALL_TABS.filter(t => !hideTabs.includes(t as 'Matchability' | 'Marktsignale'))
|
||||||
const [tab, setTab] = useState(0)
|
const [tab, setTab] = useState(0)
|
||||||
const [editing, setEditing] = useState(false)
|
const [editing, setEditing] = useState(false)
|
||||||
const [draft, setDraft] = useState<UpdatePropertyInput>({})
|
const [draft, setDraft] = useState<UpdatePropertyInput>({})
|
||||||
@@ -175,8 +177,8 @@ export function PropertyDetailView({ propertyId, onClose }: PropertyDetailViewPr
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
{/* Tab content */}
|
{/* Tab content */}
|
||||||
<Box sx={{ flex: 1, overflowY: 'auto', p: tab === 0 ? 2.5 : 0 }}>
|
<Box sx={{ flex: 1, overflowY: 'auto', p: TABS[tab] === 'Übersicht' ? 2.5 : 0 }}>
|
||||||
{tab === 0 && (
|
{TABS[tab] === 'Übersicht' && (
|
||||||
<PropertyDetailOverview
|
<PropertyDetailOverview
|
||||||
p={property}
|
p={property}
|
||||||
editing={editing}
|
editing={editing}
|
||||||
@@ -184,8 +186,8 @@ export function PropertyDetailView({ propertyId, onClose }: PropertyDetailViewPr
|
|||||||
onDraftChange={setDraft}
|
onDraftChange={setDraft}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{tab === 1 && <MatchabilityTabPanel propertyId={propertyId} />}
|
{TABS[tab] === 'Matchability' && <MatchabilityTabPanel propertyId={propertyId} />}
|
||||||
{tab === 2 && <PropertyMarketSignalsTab propertyId={propertyId} />}
|
{TABS[tab] === 'Marktsignale' && <PropertyMarketSignalsTab propertyId={propertyId} />}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ export default function MyListings() {
|
|||||||
slotProps={{ paper: { sx: { width: { xs: '100%', sm: 560 } } } }}
|
slotProps={{ paper: { sx: { width: { xs: '100%', sm: 560 } } } }}
|
||||||
>
|
>
|
||||||
{detailId && (
|
{detailId && (
|
||||||
<PropertyDetailView propertyId={detailId} onClose={() => setDetailId(null)} />
|
<PropertyDetailView propertyId={detailId} onClose={() => setDetailId(null)} hideTabs={['Matchability']} />
|
||||||
)}
|
)}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user