feat: anonymes Suchprofil — Toggle im Speichern-Schritt, supply-side Masking
- Toggle 'Anonymes Suchprofil' im AISearchSavePreview (nicht in Suchmaske) - Box wechselt zu lila wenn aktiv, Text erklärt was anonymisiert wird - isAnonymous wird via buildNeedInput in gespeichertes Need geschrieben - MatchListCard + NeedSelectionPanel: zeigen 'Anonyme Anfrage' (lila) statt Firmenname Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Alert, Box, Button, CircularProgress } from '@mui/material'
|
||||
import { Alert, Box, Button, CircularProgress, FormControlLabel, Switch, Typography } from '@mui/material'
|
||||
import { Save } from 'lucide-react'
|
||||
import { NeedCardPreview } from './NeedCardPreview'
|
||||
import type { ParseNeedResult, ParsedNeedCriteria, WeightingKey } from '../../domain/needBuilder'
|
||||
@@ -10,7 +10,9 @@ interface Props {
|
||||
needTitle: string
|
||||
overallConfidence: number
|
||||
isSaving: boolean
|
||||
isAnonymous: boolean
|
||||
onNeedTitleChange: (t: string) => void
|
||||
onAnonymousChange: (v: boolean) => void
|
||||
onBack: () => void
|
||||
onSave: () => void
|
||||
}
|
||||
@@ -22,7 +24,9 @@ export function AISearchSavePreview({
|
||||
needTitle,
|
||||
overallConfidence,
|
||||
isSaving,
|
||||
isAnonymous,
|
||||
onNeedTitleChange,
|
||||
onAnonymousChange,
|
||||
onBack,
|
||||
onSave,
|
||||
}: Props) {
|
||||
@@ -39,7 +43,41 @@ export function AISearchSavePreview({
|
||||
needTitle={needTitle}
|
||||
onNeedTitleChange={onNeedTitleChange}
|
||||
/>
|
||||
<Box sx={{ maxWidth: 720, mx: 'auto', display: 'flex', justifyContent: 'space-between', mt: 3 }}>
|
||||
|
||||
{/* Anonymity option */}
|
||||
<Box sx={{
|
||||
maxWidth: 720, mx: 'auto', mt: 2,
|
||||
p: 1.5, borderRadius: 1.5, border: '1px solid',
|
||||
borderColor: isAnonymous ? '#7c3aed' : '#e2e8f0',
|
||||
bgcolor: isAnonymous ? '#f5f3ff' : '#f8fafc',
|
||||
transition: 'all 0.15s',
|
||||
}}>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
size="small"
|
||||
checked={isAnonymous}
|
||||
onChange={e => onAnonymousChange(e.target.checked)}
|
||||
sx={{
|
||||
'& .MuiSwitch-switchBase.Mui-checked': { color: '#7c3aed' },
|
||||
'& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track': { bgcolor: '#7c3aed' },
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<Box>
|
||||
<Typography variant="body2" sx={{ fontWeight: 700, color: isAnonymous ? '#6d28d9' : 'text.primary' }}>
|
||||
Anonymes Suchprofil
|
||||
</Typography>
|
||||
<Typography variant="caption" sx={{ color: isAnonymous ? '#7c3aed' : 'text.secondary' }}>
|
||||
Firmenname wird nicht an Vermieter übermittelt — Verwalter sehen nur Branche und Flächenbedarf
|
||||
</Typography>
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box sx={{ maxWidth: 720, mx: 'auto', display: 'flex', justifyContent: 'space-between', mt: 2 }}>
|
||||
<Button variant="outlined" onClick={onBack} disabled={isSaving}>
|
||||
← Zurück
|
||||
</Button>
|
||||
|
||||
@@ -112,6 +112,7 @@ export function NeedExtendedRequirements({ criteria: c, onChange: set }: Props)
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
)
|
||||
|
||||
@@ -70,9 +70,12 @@ export function MatchListCard({ match, property, need, onSelect, onApprove }: Pr
|
||||
<Box sx={{ display: 'flex', gap: 0.75, mt: 0.5, flexWrap: 'wrap' }}>
|
||||
{need && (
|
||||
<Chip
|
||||
label={need.companyName}
|
||||
label={need.isAnonymous ? 'Anonyme Anfrage' : need.companyName}
|
||||
size="small"
|
||||
sx={{ bgcolor: '#eff6ff', color: '#1e3a5f', fontSize: 11, height: 20, fontWeight: 500 }}
|
||||
sx={need.isAnonymous
|
||||
? { bgcolor: '#f5f3ff', color: '#6d28d9', fontSize: 11, height: 20, fontWeight: 600, border: '1px solid #ddd6fe' }
|
||||
: { bgcolor: '#eff6ff', color: '#1e3a5f', fontSize: 11, height: 20, fontWeight: 500 }
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<Chip
|
||||
|
||||
@@ -32,9 +32,14 @@ export function NeedSelectionPanel({ matches }: Props) {
|
||||
}}
|
||||
>
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', mb: 0.5 }}>
|
||||
<Typography variant="body2" sx={{ fontWeight: 600, lineHeight: 1.3, flex: 1, mr: 0.5 }}>
|
||||
{need.companyName}
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.75, flex: 1, mr: 0.5, minWidth: 0 }}>
|
||||
<Typography variant="body2" sx={{ fontWeight: 600, lineHeight: 1.3 }} noWrap>
|
||||
{need.isAnonymous ? 'Anonyme Anfrage' : need.companyName}
|
||||
</Typography>
|
||||
{need.isAnonymous && (
|
||||
<Chip label="Anonym" size="small" sx={{ bgcolor: '#f5f3ff', color: '#6d28d9', fontSize: 9, height: 16, fontWeight: 700, flexShrink: 0, border: '1px solid #ddd6fe' }} />
|
||||
)}
|
||||
</Box>
|
||||
{pendingCount > 0 && (
|
||||
<Chip label={pendingCount} size="small"
|
||||
sx={{ bgcolor: '#d97706', color: 'white', fontSize: 10, height: 18, minWidth: 22 }} />
|
||||
|
||||
@@ -38,6 +38,7 @@ export default function AISearch() {
|
||||
const [weights, setWeights] = useState<Record<WeightingKey, number>>(defaultWeights)
|
||||
const [weightingKey, setWeightingKey] = useState(0)
|
||||
const [needTitle, setNeedTitle] = useState('')
|
||||
const [isAnonymous, setIsAnonymous] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
const isManualTextRef = useRef(false)
|
||||
@@ -165,7 +166,7 @@ export default function AISearch() {
|
||||
setStep(NeedBuilderStep.SAVING)
|
||||
const entries = Object.entries(parseResult.confidenceByField)
|
||||
const conf = entries.length > 0 ? entries.reduce((s, [, v]) => s + v, 0) / entries.length : 0
|
||||
const input = buildNeedInput(editedCriteria, weights, needTitle, conf, 'ACTIVE')
|
||||
const input = buildNeedInput({ ...editedCriteria, isAnonymous: isAnonymous || undefined }, weights, needTitle, conf, 'ACTIVE')
|
||||
createNeedMutation.mutate(input, {
|
||||
onSuccess: (created) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['matches'] })
|
||||
@@ -253,7 +254,9 @@ export default function AISearch() {
|
||||
needTitle={needTitle}
|
||||
overallConfidence={overallConfidence}
|
||||
isSaving={step === NeedBuilderStep.SAVING}
|
||||
isAnonymous={isAnonymous}
|
||||
onNeedTitleChange={setNeedTitle}
|
||||
onAnonymousChange={setIsAnonymous}
|
||||
onBack={() => setStep(NeedBuilderStep.IDLE)}
|
||||
onSave={handleSaveProfile}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user