feat(tradein): Stage 4c — scrapers admin pages (Avito real + Cian/Yandex stubs) #472
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#472
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-frontend-scrapers-admin"
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
Stage 4c follow-up — admin UI для AvitoScraper v2 endpoints (PR #460 Stage 4a). По пользовательскому запросу: top nav + admin page для триггеров скрапера + stub'ы для Cian/Yandex.
LOC: 6 files (4 new + 2 modify).
Changes
NEW
components/trade-in/Topbar.tsxShared header с 6 nav items: Оценка · История · Кэш · Авито · Циан · Яндекс. Активная вкладка — по
activeprop.NEW
/scrapers/avito— full admin UI4 trigger секции (по pattern
frontend/src/app/admin/scrape/objective/page.tsx):POST /admin/scrapePOST /admin/scrape/avito-housePOST /admin/scrape/avito-detailPOST /admin/scrape/avito-imvКаждая section: TanStack
useMutation+ JSONResultPanel(success / error / loading states).NEW
/scrapers/cian+/scrapers/yandex— stub pagesPlaceholders с пояснением: "В разработке, пока используйте cron-scrape.sh или curl". Зайти на них из nav можно — не 404.
UPDATE
app/page.tsxInline
<header className="topbar">(15 lines) заменён на<Topbar active="estimate" />. Убран importAPI_BASE_URL(теперь internal в Topbar).CSS append
trade-in.css.scraper-page,.scraper-section,.scraper-form,.scraper-result— responsive grid layout, focus styles, error variant.Verify
tsc --noEmitcleannext buildpass — 9 routes (3 новых:/scrapers/avito,/scrapers/cian,/scrapers/yandex)npm run lintskip — pre-existing no-config issue (out of scope)Test plan
/trade-in/scrapers/avito→ submit search form для ЕКБ anchor → verify JSON response с counters/catalog/houses/ekaterinburg/ul_akademika_postovskogo_17a/3171365) → verify house_id + reviews countersNotes
require_admin. В prod нуженX-Admin-Token— но per recent PR #437 он dropped, теперь Caddy basic_auth достаточно. Frontend полагается на browser session creds (basic_auth handled by Caddy).Refs
frontend/src/app/admin/scrape/objective/page.tsxMerged via deep-code-reviewer — verdict APPROVE (squash →
6490344).Verified
/scrape,/scrape/avito-house?house_url=,/scrape/avito-detail?item_url=,/scrape/avito-imv?…) signature-matched. Frontend correctly usesfloor_at_home(PR description опечаткаtotal_floors— код правильный).X-Admin-Token;apiFetchдобавляет толькоX-Session-Id+Content-Type. Caddy basic_auth (per #437) handles auth — browser session creds passed automatically. В devsettings.admin_token=None→ endpoints open, acceptable.any/@ts-ignore.useMutation<TData,Error,TVariables>generics explicit. 4 mutation states isolated — concurrent submission OK.encodeURIComponent(house_url)+URLSearchParamsдля IMV — без manual concat..scraper-*classes без collisions; tokens с fallbackvar(--bg-card, #ffffff)graceful..topbar/.top-nav/.is-activestyles из старого header — visual continuity.Minor follow-up (non-blocking, отдельным PR)
Topbar.tsx: добавитьaria-current={item.key === active ? "page" : undefined}для screen-reader a11y.avito/page.tsx: number inputs (lat/lon/area/rooms/floor) лучше сtype="number" step="any"—parseFloat("abc") = NaNсейчас полагается на backend 422.ResultPanel: добавитьisPendingrendering — long-running IMV (60+ sec) не имеет визуального feedback в panel, только disabled button.cian/page.tsx+yandex/page.tsx: inlinestyle={{ color: "var(--muted, …) }}дублирует.scraper-hintclass — refactor./history+/cache— pages не вижу вapp/(но это pre-existing, не regression этого PR).Risk: Low — frontend-only, no backend/DB/auth changes. Easy revert.