adserver-dashboard 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ci/staging.yml +191 -0
- package/.dockerignore +117 -0
- package/.env +40 -0
- package/.env.staging +38 -0
- package/.gitlab-ci.yml +16 -0
- package/DEMO_STATUS.md +579 -0
- package/Dockerfile +61 -0
- package/Influence-MW-AdServer-12-02-2026/client/index.html +17 -0
- package/Influence-MW-AdServer-12-02-2026/client/public/favicon.png +0 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/App.tsx +91 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/advanced-map-drawer.tsx +1131 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ai-recommendation-panel.tsx +379 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/app-sidebar.tsx +183 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/auto-optimize-button.tsx +184 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/availability-drawer.tsx +385 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/brand-insights-panel.tsx +87 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/create-agency-drawer.tsx +198 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/create-brand-drawer.tsx +275 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/creative-assignment.tsx +526 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/data-table-toolbar.tsx +148 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/data-table.tsx +158 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/filter-drawer.tsx +356 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/form-insights-panel.tsx +82 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/geography-selector.tsx +699 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/header-user-menu.tsx +178 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/history-drawer.tsx +313 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-availability-section.tsx +176 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-format-drawer.tsx +173 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-selector.tsx +401 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/manual-inventory-drawer.tsx +368 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/mapbox-map.tsx +368 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/market-insights-panel.tsx +202 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/media-owner-drawer.tsx +217 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/metric-card.tsx +58 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/page-header.tsx +27 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/player-status-indicator.tsx +137 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/poi-targeting-drawer.tsx +298 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/recommendation-score-badge.tsx +102 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/recommended-inventories-panel.tsx +248 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/searchable-combobox.tsx +134 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/signal-visualizations.tsx +407 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/status-badge.tsx +35 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/theme-provider.tsx +73 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/theme-toggle.tsx +37 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/traffic-slider.tsx +75 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/accordion.tsx +56 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/alert-dialog.tsx +139 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/alert.tsx +59 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/aspect-ratio.tsx +5 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/avatar.tsx +51 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/badge.tsx +38 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/breadcrumb.tsx +115 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/button.tsx +62 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/calendar.tsx +68 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/card.tsx +85 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/carousel.tsx +260 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/chart.tsx +365 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/checkbox.tsx +28 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/collapsible.tsx +11 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/command.tsx +151 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/context-menu.tsx +198 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/dialog.tsx +122 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/drawer.tsx +118 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/dropdown-menu.tsx +198 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/form.tsx +178 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/hover-card.tsx +29 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/input-otp.tsx +69 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/input.tsx +23 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/label.tsx +24 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/menubar.tsx +256 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/navigation-menu.tsx +128 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/pagination.tsx +117 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/popover.tsx +29 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/progress.tsx +28 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/radio-group.tsx +42 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/resizable.tsx +45 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/scroll-area.tsx +46 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/select.tsx +160 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/separator.tsx +29 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/sheet.tsx +140 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/sidebar.tsx +727 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/skeleton.tsx +15 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/slider.tsx +26 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/switch.tsx +27 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/table.tsx +117 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/tabs.tsx +53 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/textarea.tsx +22 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toast.tsx +127 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toaster.tsx +33 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toggle-group.tsx +61 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toggle.tsx +43 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/tooltip.tsx +30 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/vendor-stores-modal.tsx +336 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/venue-type-drawer.tsx +359 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/venue-type-selector.tsx +436 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/hooks/use-mobile.tsx +19 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/hooks/use-toast.ts +191 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/index.css +244 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/lib/queryClient.ts +57 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/lib/utils.ts +39 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/lib/venue-taxonomy.ts +532 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/main.tsx +5 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/assign-creative.tsx +781 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/content-hub.tsx +995 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/custom-pois.tsx +431 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/dashboard.tsx +620 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/deal-detail.tsx +1062 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/deal-form.tsx +1570 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/deals.tsx +716 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/edit-creative-assignment.tsx +1051 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/geotargeting.tsx +675 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/integrations.tsx +425 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-item-creatives.tsx +622 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-item-form.tsx +3132 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-items.tsx +530 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/not-found.tsx +21 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/proof-of-play-upload.tsx +479 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/proof-of-play.tsx +880 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/reports.tsx +235 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/settings.tsx +652 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/signal-form.tsx +1117 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/signals.tsx +366 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/tags.tsx +332 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/venues.tsx +381 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/types/mapbox-gl-draw.d.ts +37 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/types/react-simple-maps.d.ts +57 -0
- package/Influence-MW-AdServer-12-02-2026/components.json +20 -0
- package/Influence-MW-AdServer-12-02-2026/docs/PRD.md +3373 -0
- package/Influence-MW-AdServer-12-02-2026/docs/influence-feature-mapping.csv +498 -0
- package/Influence-MW-AdServer-12-02-2026/drizzle.config.ts +14 -0
- package/Influence-MW-AdServer-12-02-2026/package-lock.json +9672 -0
- package/Influence-MW-AdServer-12-02-2026/package.json +118 -0
- package/Influence-MW-AdServer-12-02-2026/postcss.config.js +6 -0
- package/Influence-MW-AdServer-12-02-2026/replit.md +91 -0
- package/Influence-MW-AdServer-12-02-2026/script/build.ts +67 -0
- package/Influence-MW-AdServer-12-02-2026/scripts/create-miro-diagrams.cjs +318 -0
- package/Influence-MW-AdServer-12-02-2026/scripts/create-remaining-diagrams.cjs +270 -0
- package/Influence-MW-AdServer-12-02-2026/server/index.ts +103 -0
- package/Influence-MW-AdServer-12-02-2026/server/recommendation-service.ts +319 -0
- package/Influence-MW-AdServer-12-02-2026/server/routes.ts +1890 -0
- package/Influence-MW-AdServer-12-02-2026/server/static.ts +19 -0
- package/Influence-MW-AdServer-12-02-2026/server/storage.ts +2058 -0
- package/Influence-MW-AdServer-12-02-2026/server/vite.ts +58 -0
- package/Influence-MW-AdServer-12-02-2026/shared/schema.ts +1595 -0
- package/Influence-MW-AdServer-12-02-2026/tailwind.config.ts +107 -0
- package/Influence-MW-AdServer-12-02-2026/tsconfig.json +23 -0
- package/Influence-MW-AdServer-12-02-2026/vite.config.ts +40 -0
- package/LINE_ITEM_BUDGET_FIELD_MAPPING.md +178 -0
- package/PCM/.env.example +92 -0
- package/PCM/README.md +558 -0
- package/PCM/docs/TEST_CASES.md +422 -0
- package/PCM/index.js +106 -0
- package/PCM/package-lock.json +3282 -0
- package/PCM/package.json +32 -0
- package/PCM/replit.md +64 -0
- package/PCM/schema.sql +495 -0
- package/PCM/scripts/export-schema.js +183 -0
- package/PCM/scripts/seed-comprehensive.js +631 -0
- package/PCM/scripts/seed-production.js +477 -0
- package/PCM/src/config/db.js +56 -0
- package/PCM/src/config/swagger.js +5975 -0
- package/PCM/src/dto/EmailRequestDTO.js +166 -0
- package/PCM/src/middleware/errorHandler.js +52 -0
- package/PCM/src/middleware/logger.js +26 -0
- package/PCM/src/migrations/001_add_campaign_mode_fields.sql +36 -0
- package/PCM/src/migrations/002_create_deal_id_counters.sql +22 -0
- package/PCM/src/migrations/003_update_publishers_column.sql +15 -0
- package/PCM/src/migrations/004_add_direct_dealtype_and_advertiser.sql +5 -0
- package/PCM/src/migrations/005_add_programmatic_fields_and_update_enums.sql +31 -0
- package/PCM/src/migrations/006_add_line_item_programmatic_fields.sql +12 -0
- package/PCM/src/migrations/007_add_line_item_direct_fields.sql +15 -0
- package/PCM/src/migrations/008_add_inventory_fields.sql +45 -0
- package/PCM/src/migrations/009_move_inventory_fields_to_metadata.sql +32 -0
- package/PCM/src/migrations/010_add_draft_status_and_line_items_count.sql +23 -0
- package/PCM/src/migrations/011_add_planning_field.sql +21 -0
- package/PCM/src/migrations/012_fix_inventory_composite_pk.sql +17 -0
- package/PCM/src/migrations/013_make_external_id_optional.sql +3 -0
- package/PCM/src/migrations/014_create_change_history.sql +38 -0
- package/PCM/src/migrations/016_create_publisher_insertion_orders.sql +33 -0
- package/PCM/src/migrations/017_fix_line_item_id_fk_reference.sql +86 -0
- package/PCM/src/migrations/018_create_approval_tables.sql +44 -0
- package/PCM/src/migrations/019_add_encrypted_token_column.sql +2 -0
- package/PCM/src/migrations/020_add_rejection_reason_to_deals.sql +10 -0
- package/PCM/src/migrations/021_add_publisher_external_id_to_inventories.sql +12 -0
- package/PCM/src/migrations/022_add_line_item_extended_fields.sql +24 -0
- package/PCM/src/migrations/023_add_base_price_fields.sql +8 -0
- package/PCM/src/migrations/run-migrations.js +46 -0
- package/PCM/src/models/ApprovalOTP.js +51 -0
- package/PCM/src/models/ApprovalToken.js +79 -0
- package/PCM/src/models/ChangeHistory.js +107 -0
- package/PCM/src/models/Deal.js +186 -0
- package/PCM/src/models/DealIdCounter.js +28 -0
- package/PCM/src/models/LineItem.js +227 -0
- package/PCM/src/models/LineItemCreative.js +89 -0
- package/PCM/src/models/LineItemInventory.js +115 -0
- package/PCM/src/models/PublisherInsertionOrder.js +93 -0
- package/PCM/src/models/TransactionHistory.js +34 -0
- package/PCM/src/models/associations.js +81 -0
- package/PCM/src/routes/approval.js +321 -0
- package/PCM/src/routes/creatives.js +437 -0
- package/PCM/src/routes/deals.js +1638 -0
- package/PCM/src/routes/digitalSignage.js +242 -0
- package/PCM/src/routes/insertionOrders.js +380 -0
- package/PCM/src/routes/lineItems.js +926 -0
- package/PCM/src/routes/system.js +384 -0
- package/PCM/src/services/ApprovalService.js +885 -0
- package/PCM/src/services/CampaignImportConverter.js +631 -0
- package/PCM/src/services/CampaignModeService.js +273 -0
- package/PCM/src/services/CampaignStatusService.js +395 -0
- package/PCM/src/services/ChangeHistoryService.js +316 -0
- package/PCM/src/services/DealIdService.js +94 -0
- package/PCM/src/services/DealResponseFormatter.js +90 -0
- package/PCM/src/services/EmailNotificationService.js +315 -0
- package/PCM/src/services/LineItemResponseFormatter.js +122 -0
- package/PCM/src/services/LineItemStatusService.js +380 -0
- package/PCM/src/tests/comprehensiveTestRunner.js +360 -0
- package/PCM/src/tests/comprehensiveTests.js +1277 -0
- package/PCM/src/tests/dealTypeUnitTests.js +1058 -0
- package/PCM/src/tests/testRunner.js +248 -0
- package/PCM/src/utils/caseConverter.js +92 -0
- package/PCM/src/utils/dealCalculations.js +206 -0
- package/PCM/src/utils/lineItemPayloadNormalizer.js +41 -0
- package/PCM/src/utils/payloadNormalizer.js +34 -0
- package/PCM/src/utils/sourceNormalizer.js +56 -0
- package/PCM/src/validators/creativeValidator.js +27 -0
- package/PCM/src/validators/dealValidator.js +203 -0
- package/PCM/src/validators/lineItemValidator.js +489 -0
- package/PCM/tests/approval-flows.test.js +238 -0
- package/PCM/tests/approval-workflow.test.js +291 -0
- package/PCM/tests/campaign-import-converter.test.js +543 -0
- package/PCM/tests/campaign-import-e2e.test.js +520 -0
- package/PCM/tests/campaign-status.test.js +539 -0
- package/PCM/tests/direct-publisher-split-reimport.test.js +460 -0
- package/PCM/tests/e2e/digital-signage.test.js +145 -0
- package/PCM/tests/e2e/search-filter-pagination.test.js +399 -0
- package/PCM/tests/e2e-comprehensive.test.js +3446 -0
- package/PCM/tests/edge-cases.test.js +340 -0
- package/PCM/tests/line-item-status.test.js +340 -0
- package/PCM/tests/seller-account-external-ids.test.js +877 -0
- package/PCM/tests/source-validation.test.js +324 -0
- package/PRD.md +3373 -0
- package/README.md +186 -0
- package/client/index.html +35 -0
- package/client/public/DEMO_STATUS.md +579 -0
- package/client/public/img/MW-logo-trans_1754045676555.png +0 -0
- package/client/public/locales/ar/approval.json +144 -0
- package/client/public/locales/ar/buyer.json +61 -0
- package/client/public/locales/ar/campaigns.json +1 -0
- package/client/public/locales/ar/common.json +218 -0
- package/client/public/locales/ar/contentHub.json +266 -0
- package/client/public/locales/ar/creatives.json +79 -0
- package/client/public/locales/ar/dashboard.json +57 -0
- package/client/public/locales/ar/deals.json +886 -0
- package/client/public/locales/ar/dsp.json +131 -0
- package/client/public/locales/ar/inventory.json +201 -0
- package/client/public/locales/ar/lineItems.json +553 -0
- package/client/public/locales/ar/navigation.json +48 -0
- package/client/public/locales/ar/wizard.json +1 -0
- package/client/public/locales/en/approval.json +144 -0
- package/client/public/locales/en/buyer.json +65 -0
- package/client/public/locales/en/campaigns.json +1 -0
- package/client/public/locales/en/common.json +218 -0
- package/client/public/locales/en/contentHub.json +266 -0
- package/client/public/locales/en/creatives.json +79 -0
- package/client/public/locales/en/dashboard.json +57 -0
- package/client/public/locales/en/deals.json +886 -0
- package/client/public/locales/en/dsp.json +131 -0
- package/client/public/locales/en/inventory.json +201 -0
- package/client/public/locales/en/lineItems.json +659 -0
- package/client/public/locales/en/navigation.json +48 -0
- package/client/public/locales/en/wizard.json +1 -0
- package/client/public/locales/ja/approval.json +144 -0
- package/client/public/locales/ja/buyer.json +61 -0
- package/client/public/locales/ja/campaigns.json +1 -0
- package/client/public/locales/ja/common.json +218 -0
- package/client/public/locales/ja/contentHub.json +266 -0
- package/client/public/locales/ja/creatives.json +79 -0
- package/client/public/locales/ja/dashboard.json +57 -0
- package/client/public/locales/ja/deals.json +886 -0
- package/client/public/locales/ja/dsp.json +131 -0
- package/client/public/locales/ja/inventory.json +201 -0
- package/client/public/locales/ja/lineItems.json +553 -0
- package/client/public/locales/ja/navigation.json +48 -0
- package/client/public/locales/ja/wizard.json +1 -0
- package/client/public/locales/zh/approval.json +144 -0
- package/client/public/locales/zh/buyer.json +61 -0
- package/client/public/locales/zh/campaigns.json +1 -0
- package/client/public/locales/zh/common.json +218 -0
- package/client/public/locales/zh/contentHub.json +266 -0
- package/client/public/locales/zh/creatives.json +79 -0
- package/client/public/locales/zh/dashboard.json +57 -0
- package/client/public/locales/zh/deals.json +886 -0
- package/client/public/locales/zh/dsp.json +131 -0
- package/client/public/locales/zh/inventory.json +201 -0
- package/client/public/locales/zh/lineItems.json +553 -0
- package/client/public/locales/zh/navigation.json +48 -0
- package/client/public/locales/zh/wizard.json +1 -0
- package/client/public/manifest.json +36 -0
- package/client/src/App.tsx +464 -0
- package/client/src/components/app-sidebar.tsx +312 -0
- package/client/src/components/approval/approval-decision-form.test.tsx +294 -0
- package/client/src/components/approval/approval-decision-form.tsx +326 -0
- package/client/src/components/approval/approval-sheet.tsx +631 -0
- package/client/src/components/approval/line-item-details-sheet.tsx +371 -0
- package/client/src/components/approval/otp-verification.test.tsx +337 -0
- package/client/src/components/approval/otp-verification.tsx +180 -0
- package/client/src/components/content-hub/bulk-transcode-dialog.tsx +379 -0
- package/client/src/components/content-hub/content-hub-manager-v2.tsx +574 -0
- package/client/src/components/content-hub/content-hub-manager.tsx +330 -0
- package/client/src/components/content-hub/creative-card.tsx +456 -0
- package/client/src/components/content-hub/creative-detail-sheet.tsx +685 -0
- package/client/src/components/content-hub/creative-filters.tsx +457 -0
- package/client/src/components/content-hub/creative-grid.tsx +329 -0
- package/client/src/components/content-hub/creative-selector.tsx +415 -0
- package/client/src/components/content-hub/creative-upload.tsx +547 -0
- package/client/src/components/content-hub/folder-dialogs.tsx +445 -0
- package/client/src/components/content-hub/folder-list.tsx +280 -0
- package/client/src/components/content-hub/review-dialogs.tsx +268 -0
- package/client/src/components/content-hub/transcode-dialog.tsx +226 -0
- package/client/src/components/creative-library/creative-details-view.tsx +446 -0
- package/client/src/components/creative-library/creative-filters-panel.tsx +203 -0
- package/client/src/components/creative-library/creative-list.tsx +360 -0
- package/client/src/components/creative-library/creative-status-badge.tsx +71 -0
- package/client/src/components/creative-library/folder-card.tsx +78 -0
- package/client/src/components/creative-library/index.ts +27 -0
- package/client/src/components/creative-library/new-creative-card.tsx +211 -0
- package/client/src/components/creative-library/upload-creative-dialog.tsx +261 -0
- package/client/src/components/dashboard-overview.tsx +109 -0
- package/client/src/components/deals/approval-history-panel.test.tsx +240 -0
- package/client/src/components/deals/approval-history-panel.tsx +156 -0
- package/client/src/components/deals/deal-status-badge.tsx +92 -0
- package/client/src/components/deals/import-from-planner-dialog.tsx +399 -0
- package/client/src/components/deals/market-insights-panel.tsx +237 -0
- package/client/src/components/deals/reopen-deal-sheet.tsx +191 -0
- package/client/src/components/deals/request-approval-sheet.test.tsx +323 -0
- package/client/src/components/deals/request-approval-sheet.tsx +136 -0
- package/client/src/components/deals/resend-approval-sheet.tsx +201 -0
- package/client/src/components/direct-campaigns/campaign-card.tsx +283 -0
- package/client/src/components/direct-campaigns/deal-filter-panel.tsx +325 -0
- package/client/src/components/inventory/advanced-filters-panel.tsx +273 -0
- package/client/src/components/inventory/csv-upload-modal.tsx +639 -0
- package/client/src/components/inventory/inventory-availability-view.tsx +486 -0
- package/client/src/components/inventory/inventory-details-sheet.tsx +376 -0
- package/client/src/components/inventory/inventory-map-view.tsx +596 -0
- package/client/src/components/inventory/inventory-settings-menu.tsx +52 -0
- package/client/src/components/language-switcher.tsx +53 -0
- package/client/src/components/line-items/campaign-forecast-panel.tsx +138 -0
- package/client/src/components/line-items/form-insights.tsx +89 -0
- package/client/src/components/line-items/geofencing/LocationCsvUploadDrawer.tsx +100 -0
- package/client/src/components/line-items/geofencing/POIDropdown.tsx +379 -0
- package/client/src/components/line-items/geofencing/SelectedLocationsSidebar.tsx +436 -0
- package/client/src/components/line-items/geofencing/ViewFileLocationDrawer.tsx +199 -0
- package/client/src/components/line-items/geofencing/components/ExistingFilesTab.tsx +268 -0
- package/client/src/components/line-items/geofencing/components/TemplateDownloadSection.tsx +59 -0
- package/client/src/components/line-items/geofencing/components/UploadTab.tsx +215 -0
- package/client/src/components/line-items/geofencing-map.tsx +1270 -0
- package/client/src/components/line-items/inventory-availability-section.tsx +178 -0
- package/client/src/components/line-items/line-item-schedule-manager.tsx +313 -0
- package/client/src/components/line-items/manual-inventory-drawer.tsx +346 -0
- package/client/src/components/line-items/planner-inventory-card.tsx +495 -0
- package/client/src/components/line-items/planner-schedule-grid.tsx +495 -0
- package/client/src/components/line-items/schedule-rule-editor.tsx +649 -0
- package/client/src/components/line-items/schedule-rule-types.ts +122 -0
- package/client/src/components/line-items/steps/creatives-step.tsx +681 -0
- package/client/src/components/line-items/steps/inventory-schedule-step.tsx +1596 -0
- package/client/src/components/line-items/steps/inventory-step.tsx +1533 -0
- package/client/src/components/line-items/steps/line-item-details-step.tsx +916 -0
- package/client/src/components/line-items/steps/schedule-step.tsx +273 -0
- package/client/src/components/line-items/steps/summary-step.tsx +680 -0
- package/client/src/components/line-items/steps/targeting-step.tsx +1708 -0
- package/client/src/components/product-switcher.tsx +105 -0
- package/client/src/components/protected-route.tsx +49 -0
- package/client/src/components/skip-link.tsx +22 -0
- package/client/src/components/stat-card.tsx +53 -0
- package/client/src/components/status-badge.tsx +96 -0
- package/client/src/components/ui/hierarchical-venue-selector.tsx +389 -0
- package/client/src/components/ui/toaster.tsx +111 -0
- package/client/src/contexts/auth-context.tsx +181 -0
- package/client/src/contexts/sidebar-state.tsx +50 -0
- package/client/src/contexts/theme-context.tsx +66 -0
- package/client/src/data/campaign-data.json +107 -0
- package/client/src/data/countries.json +22 -0
- package/client/src/hooks/use-approval.ts +366 -0
- package/client/src/hooks/use-keyboard-shortcuts.ts +74 -0
- package/client/src/hooks/use-media-query.ts +46 -0
- package/client/src/hooks/use-mobile.tsx +19 -0
- package/client/src/hooks/use-page-title.ts +21 -0
- package/client/src/hooks/use-toast.ts +195 -0
- package/client/src/index.css +694 -0
- package/client/src/lib/__tests__/accessibility.test.ts +104 -0
- package/client/src/lib/__tests__/date-utils.test.ts +199 -0
- package/client/src/lib/__tests__/dsp-buyer-api.test.ts +127 -0
- package/client/src/lib/__tests__/dsp-buyer-integration.test.ts +247 -0
- package/client/src/lib/__tests__/storage-utils.test.ts +167 -0
- package/client/src/lib/__tests__/utils.test.ts +57 -0
- package/client/src/lib/accessibility.ts +141 -0
- package/client/src/lib/api-config.ts +9 -0
- package/client/src/lib/auth-service.ts +209 -0
- package/client/src/lib/campaign-creative-api.ts +82 -0
- package/client/src/lib/company-api.ts +61 -0
- package/client/src/lib/content-hub-api.ts +407 -0
- package/client/src/lib/creative-mapper.ts +61 -0
- package/client/src/lib/date-utils.ts +119 -0
- package/client/src/lib/deal-helpers.ts +220 -0
- package/client/src/lib/dsp-buyer-api.ts +196 -0
- package/client/src/lib/geo-import-api.ts +151 -0
- package/client/src/lib/google-poi-api.ts +305 -0
- package/client/src/lib/i18n/__tests__/formatting.test.ts +202 -0
- package/client/src/lib/i18n/formatting.ts +130 -0
- package/client/src/lib/i18n/index.ts +8 -0
- package/client/src/lib/i18n-compat.ts +76 -0
- package/client/src/lib/influence-deals-api.ts +896 -0
- package/client/src/lib/inventory-api.ts +399 -0
- package/client/src/lib/oauth-service.ts +678 -0
- package/client/src/lib/poi-types.ts +75 -0
- package/client/src/lib/queryClient.ts +144 -0
- package/client/src/lib/recommendation-api.ts +380 -0
- package/client/src/lib/storage-utils.ts +104 -0
- package/client/src/lib/tolgee.ts +85 -0
- package/client/src/lib/utils.ts +0 -0
- package/client/src/main.tsx +67 -0
- package/client/src/mapbox-draw-modes.d.ts +32 -0
- package/client/src/pages/all-folders.tsx +203 -0
- package/client/src/pages/auth-callback.tsx +115 -0
- package/client/src/pages/buyer-form.tsx +339 -0
- package/client/src/pages/buyer-list.tsx +622 -0
- package/client/src/pages/content-hub.tsx +1358 -0
- package/client/src/pages/create-deal.tsx +2093 -0
- package/client/src/pages/creative-assignment-page.tsx +548 -0
- package/client/src/pages/creatives.tsx +5 -0
- package/client/src/pages/custom-pois.tsx +425 -0
- package/client/src/pages/dashboard.tsx +615 -0
- package/client/src/pages/deal-history.tsx +434 -0
- package/client/src/pages/deal-line-items.tsx +1703 -0
- package/client/src/pages/demo-status.tsx +113 -0
- package/client/src/pages/direct-campaign-details.tsx +361 -0
- package/client/src/pages/direct-campaigns-new.tsx +824 -0
- package/client/src/pages/dsp-form.tsx +803 -0
- package/client/src/pages/dsp-list.tsx +239 -0
- package/client/src/pages/folder-content.tsx +336 -0
- package/client/src/pages/integrations.tsx +429 -0
- package/client/src/pages/line-item-creatives.tsx +789 -0
- package/client/src/pages/line-item-detail-page.tsx +684 -0
- package/client/src/pages/line-item-form-page.tsx +3261 -0
- package/client/src/pages/line-item-wizard.tsx +1207 -0
- package/client/src/pages/login.tsx +154 -0
- package/client/src/pages/not-found.tsx +23 -0
- package/client/src/pages/proof-of-play.tsx +397 -0
- package/client/src/pages/public-approval.tsx +551 -0
- package/client/src/pages/reports.tsx +231 -0
- package/client/src/pages/settings.tsx +760 -0
- package/client/src/pages/signals.tsx +389 -0
- package/client/src/pages/tags.tsx +318 -0
- package/client/src/pages/test-results.tsx +328 -0
- package/client/src/store/hooks.ts +5 -0
- package/client/src/store/index.ts +15 -0
- package/client/src/store/mapMarkerLocationsSlice.ts +241 -0
- package/client/src/styles/design-tokens.css +324 -0
- package/client/src/test/setup.ts +261 -0
- package/client/src/test/test-utils.tsx +40 -0
- package/client/src/types/approval.ts +221 -0
- package/client/src/types/content-hub.ts +209 -0
- package/client/src/types/geofencing.ts +67 -0
- package/client/src/types/transcoding.ts +140 -0
- package/client/src/vite-env.d.ts +18 -0
- package/components.json +20 -0
- package/creative-api.json +1 -0
- package/docs/AI_REFERENCE.md +459 -0
- package/docs/MWDesign-Prompt.md +132 -0
- package/docs/MWDesign-System.md +344 -0
- package/docs/test-plan.md +277 -0
- package/e2e/AUTONOMOUS-TESTING.md +406 -0
- package/e2e/README.md +219 -0
- package/e2e/autonomous-flow.spec.ts +308 -0
- package/e2e/debug-sso.spec.ts +163 -0
- package/e2e/direct-campaigns.spec.ts +219 -0
- package/e2e/explore-sso.spec.ts +149 -0
- package/e2e/fixtures/auth.ts +26 -0
- package/e2e/fixtures/enhanced-test.ts +331 -0
- package/e2e/pagination.spec.ts +280 -0
- package/e2e/view-toggle.spec.ts +312 -0
- package/generated-icon.png +0 -0
- package/i18next-scanner.config.cjs +46 -0
- package/package.json +141 -0
- package/playwright.config.ts +93 -0
- package/postcss.config.js +6 -0
- package/replit.md +196 -0
- package/screenshot-after-login.png +0 -0
- package/screenshot-contenthub-grid.png +0 -0
- package/screenshot-contenthub-list-fixed.png +0 -0
- package/screenshot-contenthub-list.png +0 -0
- package/screenshot-create-deal.png +0 -0
- package/screenshot-dashboard.png +0 -0
- package/screenshot-deals.png +0 -0
- package/screenshot-login-filled.png +0 -0
- package/screenshot-login.png +0 -0
- package/screenshot.mjs +24 -0
- package/scripts/deploy-stg.sh +185 -0
- package/shared/direct-io-schema.ts +383 -0
- package/shared/schema.ts +439 -0
- package/shared/screen-types.ts +149 -0
- package/springdocDefault.json +1 -0
- package/swagger-ui-bundle.js +2 -0
- package/swagger-ui-init.js +10316 -0
- package/tailwind.config.ts +282 -0
- package/terraform/README.md +306 -0
- package/terraform/cloudfront.tf +289 -0
- package/terraform/ecs.tf +727 -0
- package/terraform/environments/dev.tfvars +59 -0
- package/terraform/environments/production.tfvars +60 -0
- package/terraform/main.tf +47 -0
- package/terraform/outputs.tf +145 -0
- package/terraform/s3.tf +192 -0
- package/terraform/variables.tf +226 -0
- package/terraform/waf.tf +165 -0
- package/terraform-frontend/.terraform.lock.hcl +25 -0
- package/terraform-frontend/README.md +85 -0
- package/terraform-frontend/cloudfront.tf +125 -0
- package/terraform-frontend/main.tf +31 -0
- package/terraform-frontend/outputs.tf +24 -0
- package/terraform-frontend/terraform.tfvars +12 -0
- package/terraform-frontend/variables.tf +53 -0
- package/tsconfig.json +23 -0
- package/vite.config.ts +226 -0
- package/vitest.config.ts +56 -0
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from '@/lib/i18n';
|
|
3
|
+
import mapboxgl from 'mapbox-gl';
|
|
4
|
+
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
5
|
+
import { Button, cn } from '@moving-walls/design-system';
|
|
6
|
+
import { Badge } from '@moving-walls/design-system';
|
|
7
|
+
import { Checkbox } from '@moving-walls/design-system';
|
|
8
|
+
import { Plus, Minus, Maximize2, X, MapPin, Eye } from 'lucide-react';
|
|
9
|
+
|
|
10
|
+
interface InventoryTag {
|
|
11
|
+
label: string;
|
|
12
|
+
variant: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'outline';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface InventoryItemForMap {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
address: string;
|
|
19
|
+
tags: InventoryTag[];
|
|
20
|
+
thumbnail?: string;
|
|
21
|
+
latitude?: number;
|
|
22
|
+
longitude?: number;
|
|
23
|
+
type?: string;
|
|
24
|
+
format?: string;
|
|
25
|
+
mediaType?: string;
|
|
26
|
+
size?: string;
|
|
27
|
+
publisherName?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface InventoryMapViewProps {
|
|
31
|
+
inventories: InventoryItemForMap[];
|
|
32
|
+
selectedInventories: string[];
|
|
33
|
+
onSelectInventory: (inventoryId: string) => void;
|
|
34
|
+
onInventoryToggle: (inventoryId: string) => void;
|
|
35
|
+
onViewDetails?: (inventory: InventoryItemForMap) => void;
|
|
36
|
+
className?: string;
|
|
37
|
+
defaultCenter?: [number, number];
|
|
38
|
+
defaultZoom?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const MAPBOX_TOKEN = "pk.eyJ1IjoibWF4aW5mbyIsImEiOiJjbWV2M2l6ZDMwZ2ZqMmtzaHUyMXc3bGl2In0.ttPa9Es1LK2herlw4ZM0Hw";
|
|
42
|
+
|
|
43
|
+
const DEFAULT_CENTER: [number, number] = [139.6917, 35.6895];
|
|
44
|
+
const DEFAULT_ZOOM = 10;
|
|
45
|
+
|
|
46
|
+
export function InventoryMapView({
|
|
47
|
+
inventories,
|
|
48
|
+
selectedInventories,
|
|
49
|
+
onSelectInventory,
|
|
50
|
+
onInventoryToggle,
|
|
51
|
+
onViewDetails,
|
|
52
|
+
className,
|
|
53
|
+
defaultCenter = DEFAULT_CENTER,
|
|
54
|
+
defaultZoom = DEFAULT_ZOOM,
|
|
55
|
+
}: InventoryMapViewProps) {
|
|
56
|
+
const { t } = useTranslation('inventory');
|
|
57
|
+
const mapContainer = useRef<HTMLDivElement>(null);
|
|
58
|
+
const map = useRef<mapboxgl.Map | null>(null);
|
|
59
|
+
const popup = useRef<mapboxgl.Popup | null>(null);
|
|
60
|
+
const [isMapLoaded, setIsMapLoaded] = useState(false);
|
|
61
|
+
const [activePopupInventory, setActivePopupInventory] = useState<InventoryItemForMap | null>(null);
|
|
62
|
+
|
|
63
|
+
const getInventoryCoordinates = useCallback((inv: InventoryItemForMap): [number, number] | null => {
|
|
64
|
+
if (inv.latitude && inv.longitude) {
|
|
65
|
+
return [inv.longitude, inv.latitude];
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const createGeoJSONSource = useCallback(() => {
|
|
71
|
+
const features = inventories
|
|
72
|
+
.map((inv) => {
|
|
73
|
+
const coords = getInventoryCoordinates(inv);
|
|
74
|
+
if (!coords) return null;
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
type: 'Feature' as const,
|
|
78
|
+
properties: {
|
|
79
|
+
id: inv.id,
|
|
80
|
+
name: inv.name,
|
|
81
|
+
address: inv.address,
|
|
82
|
+
thumbnail: inv.thumbnail || '',
|
|
83
|
+
type: inv.type || 'screen',
|
|
84
|
+
format: inv.format || '',
|
|
85
|
+
mediaType: inv.mediaType || '',
|
|
86
|
+
size: inv.size || '',
|
|
87
|
+
publisherName: inv.publisherName || '',
|
|
88
|
+
isSelected: selectedInventories.includes(inv.id),
|
|
89
|
+
tags: JSON.stringify(inv.tags || []),
|
|
90
|
+
},
|
|
91
|
+
geometry: {
|
|
92
|
+
type: 'Point' as const,
|
|
93
|
+
coordinates: coords,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
})
|
|
97
|
+
.filter((f): f is NonNullable<typeof f> => f !== null);
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
type: 'FeatureCollection' as const,
|
|
101
|
+
features,
|
|
102
|
+
};
|
|
103
|
+
}, [inventories, selectedInventories, getInventoryCoordinates]);
|
|
104
|
+
|
|
105
|
+
const initializeMap = useCallback(() => {
|
|
106
|
+
if (!mapContainer.current || map.current) return;
|
|
107
|
+
|
|
108
|
+
mapboxgl.accessToken = MAPBOX_TOKEN;
|
|
109
|
+
|
|
110
|
+
map.current = new mapboxgl.Map({
|
|
111
|
+
container: mapContainer.current,
|
|
112
|
+
style: 'mapbox://styles/mapbox/streets-v12',
|
|
113
|
+
center: defaultCenter,
|
|
114
|
+
zoom: defaultZoom,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
map.current.on('load', () => {
|
|
118
|
+
if (!map.current) return;
|
|
119
|
+
|
|
120
|
+
map.current.addSource('inventories', {
|
|
121
|
+
type: 'geojson',
|
|
122
|
+
data: createGeoJSONSource(),
|
|
123
|
+
cluster: true,
|
|
124
|
+
clusterMaxZoom: 14,
|
|
125
|
+
clusterRadius: 50,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
map.current.addLayer({
|
|
129
|
+
id: 'clusters',
|
|
130
|
+
type: 'circle',
|
|
131
|
+
source: 'inventories',
|
|
132
|
+
filter: ['has', 'point_count'],
|
|
133
|
+
paint: {
|
|
134
|
+
'circle-color': [
|
|
135
|
+
'step',
|
|
136
|
+
['get', 'point_count'],
|
|
137
|
+
'#2176cc',
|
|
138
|
+
10,
|
|
139
|
+
'#1e5fa8',
|
|
140
|
+
30,
|
|
141
|
+
'#194d8a',
|
|
142
|
+
],
|
|
143
|
+
'circle-radius': [
|
|
144
|
+
'step',
|
|
145
|
+
['get', 'point_count'],
|
|
146
|
+
20,
|
|
147
|
+
10,
|
|
148
|
+
25,
|
|
149
|
+
30,
|
|
150
|
+
30,
|
|
151
|
+
],
|
|
152
|
+
'circle-stroke-width': 2,
|
|
153
|
+
'circle-stroke-color': '#ffffff',
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
map.current.addLayer({
|
|
158
|
+
id: 'cluster-count',
|
|
159
|
+
type: 'symbol',
|
|
160
|
+
source: 'inventories',
|
|
161
|
+
filter: ['has', 'point_count'],
|
|
162
|
+
layout: {
|
|
163
|
+
'text-field': ['get', 'point_count_abbreviated'],
|
|
164
|
+
'text-font': ['DIN Offc Pro Medium', 'Arial Unicode MS Bold'],
|
|
165
|
+
'text-size': 12,
|
|
166
|
+
},
|
|
167
|
+
paint: {
|
|
168
|
+
'text-color': '#ffffff',
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
map.current.addLayer({
|
|
173
|
+
id: 'unclustered-point',
|
|
174
|
+
type: 'circle',
|
|
175
|
+
source: 'inventories',
|
|
176
|
+
filter: ['!', ['has', 'point_count']],
|
|
177
|
+
paint: {
|
|
178
|
+
'circle-color': [
|
|
179
|
+
'case',
|
|
180
|
+
['get', 'isSelected'],
|
|
181
|
+
'#22c55e',
|
|
182
|
+
'#2176cc',
|
|
183
|
+
],
|
|
184
|
+
'circle-radius': 8,
|
|
185
|
+
'circle-stroke-width': 2,
|
|
186
|
+
'circle-stroke-color': '#ffffff',
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
map.current.addLayer({
|
|
191
|
+
id: 'unclustered-point-icon',
|
|
192
|
+
type: 'symbol',
|
|
193
|
+
source: 'inventories',
|
|
194
|
+
filter: ['!', ['has', 'point_count']],
|
|
195
|
+
layout: {
|
|
196
|
+
'icon-image': 'marker-15',
|
|
197
|
+
'icon-size': 1.2,
|
|
198
|
+
'icon-allow-overlap': true,
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
map.current.on('click', 'clusters', (e) => {
|
|
203
|
+
if (!map.current) return;
|
|
204
|
+
const features = map.current.queryRenderedFeatures(e.point, {
|
|
205
|
+
layers: ['clusters'],
|
|
206
|
+
});
|
|
207
|
+
const clusterId = features[0]?.properties?.cluster_id;
|
|
208
|
+
const source = map.current.getSource('inventories') as mapboxgl.GeoJSONSource;
|
|
209
|
+
|
|
210
|
+
source.getClusterExpansionZoom(clusterId, (err, zoom) => {
|
|
211
|
+
if (err || !map.current || zoom === null || zoom === undefined) return;
|
|
212
|
+
|
|
213
|
+
const geometry = features[0].geometry;
|
|
214
|
+
if (geometry.type === 'Point') {
|
|
215
|
+
map.current.easeTo({
|
|
216
|
+
center: geometry.coordinates as [number, number],
|
|
217
|
+
zoom: zoom,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
map.current.on('click', 'unclustered-point', (e) => {
|
|
224
|
+
if (!map.current || !e.features || e.features.length === 0) return;
|
|
225
|
+
|
|
226
|
+
const feature = e.features[0];
|
|
227
|
+
const properties = feature.properties;
|
|
228
|
+
const geometry = feature.geometry;
|
|
229
|
+
|
|
230
|
+
if (geometry.type !== 'Point') return;
|
|
231
|
+
|
|
232
|
+
const coordinates = geometry.coordinates.slice() as [number, number];
|
|
233
|
+
|
|
234
|
+
const inv = inventories.find((i) => i.id === properties?.id);
|
|
235
|
+
if (inv) {
|
|
236
|
+
setActivePopupInventory(inv);
|
|
237
|
+
showPopup(coordinates, inv);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
map.current.on('mouseenter', 'clusters', () => {
|
|
242
|
+
if (map.current) {
|
|
243
|
+
map.current.getCanvas().style.cursor = 'pointer';
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
map.current.on('mouseleave', 'clusters', () => {
|
|
248
|
+
if (map.current) {
|
|
249
|
+
map.current.getCanvas().style.cursor = '';
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
map.current.on('mouseenter', 'unclustered-point', () => {
|
|
254
|
+
if (map.current) {
|
|
255
|
+
map.current.getCanvas().style.cursor = 'pointer';
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
map.current.on('mouseleave', 'unclustered-point', () => {
|
|
260
|
+
if (map.current) {
|
|
261
|
+
map.current.getCanvas().style.cursor = '';
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
setIsMapLoaded(true);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
return () => {
|
|
269
|
+
if (map.current) {
|
|
270
|
+
map.current.remove();
|
|
271
|
+
map.current = null;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}, [defaultCenter, defaultZoom, createGeoJSONSource, inventories]);
|
|
275
|
+
|
|
276
|
+
const showPopup = useCallback((coordinates: [number, number], inv: InventoryItemForMap) => {
|
|
277
|
+
if (!map.current) return;
|
|
278
|
+
|
|
279
|
+
if (popup.current) {
|
|
280
|
+
popup.current.remove();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const isSelected = selectedInventories.includes(inv.id);
|
|
284
|
+
const tags: InventoryTag[] = inv.tags || [];
|
|
285
|
+
const selectText = isSelected ? t('map.legendSelected') : t('map.select');
|
|
286
|
+
const viewDetailsText = t('map.viewDetails');
|
|
287
|
+
|
|
288
|
+
const popupContent = document.createElement('div');
|
|
289
|
+
popupContent.className = 'inventory-popup-content';
|
|
290
|
+
popupContent.innerHTML = `
|
|
291
|
+
<div class="p-3 min-w-[280px] max-w-[320px]">
|
|
292
|
+
<div class="flex gap-3">
|
|
293
|
+
${inv.thumbnail ? `
|
|
294
|
+
<div class="flex-shrink-0">
|
|
295
|
+
<img
|
|
296
|
+
src="${inv.thumbnail}"
|
|
297
|
+
alt="${inv.name}"
|
|
298
|
+
class="w-16 h-16 object-cover rounded-lg border border-gray-200"
|
|
299
|
+
onerror="this.style.display='none'"
|
|
300
|
+
/>
|
|
301
|
+
</div>
|
|
302
|
+
` : `
|
|
303
|
+
<div class="flex-shrink-0 w-16 h-16 bg-gray-100 rounded-lg flex items-center justify-center">
|
|
304
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-gray-400">
|
|
305
|
+
<rect width="20" height="14" x="2" y="3" rx="2"/>
|
|
306
|
+
<line x1="8" x2="16" y1="21" y2="21"/>
|
|
307
|
+
<line x1="12" x2="12" y1="17" y2="21"/>
|
|
308
|
+
</svg>
|
|
309
|
+
</div>
|
|
310
|
+
`}
|
|
311
|
+
<div class="flex-1 min-w-0">
|
|
312
|
+
<h3 class="font-semibold text-sm text-gray-900 truncate">${inv.name}</h3>
|
|
313
|
+
<p class="text-xs text-gray-500 mt-0.5 truncate flex items-center gap-1">
|
|
314
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
315
|
+
<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/>
|
|
316
|
+
<circle cx="12" cy="10" r="3"/>
|
|
317
|
+
</svg>
|
|
318
|
+
${inv.address}
|
|
319
|
+
</p>
|
|
320
|
+
<div class="flex flex-wrap gap-1 mt-2">
|
|
321
|
+
${tags.slice(0, 3).map((tag) => `
|
|
322
|
+
<span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium ${getTagClasses(tag.variant)}">
|
|
323
|
+
${tag.label}
|
|
324
|
+
</span>
|
|
325
|
+
`).join('')}
|
|
326
|
+
${tags.length > 3 ? `<span class="text-[10px] text-gray-400">+${tags.length - 3}</span>` : ''}
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
</div>
|
|
330
|
+
<div class="flex items-center justify-between mt-3 pt-3 border-t border-gray-100">
|
|
331
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
332
|
+
<input
|
|
333
|
+
type="checkbox"
|
|
334
|
+
id="popup-checkbox-${inv.id}"
|
|
335
|
+
${isSelected ? 'checked' : ''}
|
|
336
|
+
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"
|
|
337
|
+
/>
|
|
338
|
+
<span class="text-xs text-gray-600">${selectText}</span>
|
|
339
|
+
</label>
|
|
340
|
+
<button
|
|
341
|
+
id="popup-view-details-${inv.id}"
|
|
342
|
+
class="inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 rounded-md hover:bg-blue-100 transition-colors"
|
|
343
|
+
>
|
|
344
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
345
|
+
<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/>
|
|
346
|
+
<circle cx="12" cy="12" r="3"/>
|
|
347
|
+
</svg>
|
|
348
|
+
${viewDetailsText}
|
|
349
|
+
</button>
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
`;
|
|
353
|
+
|
|
354
|
+
popup.current = new mapboxgl.Popup({
|
|
355
|
+
closeButton: true,
|
|
356
|
+
closeOnClick: false,
|
|
357
|
+
maxWidth: '350px',
|
|
358
|
+
className: 'inventory-map-popup',
|
|
359
|
+
})
|
|
360
|
+
.setLngLat(coordinates)
|
|
361
|
+
.setDOMContent(popupContent)
|
|
362
|
+
.addTo(map.current);
|
|
363
|
+
|
|
364
|
+
setTimeout(() => {
|
|
365
|
+
const checkbox = document.getElementById(`popup-checkbox-${inv.id}`) as HTMLInputElement;
|
|
366
|
+
const viewDetailsBtn = document.getElementById(`popup-view-details-${inv.id}`);
|
|
367
|
+
|
|
368
|
+
if (checkbox) {
|
|
369
|
+
checkbox.addEventListener('change', () => {
|
|
370
|
+
onInventoryToggle(inv.id);
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (viewDetailsBtn) {
|
|
375
|
+
viewDetailsBtn.addEventListener('click', () => {
|
|
376
|
+
if (onViewDetails) {
|
|
377
|
+
onViewDetails(inv);
|
|
378
|
+
} else {
|
|
379
|
+
onSelectInventory(inv.id);
|
|
380
|
+
}
|
|
381
|
+
if (popup.current) {
|
|
382
|
+
popup.current.remove();
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}, 0);
|
|
387
|
+
|
|
388
|
+
popup.current.on('close', () => {
|
|
389
|
+
setActivePopupInventory(null);
|
|
390
|
+
});
|
|
391
|
+
}, [selectedInventories, onInventoryToggle, onSelectInventory, onViewDetails, t]);
|
|
392
|
+
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
initializeMap();
|
|
395
|
+
}, [initializeMap]);
|
|
396
|
+
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
if (!isMapLoaded || !map.current) return;
|
|
399
|
+
|
|
400
|
+
const source = map.current.getSource('inventories') as mapboxgl.GeoJSONSource;
|
|
401
|
+
if (source) {
|
|
402
|
+
source.setData(createGeoJSONSource());
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (activePopupInventory && popup.current) {
|
|
406
|
+
const coords = getInventoryCoordinates(activePopupInventory);
|
|
407
|
+
if (coords) {
|
|
408
|
+
showPopup(coords, activePopupInventory);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}, [inventories, selectedInventories, isMapLoaded, createGeoJSONSource, activePopupInventory, getInventoryCoordinates, showPopup]);
|
|
412
|
+
|
|
413
|
+
useEffect(() => {
|
|
414
|
+
if (!isMapLoaded || !map.current || inventories.length === 0) return;
|
|
415
|
+
|
|
416
|
+
const validInventories = inventories.filter((inv) => getInventoryCoordinates(inv));
|
|
417
|
+
|
|
418
|
+
if (validInventories.length === 0) return;
|
|
419
|
+
|
|
420
|
+
if (validInventories.length === 1) {
|
|
421
|
+
const coords = getInventoryCoordinates(validInventories[0]);
|
|
422
|
+
if (coords) {
|
|
423
|
+
map.current.flyTo({
|
|
424
|
+
center: coords,
|
|
425
|
+
zoom: 14,
|
|
426
|
+
duration: 1000,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
} else {
|
|
430
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
431
|
+
validInventories.forEach((inv) => {
|
|
432
|
+
const coords = getInventoryCoordinates(inv);
|
|
433
|
+
if (coords) {
|
|
434
|
+
bounds.extend(coords);
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
map.current.fitBounds(bounds, {
|
|
439
|
+
padding: 50,
|
|
440
|
+
maxZoom: 15,
|
|
441
|
+
duration: 1000,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}, [isMapLoaded, inventories, getInventoryCoordinates]);
|
|
445
|
+
|
|
446
|
+
const handleZoomIn = () => {
|
|
447
|
+
if (map.current) {
|
|
448
|
+
map.current.zoomIn();
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const handleZoomOut = () => {
|
|
453
|
+
if (map.current) {
|
|
454
|
+
map.current.zoomOut();
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
const handleResetView = () => {
|
|
459
|
+
if (!map.current || inventories.length === 0) return;
|
|
460
|
+
|
|
461
|
+
const validInventories = inventories.filter((inv) => getInventoryCoordinates(inv));
|
|
462
|
+
|
|
463
|
+
if (validInventories.length === 0) {
|
|
464
|
+
map.current.flyTo({
|
|
465
|
+
center: defaultCenter,
|
|
466
|
+
zoom: defaultZoom,
|
|
467
|
+
duration: 1000,
|
|
468
|
+
});
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
473
|
+
validInventories.forEach((inv) => {
|
|
474
|
+
const coords = getInventoryCoordinates(inv);
|
|
475
|
+
if (coords) {
|
|
476
|
+
bounds.extend(coords);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
map.current.fitBounds(bounds, {
|
|
481
|
+
padding: 50,
|
|
482
|
+
maxZoom: 15,
|
|
483
|
+
duration: 1000,
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
return (
|
|
488
|
+
<div className={cn('relative w-full h-full rounded-lg overflow-hidden border border-gray-200', className)}>
|
|
489
|
+
<div ref={mapContainer} className="w-full h-full min-h-[400px]" />
|
|
490
|
+
|
|
491
|
+
<div className="absolute bottom-4 right-4 flex flex-col gap-1">
|
|
492
|
+
<Button
|
|
493
|
+
variant="outline"
|
|
494
|
+
size="sm"
|
|
495
|
+
isIconOnly
|
|
496
|
+
onClick={handleZoomIn}
|
|
497
|
+
title={t('map.zoomIn')}
|
|
498
|
+
>
|
|
499
|
+
<Plus className="h-4 w-4 text-gray-700" />
|
|
500
|
+
</Button>
|
|
501
|
+
<Button
|
|
502
|
+
variant="outline"
|
|
503
|
+
size="sm"
|
|
504
|
+
isIconOnly
|
|
505
|
+
onClick={handleZoomOut}
|
|
506
|
+
title={t('map.zoomOut')}
|
|
507
|
+
>
|
|
508
|
+
<Minus className="h-4 w-4 text-gray-700" />
|
|
509
|
+
</Button>
|
|
510
|
+
<Button
|
|
511
|
+
variant="outline"
|
|
512
|
+
size="sm"
|
|
513
|
+
isIconOnly
|
|
514
|
+
onClick={handleResetView}
|
|
515
|
+
title={t('map.resetView')}
|
|
516
|
+
>
|
|
517
|
+
<Maximize2 className="h-4 w-4 text-gray-700" />
|
|
518
|
+
</Button>
|
|
519
|
+
</div>
|
|
520
|
+
|
|
521
|
+
<div className="absolute top-4 left-4 bg-white/90 backdrop-blur-sm rounded-lg px-3 py-2 shadow-md border border-gray-200">
|
|
522
|
+
<div className="flex items-center gap-2 text-sm">
|
|
523
|
+
<MapPin className="h-4 w-4 text-blue-600" />
|
|
524
|
+
<span className="font-medium text-gray-700">
|
|
525
|
+
{inventories.filter((inv) => getInventoryCoordinates(inv)).length} {t('map.locations')}
|
|
526
|
+
</span>
|
|
527
|
+
{selectedInventories.length > 0 && (
|
|
528
|
+
<span className="text-gray-500">
|
|
529
|
+
({selectedInventories.length} {t('map.selected')})
|
|
530
|
+
</span>
|
|
531
|
+
)}
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
|
|
535
|
+
<div className="absolute bottom-4 left-4 bg-white/90 backdrop-blur-sm rounded-lg px-3 py-2 shadow-md border border-gray-200">
|
|
536
|
+
<div className="flex items-center gap-4 text-xs">
|
|
537
|
+
<div className="flex items-center gap-1.5">
|
|
538
|
+
<div className="w-3 h-3 rounded-full bg-blue-600 border-2 border-white shadow-sm" />
|
|
539
|
+
<span className="text-gray-600">{t('map.legendAvailable')}</span>
|
|
540
|
+
</div>
|
|
541
|
+
<div className="flex items-center gap-1.5">
|
|
542
|
+
<div className="w-3 h-3 rounded-full bg-green-500 border-2 border-white shadow-sm" />
|
|
543
|
+
<span className="text-gray-600">{t('map.legendSelected')}</span>
|
|
544
|
+
</div>
|
|
545
|
+
<div className="flex items-center gap-1.5">
|
|
546
|
+
<div className="w-5 h-5 rounded-full bg-blue-600 border-2 border-white shadow-sm flex items-center justify-center">
|
|
547
|
+
<span className="text-[8px] text-white font-bold">5+</span>
|
|
548
|
+
</div>
|
|
549
|
+
<span className="text-gray-600">{t('map.legendCluster')}</span>
|
|
550
|
+
</div>
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
|
|
554
|
+
<style>{`
|
|
555
|
+
.inventory-map-popup .mapboxgl-popup-content {
|
|
556
|
+
padding: 0;
|
|
557
|
+
border-radius: 12px;
|
|
558
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
|
|
559
|
+
}
|
|
560
|
+
.inventory-map-popup .mapboxgl-popup-close-button {
|
|
561
|
+
font-size: 18px;
|
|
562
|
+
padding: 4px 8px;
|
|
563
|
+
color: #6b7280;
|
|
564
|
+
}
|
|
565
|
+
.inventory-map-popup .mapboxgl-popup-close-button:hover {
|
|
566
|
+
background-color: #f3f4f6;
|
|
567
|
+
color: #374151;
|
|
568
|
+
}
|
|
569
|
+
.inventory-map-popup .mapboxgl-popup-tip {
|
|
570
|
+
border-top-color: white;
|
|
571
|
+
}
|
|
572
|
+
`}</style>
|
|
573
|
+
</div>
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function getTagClasses(variant: InventoryTag['variant']): string {
|
|
578
|
+
switch (variant) {
|
|
579
|
+
case 'primary':
|
|
580
|
+
return 'bg-blue-100 text-blue-700';
|
|
581
|
+
case 'secondary':
|
|
582
|
+
return 'bg-gray-100 text-gray-700';
|
|
583
|
+
case 'success':
|
|
584
|
+
return 'bg-green-100 text-green-700';
|
|
585
|
+
case 'warning':
|
|
586
|
+
return 'bg-amber-100 text-amber-700';
|
|
587
|
+
case 'error':
|
|
588
|
+
return 'bg-red-100 text-red-700';
|
|
589
|
+
case 'outline':
|
|
590
|
+
return 'bg-white text-gray-700 border border-gray-300';
|
|
591
|
+
default:
|
|
592
|
+
return 'bg-gray-100 text-gray-700';
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export default InventoryMapView;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useTranslation } from "@/lib/i18n";
|
|
2
|
+
import { Settings, Map, Calendar, Upload } from "lucide-react";
|
|
3
|
+
import {
|
|
4
|
+
DropdownMenu,
|
|
5
|
+
DropdownMenuContent,
|
|
6
|
+
DropdownMenuItem,
|
|
7
|
+
DropdownMenuTrigger,
|
|
8
|
+
Button,
|
|
9
|
+
} from "@moving-walls/design-system";
|
|
10
|
+
|
|
11
|
+
interface InventorySettingsMenuProps {
|
|
12
|
+
onMapViewClick?: () => void;
|
|
13
|
+
onAvailabilityClick?: () => void;
|
|
14
|
+
onUploadCSVClick?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function InventorySettingsMenu({
|
|
18
|
+
onMapViewClick,
|
|
19
|
+
onAvailabilityClick,
|
|
20
|
+
onUploadCSVClick,
|
|
21
|
+
}: InventorySettingsMenuProps) {
|
|
22
|
+
const { t } = useTranslation('inventory');
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<DropdownMenu>
|
|
26
|
+
<DropdownMenuTrigger asChild>
|
|
27
|
+
<Button
|
|
28
|
+
variant="outline"
|
|
29
|
+
size="sm"
|
|
30
|
+
isIconOnly
|
|
31
|
+
title={t('settings.title')}
|
|
32
|
+
>
|
|
33
|
+
<Settings className="h-4 w-4 text-mw-neutral-500" />
|
|
34
|
+
</Button>
|
|
35
|
+
</DropdownMenuTrigger>
|
|
36
|
+
<DropdownMenuContent align="end" className="w-56">
|
|
37
|
+
<DropdownMenuItem onClick={onMapViewClick} className="cursor-pointer">
|
|
38
|
+
<Map className="h-4 w-4 mr-2" />
|
|
39
|
+
<span>{t('settings.mapView')}</span>
|
|
40
|
+
</DropdownMenuItem>
|
|
41
|
+
<DropdownMenuItem onClick={onAvailabilityClick} className="cursor-pointer">
|
|
42
|
+
<Calendar className="h-4 w-4 mr-2" />
|
|
43
|
+
<span>{t('settings.availability')}</span>
|
|
44
|
+
</DropdownMenuItem>
|
|
45
|
+
<DropdownMenuItem onClick={onUploadCSVClick} className="cursor-pointer">
|
|
46
|
+
<Upload className="h-4 w-4 mr-2" />
|
|
47
|
+
<span>{t('settings.uploadCsv')}</span>
|
|
48
|
+
</DropdownMenuItem>
|
|
49
|
+
</DropdownMenuContent>
|
|
50
|
+
</DropdownMenu>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useTranslation } from '@/lib/i18n';
|
|
2
|
+
import {
|
|
3
|
+
DropdownMenu,
|
|
4
|
+
DropdownMenuContent,
|
|
5
|
+
DropdownMenuItem,
|
|
6
|
+
DropdownMenuTrigger,
|
|
7
|
+
} from '@moving-walls/design-system';
|
|
8
|
+
import { supportedLanguages, changeLanguage, type SupportedLanguage } from '@/lib/i18n';
|
|
9
|
+
|
|
10
|
+
export function LanguageSwitcher() {
|
|
11
|
+
const { t, i18n } = useTranslation('common');
|
|
12
|
+
const currentLanguage = i18n.language as SupportedLanguage;
|
|
13
|
+
|
|
14
|
+
const currentLangInfo = supportedLanguages.find(
|
|
15
|
+
(lang) => lang.code === currentLanguage
|
|
16
|
+
) || supportedLanguages[0];
|
|
17
|
+
|
|
18
|
+
const handleLanguageChange = async (langCode: SupportedLanguage) => {
|
|
19
|
+
await changeLanguage(langCode);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<DropdownMenu>
|
|
24
|
+
<DropdownMenuTrigger asChild>
|
|
25
|
+
<button
|
|
26
|
+
className="inline-flex items-center gap-2 px-3 py-2 text-sm font-medium border-none bg-transparent hover:bg-mw-neutral-50 dark:hover:bg-mw-neutral-800 focus:outline-none"
|
|
27
|
+
aria-label={t('accessibility.selectLanguage')}
|
|
28
|
+
>
|
|
29
|
+
<span id="current-language" className="hidden sm:inline">{currentLangInfo.shortName}</span>
|
|
30
|
+
</button>
|
|
31
|
+
</DropdownMenuTrigger>
|
|
32
|
+
<DropdownMenuContent
|
|
33
|
+
align="end"
|
|
34
|
+
className="w-40 p-1 z-[100] bg-white shadow-lg border border-mw-neutral-200 rounded-lg"
|
|
35
|
+
>
|
|
36
|
+
{supportedLanguages.map((lang) => (
|
|
37
|
+
<DropdownMenuItem
|
|
38
|
+
key={lang.code}
|
|
39
|
+
onClick={() => handleLanguageChange(lang.code)}
|
|
40
|
+
className={`flex items-center gap-2 px-3 py-2 text-sm rounded cursor-pointer transition-colors ${
|
|
41
|
+
currentLanguage === lang.code
|
|
42
|
+
? 'bg-mw-primary-50 text-mw-primary-700 font-medium'
|
|
43
|
+
: 'text-mw-neutral-700 hover:bg-mw-neutral-50'
|
|
44
|
+
}`}
|
|
45
|
+
aria-current={currentLanguage === lang.code ? 'true' : undefined}
|
|
46
|
+
>
|
|
47
|
+
<span dir={lang.dir}>{lang.shortName}</span>
|
|
48
|
+
</DropdownMenuItem>
|
|
49
|
+
))}
|
|
50
|
+
</DropdownMenuContent>
|
|
51
|
+
</DropdownMenu>
|
|
52
|
+
);
|
|
53
|
+
}
|