feat: anonymous pre-market release per unit

Add anonymous flag to schattenmarktRelease on PropertyUnit and Property.
When a unit is enabled in the pre-market panel, an Anonym toggle appears
inline — hides address and property name in the matching feed, showing
only area, type and region to prospective tenants.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-06-10 22:58:02 +02:00
parent ee229f8f4f
commit e64ae15d17
4 changed files with 72 additions and 17 deletions
+6 -5
View File
@@ -9,19 +9,20 @@ import { useToastStore } from '../../stores/toastStore'
import { DS_BORDER, DS_PRE_MARKET, DS_SURFACE, DS_TEXT } from '../../lib/ds'
import { SectionTitle } from './PropertyDetailHelpers'
import { PreMarketDemandIntelligence } from './PreMarketDemandIntelligence'
import { PreMarketUnitGrid } from './PreMarketUnitGrid'
import { PreMarketUnitGrid, type UnitReleaseState } from './PreMarketUnitGrid'
export const MOCK_TODAY = new Date('2026-05-20')
export function PreMarketPanel({ p }: { p: Property }) {
const [enabled, setEnabled] = useState(p.schattenmarktRelease?.enabled ?? false)
const [leadTimeMonths, setLeadTimeMonths] = useState(p.schattenmarktRelease?.leadTimeMonths ?? 6)
const [unitStates, setUnitStates] = useState<Record<string, { enabled: boolean; availableFrom: string }>>(() => {
const init: Record<string, { enabled: boolean; availableFrom: string }> = {}
const [unitStates, setUnitStates] = useState<Record<string, UnitReleaseState>>(() => {
const init: Record<string, UnitReleaseState> = {}
for (const u of p.units ?? []) {
init[u.id] = {
enabled: u.schattenmarktRelease?.enabled ?? false,
availableFrom: u.schattenmarktRelease?.availableFrom ?? u.leaseEndDate ?? '',
anonymous: u.schattenmarktRelease?.anonymous ?? false,
}
}
return init
@@ -80,11 +81,11 @@ export function PreMarketPanel({ p }: { p: Property }) {
if (enabled) save(enabled, months)
}
async function saveUnit(unitId: string, nextEnabled: boolean, nextDate: string) {
async function saveUnit(unitId: string, nextEnabled: boolean, nextDate: string, nextAnonymous: boolean) {
setUnitSaving(prev => ({ ...prev, [unitId]: true }))
try {
await MockupUnitProvider.update(unitId, {
schattenmarktRelease: { enabled: nextEnabled, availableFrom: nextDate || undefined },
schattenmarktRelease: { enabled: nextEnabled, availableFrom: nextDate || undefined, anonymous: nextAnonymous },
})
await queryClient.invalidateQueries({ queryKey: ['property', p.id] })
await queryClient.invalidateQueries({ queryKey: ['properties'] })