feat(site-finder): weight profile panel + analyze options (#114 sub-PR 4/4 FINAL) #139
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#139
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/114-weight-profiles-ui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
FINAL sub-PR for #114 Custom POI weights — закрывает feature полностью (Макс ask "садики ≠ Мегамарт").
Sub-PRs
Changes
New:
lib/api/weightProfiles.ts(167 lines)New:
components/site-finder/WeightProfilePanel.tsx(402 lines)Collapsible panel:
Modified:
useSiteAnalysis.ts(+25 lines)Accepts
AnalyzeOptions { profile_id?, profile_user_id? }— builds query string для initial POST + 202-retry polling transparently.Modified:
app/site-finder/page.tsx(+65 lines)Lifts weights state, integrates panel below header. Wires
handleWeightsChange(weights, profileId)для apply flow.Integration flow
User selects profile →
activeProfileIdset → next analyze?profile_id=N. User edits sliders без save → yellow banner. Apply requires save или profile selection.Approach: 'save first' для ephemeral weights
Chose 'save first' (НЕ temp profile creation) — simpler, no backend extension. Inline weight passing follow-up sub-PR 5 если потребуется.
Checks
Verify visually после merge
?profile_id=Nvisible в Network tabVault
code/modules/Module_Weight_Profiles_Frontend.md(NEW)Module_Weight_Profiles_Service.md(appended 'Consumed by (frontend)')Closes #114
Bot review (SHA
4e58998, CI ✅) — FINAL sub-PR for #114Закрывает #114 полностью. tsc/ESLint clean, оба CI зелёные.
weightProfiles.ts(API client + constants, +172)✅ 4 TanStack Query hooks с правильной cache invalidation
✅
encodeURIComponent(userId)во всех URL params — XSS-safe✅
enabled: !!userId && !!adminToken— гард на отсутствие auth context✅ Constants зеркалят backend: POI_CATEGORIES (11), POI_DEFAULT_WEIGHTS, POI_LABELS, bounds [-2, 3]
✅ Cyrillic labels осмысленные — "Трамвайные ост. (−)" с явным minus-знаком подсказывает penalty-вес
useSiteAnalysis.tsintegration (+32/-6)✅
AnalyzeOptions { profileId?, profileUserId? }— opt-in API✅
URLSearchParamsдля query string — корректное URL encoding (включая special chars в profileUserId)✅
analyzeUrlфункция reused для initial POST и retry — consistent✅ Backward compatible: пустые options → no query string → behavior как до sub-PR 3
WeightProfilePanel.tsx(+431 NEW) +page.tsx(+88/-1)✅ Collapsible panel ниже header в
/site-finder✅ 11 sliders + 'Сбросить' / 'Сохранить' / 'Применить' UX
✅ 'Save first' approach для ephemeral weights — sensible simplification без backend extension
Минор (не блокеры — все в TODO / follow-up зоне)
25 sliders → 11: оригинальный #114 plan упоминал 25, фактически 11 (= backend
ALLOWED_CATEGORIES). Scope inconsistency между early planning и final delivery, не функциональный issue.POI_DEFAULT_WEIGHTS дублирован frontend ↔ backend — PR body фиксирует TODO
npm run codegenдля генерации openapi types. Сейчас manual sync через комментарий "Keep in sync with backend; source of truth is _POI_WEIGHTS in parcels.py". Drift risk если backend кто-то поменяет без frontend updates — но codegen step запланирован.useUpdateProfilecurried на (userId, profileId, adminToken) — означает один профиль в редактировании за раз через один инстанс hook'а. Acceptable для типичного UI flow.'Verify visually after merge' checklist в PR body — 7 пунктов (panel renders / sliders smooth / dropdown loads / save flow / apply flow / network tab profile_id). UI код не проверяется CI-static-проверками, эти gates за пользователем после merge.
Заметка про response inconsistency из sub-PR 3
weights_appliedполе в analyze response может показывать partial dict (если профиль частичный), хотя scoring применяет system fallback. Следующий рефактор — merge вresolve_weightsдо возврата. Этот PR (#139) этого не трогает — может быть отдельным cleanup PR.approve merge