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,995 @@
|
|
|
1
|
+
import { useState, useMemo } from "react";
|
|
2
|
+
import { useQuery, useMutation } from "@tanstack/react-query";
|
|
3
|
+
import { PageHeader } from "@/components/page-header";
|
|
4
|
+
import { Button } from "@/components/ui/button";
|
|
5
|
+
import { Input } from "@/components/ui/input";
|
|
6
|
+
import { Card } from "@/components/ui/card";
|
|
7
|
+
import { Badge } from "@/components/ui/badge";
|
|
8
|
+
import {
|
|
9
|
+
DropdownMenu,
|
|
10
|
+
DropdownMenuContent,
|
|
11
|
+
DropdownMenuItem,
|
|
12
|
+
DropdownMenuTrigger,
|
|
13
|
+
} from "@/components/ui/dropdown-menu";
|
|
14
|
+
import {
|
|
15
|
+
Sheet,
|
|
16
|
+
SheetContent,
|
|
17
|
+
SheetHeader,
|
|
18
|
+
SheetTitle,
|
|
19
|
+
} from "@/components/ui/sheet";
|
|
20
|
+
import {
|
|
21
|
+
Dialog,
|
|
22
|
+
DialogContent,
|
|
23
|
+
DialogHeader,
|
|
24
|
+
DialogTitle,
|
|
25
|
+
DialogFooter,
|
|
26
|
+
} from "@/components/ui/dialog";
|
|
27
|
+
import { Label } from "@/components/ui/label";
|
|
28
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
29
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
30
|
+
import { DataTable } from "@/components/data-table";
|
|
31
|
+
import { FilterDrawer, FilterField, FilterValues } from "@/components/filter-drawer";
|
|
32
|
+
import {
|
|
33
|
+
FolderPlus,
|
|
34
|
+
Upload,
|
|
35
|
+
Search,
|
|
36
|
+
Grid3X3,
|
|
37
|
+
List,
|
|
38
|
+
MoreVertical,
|
|
39
|
+
Eye,
|
|
40
|
+
Download,
|
|
41
|
+
Shuffle,
|
|
42
|
+
Trash2,
|
|
43
|
+
X,
|
|
44
|
+
Plus,
|
|
45
|
+
Image,
|
|
46
|
+
Video,
|
|
47
|
+
Code,
|
|
48
|
+
FileText,
|
|
49
|
+
Check,
|
|
50
|
+
AlertCircle,
|
|
51
|
+
Filter,
|
|
52
|
+
} from "lucide-react";
|
|
53
|
+
import { queryClient, apiRequest } from "@/lib/queryClient";
|
|
54
|
+
import { useToast } from "@/hooks/use-toast";
|
|
55
|
+
import type { Creative, CreativeFolder } from "@shared/schema";
|
|
56
|
+
|
|
57
|
+
const STATUS_COLORS: Record<string, { variant: "default" | "secondary" | "destructive" | "outline"; className: string }> = {
|
|
58
|
+
new: { variant: "default", className: "bg-blue-500 hover:bg-blue-500" },
|
|
59
|
+
processing: { variant: "default", className: "bg-yellow-500 hover:bg-yellow-500" },
|
|
60
|
+
accepted: { variant: "default", className: "bg-green-500 hover:bg-green-500" },
|
|
61
|
+
inadequate: { variant: "destructive", className: "" },
|
|
62
|
+
archived: { variant: "secondary", className: "" },
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const TYPE_COLORS: Record<string, string> = {
|
|
66
|
+
display: "bg-purple-100 dark:bg-purple-900",
|
|
67
|
+
video: "bg-red-100 dark:bg-red-900",
|
|
68
|
+
html: "bg-orange-100 dark:bg-orange-900",
|
|
69
|
+
native: "bg-teal-100 dark:bg-teal-900",
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const TYPE_ICONS: Record<string, typeof Image> = {
|
|
73
|
+
display: Image,
|
|
74
|
+
video: Video,
|
|
75
|
+
html: Code,
|
|
76
|
+
native: FileText,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const STATUS_OPTIONS = [
|
|
80
|
+
{ value: "new", label: "New" },
|
|
81
|
+
{ value: "processing", label: "Processing" },
|
|
82
|
+
{ value: "accepted", label: "Accepted" },
|
|
83
|
+
{ value: "inadequate", label: "Inadequate" },
|
|
84
|
+
{ value: "archived", label: "Archived" },
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const TYPE_OPTIONS = [
|
|
88
|
+
{ value: "display", label: "Display" },
|
|
89
|
+
{ value: "video", label: "Video" },
|
|
90
|
+
{ value: "html", label: "HTML" },
|
|
91
|
+
{ value: "native", label: "Native" },
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const initialFilterValues: FilterValues = {
|
|
95
|
+
status: [],
|
|
96
|
+
type: [],
|
|
97
|
+
folder: [],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
function formatFileSize(bytes: number): string {
|
|
101
|
+
if (bytes < 1024) return bytes + " B";
|
|
102
|
+
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + " KB";
|
|
103
|
+
return (bytes / (1024 * 1024)).toFixed(1) + " MB";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function formatDate(dateStr: string | null): string {
|
|
107
|
+
if (!dateStr) return "N/A";
|
|
108
|
+
return new Date(dateStr).toLocaleDateString();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default function ContentHub() {
|
|
112
|
+
const { toast } = useToast();
|
|
113
|
+
const [viewMode, setViewMode] = useState<"grid" | "list">("grid");
|
|
114
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
115
|
+
const [sortBy, setSortBy] = useState<string>("name");
|
|
116
|
+
const [sortOrder, setSortOrder] = useState<"asc" | "desc">("asc");
|
|
117
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
118
|
+
const [filterValues, setFilterValues] = useState<FilterValues>(initialFilterValues);
|
|
119
|
+
const [appliedFilters, setAppliedFilters] = useState<FilterValues>(initialFilterValues);
|
|
120
|
+
const [selectedCreative, setSelectedCreative] = useState<Creative | null>(null);
|
|
121
|
+
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
|
122
|
+
const [isNewFolderDialogOpen, setIsNewFolderDialogOpen] = useState(false);
|
|
123
|
+
const [isUploadDialogOpen, setIsUploadDialogOpen] = useState(false);
|
|
124
|
+
const [newFolderName, setNewFolderName] = useState("");
|
|
125
|
+
const [newTag, setNewTag] = useState("");
|
|
126
|
+
const [inadequateReason, setInadequateReason] = useState("");
|
|
127
|
+
const [showInadequateInput, setShowInadequateInput] = useState(false);
|
|
128
|
+
|
|
129
|
+
const { data: creatives = [], isLoading: creativesLoading } = useQuery<Creative[]>({
|
|
130
|
+
queryKey: ["/api/creatives"],
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const { data: folders = [], isLoading: foldersLoading } = useQuery<CreativeFolder[]>({
|
|
134
|
+
queryKey: ["/api/creative-folders"],
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const { data: creativeSpecs } = useQuery<Record<string, {
|
|
138
|
+
formats: string[];
|
|
139
|
+
maxFileSize: string;
|
|
140
|
+
maxFileSizeBytes: number;
|
|
141
|
+
dimensions: Array<{ width: number; height: number; label: string }>;
|
|
142
|
+
maxDuration?: number;
|
|
143
|
+
notes: string[];
|
|
144
|
+
}>>({
|
|
145
|
+
queryKey: ["/api/creative-specs"],
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const folderOptions = useMemo(() =>
|
|
149
|
+
folders.map(f => ({ value: f.id, label: f.name })),
|
|
150
|
+
[folders]
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const filterFields: FilterField[] = [
|
|
154
|
+
{
|
|
155
|
+
key: "status",
|
|
156
|
+
label: "Status",
|
|
157
|
+
type: "multi-select",
|
|
158
|
+
options: STATUS_OPTIONS,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
key: "type",
|
|
162
|
+
label: "Type",
|
|
163
|
+
type: "multi-select",
|
|
164
|
+
options: TYPE_OPTIONS,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: "folder",
|
|
168
|
+
label: "Folder",
|
|
169
|
+
type: "multi-select",
|
|
170
|
+
options: folderOptions,
|
|
171
|
+
},
|
|
172
|
+
];
|
|
173
|
+
|
|
174
|
+
const createFolderMutation = useMutation({
|
|
175
|
+
mutationFn: async (name: string) => {
|
|
176
|
+
return apiRequest("POST", "/api/creative-folders", { name });
|
|
177
|
+
},
|
|
178
|
+
onSuccess: () => {
|
|
179
|
+
queryClient.invalidateQueries({ queryKey: ["/api/creative-folders"] });
|
|
180
|
+
setIsNewFolderDialogOpen(false);
|
|
181
|
+
setNewFolderName("");
|
|
182
|
+
toast({ title: "Folder created successfully" });
|
|
183
|
+
},
|
|
184
|
+
onError: () => {
|
|
185
|
+
toast({ title: "Failed to create folder", variant: "destructive" });
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const updateCreativeMutation = useMutation({
|
|
190
|
+
mutationFn: async ({ id, data }: { id: string; data: Partial<Creative> }) => {
|
|
191
|
+
return apiRequest("PATCH", `/api/creatives/${id}`, data);
|
|
192
|
+
},
|
|
193
|
+
onSuccess: () => {
|
|
194
|
+
queryClient.invalidateQueries({ queryKey: ["/api/creatives"] });
|
|
195
|
+
toast({ title: "Creative updated successfully" });
|
|
196
|
+
},
|
|
197
|
+
onError: () => {
|
|
198
|
+
toast({ title: "Failed to update creative", variant: "destructive" });
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const deleteCreativeMutation = useMutation({
|
|
203
|
+
mutationFn: async (id: string) => {
|
|
204
|
+
return apiRequest("DELETE", `/api/creatives/${id}`);
|
|
205
|
+
},
|
|
206
|
+
onSuccess: () => {
|
|
207
|
+
queryClient.invalidateQueries({ queryKey: ["/api/creatives"] });
|
|
208
|
+
setIsPreviewOpen(false);
|
|
209
|
+
setSelectedCreative(null);
|
|
210
|
+
toast({ title: "Creative deleted successfully" });
|
|
211
|
+
},
|
|
212
|
+
onError: () => {
|
|
213
|
+
toast({ title: "Failed to delete creative", variant: "destructive" });
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const handleApplyFilters = () => {
|
|
218
|
+
setAppliedFilters(filterValues);
|
|
219
|
+
setFilterOpen(false);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const handleClearFilters = () => {
|
|
223
|
+
setFilterValues(initialFilterValues);
|
|
224
|
+
setAppliedFilters(initialFilterValues);
|
|
225
|
+
setFilterOpen(false);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const activeFilterCount = useMemo(() => {
|
|
229
|
+
let count = 0;
|
|
230
|
+
const statuses = appliedFilters.status as string[];
|
|
231
|
+
const types = appliedFilters.type as string[];
|
|
232
|
+
const folderIds = appliedFilters.folder as string[];
|
|
233
|
+
if (statuses?.length > 0) count++;
|
|
234
|
+
if (types?.length > 0) count++;
|
|
235
|
+
if (folderIds?.length > 0) count++;
|
|
236
|
+
return count;
|
|
237
|
+
}, [appliedFilters]);
|
|
238
|
+
|
|
239
|
+
const handleSort = (key: string) => {
|
|
240
|
+
if (sortBy === key) {
|
|
241
|
+
setSortOrder(sortOrder === "asc" ? "desc" : "asc");
|
|
242
|
+
} else {
|
|
243
|
+
setSortBy(key);
|
|
244
|
+
setSortOrder("asc");
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const filteredCreatives = useMemo(() => {
|
|
249
|
+
let result = creatives || [];
|
|
250
|
+
|
|
251
|
+
if (searchQuery) {
|
|
252
|
+
result = result.filter((c) =>
|
|
253
|
+
c.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const statuses = appliedFilters.status as string[];
|
|
258
|
+
if (statuses?.length > 0) {
|
|
259
|
+
result = result.filter((c) => statuses.includes(c.status));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const types = appliedFilters.type as string[];
|
|
263
|
+
if (types?.length > 0) {
|
|
264
|
+
result = result.filter((c) => types.includes(c.type));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const folderIds = appliedFilters.folder as string[];
|
|
268
|
+
if (folderIds?.length > 0) {
|
|
269
|
+
result = result.filter((c) => c.folderId && folderIds.includes(c.folderId));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
result = [...result].sort((a, b) => {
|
|
273
|
+
let comparison = 0;
|
|
274
|
+
switch (sortBy) {
|
|
275
|
+
case "name":
|
|
276
|
+
comparison = a.name.localeCompare(b.name);
|
|
277
|
+
break;
|
|
278
|
+
case "type":
|
|
279
|
+
comparison = a.type.localeCompare(b.type);
|
|
280
|
+
break;
|
|
281
|
+
case "status":
|
|
282
|
+
comparison = a.status.localeCompare(b.status);
|
|
283
|
+
break;
|
|
284
|
+
case "fileSize":
|
|
285
|
+
comparison = a.fileSize - b.fileSize;
|
|
286
|
+
break;
|
|
287
|
+
case "uploadedAt":
|
|
288
|
+
const dateA = a.uploadedAt ? new Date(a.uploadedAt).getTime() : 0;
|
|
289
|
+
const dateB = b.uploadedAt ? new Date(b.uploadedAt).getTime() : 0;
|
|
290
|
+
comparison = dateA - dateB;
|
|
291
|
+
break;
|
|
292
|
+
default:
|
|
293
|
+
comparison = 0;
|
|
294
|
+
}
|
|
295
|
+
return sortOrder === "asc" ? comparison : -comparison;
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
return result;
|
|
299
|
+
}, [creatives, searchQuery, appliedFilters, sortBy, sortOrder]);
|
|
300
|
+
|
|
301
|
+
const handleOpenPreview = (creative: Creative) => {
|
|
302
|
+
setSelectedCreative(creative);
|
|
303
|
+
setIsPreviewOpen(true);
|
|
304
|
+
setShowInadequateInput(false);
|
|
305
|
+
setInadequateReason("");
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const handleAddTag = () => {
|
|
309
|
+
if (!selectedCreative || !newTag.trim()) return;
|
|
310
|
+
const currentTags = selectedCreative.tags || [];
|
|
311
|
+
if (currentTags.includes(newTag.trim())) {
|
|
312
|
+
toast({ title: "Tag already exists", variant: "destructive" });
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
updateCreativeMutation.mutate({
|
|
316
|
+
id: selectedCreative.id,
|
|
317
|
+
data: { tags: [...currentTags, newTag.trim()] },
|
|
318
|
+
});
|
|
319
|
+
setSelectedCreative({ ...selectedCreative, tags: [...currentTags, newTag.trim()] });
|
|
320
|
+
setNewTag("");
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
const handleRemoveTag = (tag: string) => {
|
|
324
|
+
if (!selectedCreative) return;
|
|
325
|
+
const currentTags = selectedCreative.tags || [];
|
|
326
|
+
const newTags = currentTags.filter((t) => t !== tag);
|
|
327
|
+
updateCreativeMutation.mutate({
|
|
328
|
+
id: selectedCreative.id,
|
|
329
|
+
data: { tags: newTags },
|
|
330
|
+
});
|
|
331
|
+
setSelectedCreative({ ...selectedCreative, tags: newTags });
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const handleAcceptCreative = () => {
|
|
335
|
+
if (!selectedCreative) return;
|
|
336
|
+
updateCreativeMutation.mutate({
|
|
337
|
+
id: selectedCreative.id,
|
|
338
|
+
data: { status: "accepted", inadequateReason: null },
|
|
339
|
+
});
|
|
340
|
+
setSelectedCreative({ ...selectedCreative, status: "accepted", inadequateReason: null });
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const handleMarkInadequate = () => {
|
|
344
|
+
if (!selectedCreative || !inadequateReason.trim()) return;
|
|
345
|
+
updateCreativeMutation.mutate({
|
|
346
|
+
id: selectedCreative.id,
|
|
347
|
+
data: { status: "inadequate", inadequateReason: inadequateReason.trim() },
|
|
348
|
+
});
|
|
349
|
+
setSelectedCreative({ ...selectedCreative, status: "inadequate", inadequateReason: inadequateReason.trim() });
|
|
350
|
+
setShowInadequateInput(false);
|
|
351
|
+
setInadequateReason("");
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const StatusBadgeComp = ({ status }: { status: string }) => {
|
|
355
|
+
const config = STATUS_COLORS[status] || STATUS_COLORS.new;
|
|
356
|
+
return (
|
|
357
|
+
<Badge variant={config.variant} className={config.className} data-testid={`badge-status-${status}`}>
|
|
358
|
+
{status.charAt(0).toUpperCase() + status.slice(1)}
|
|
359
|
+
</Badge>
|
|
360
|
+
);
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const columns = [
|
|
364
|
+
{
|
|
365
|
+
key: "name",
|
|
366
|
+
header: "Name",
|
|
367
|
+
sortable: true,
|
|
368
|
+
render: (creative: Creative) => (
|
|
369
|
+
<div className="flex items-center gap-3">
|
|
370
|
+
<div className={`w-10 h-10 rounded flex items-center justify-center ${TYPE_COLORS[creative.type] || "bg-muted"}`}>
|
|
371
|
+
{(() => {
|
|
372
|
+
const TypeIcon = TYPE_ICONS[creative.type] || Image;
|
|
373
|
+
return <TypeIcon className="h-5 w-5 text-muted-foreground/50" />;
|
|
374
|
+
})()}
|
|
375
|
+
</div>
|
|
376
|
+
<span className="font-medium">{creative.name}</span>
|
|
377
|
+
</div>
|
|
378
|
+
),
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
key: "type",
|
|
382
|
+
header: "Type",
|
|
383
|
+
sortable: true,
|
|
384
|
+
render: (creative: Creative) => (
|
|
385
|
+
<span className="capitalize">{creative.type}</span>
|
|
386
|
+
),
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
key: "status",
|
|
390
|
+
header: "Status",
|
|
391
|
+
sortable: true,
|
|
392
|
+
render: (creative: Creative) => <StatusBadgeComp status={creative.status} />,
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
key: "dimensions",
|
|
396
|
+
header: "Dimensions",
|
|
397
|
+
sortable: false,
|
|
398
|
+
render: (creative: Creative) => `${creative.width}x${creative.height}`,
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
key: "fileSize",
|
|
402
|
+
header: "Size",
|
|
403
|
+
sortable: true,
|
|
404
|
+
render: (creative: Creative) => formatFileSize(creative.fileSize),
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
key: "uploadedAt",
|
|
408
|
+
header: "Uploaded",
|
|
409
|
+
sortable: true,
|
|
410
|
+
render: (creative: Creative) => formatDate(creative.uploadedAt),
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
key: "actions",
|
|
414
|
+
header: "",
|
|
415
|
+
sortable: false,
|
|
416
|
+
className: "w-12",
|
|
417
|
+
render: (creative: Creative) => (
|
|
418
|
+
<DropdownMenu>
|
|
419
|
+
<DropdownMenuTrigger asChild>
|
|
420
|
+
<Button size="icon" variant="ghost" data-testid={`button-menu-${creative.id}`}>
|
|
421
|
+
<MoreVertical className="h-4 w-4" />
|
|
422
|
+
</Button>
|
|
423
|
+
</DropdownMenuTrigger>
|
|
424
|
+
<DropdownMenuContent align="end">
|
|
425
|
+
<DropdownMenuItem onClick={() => handleOpenPreview(creative)} data-testid="menu-item-preview">
|
|
426
|
+
<Eye className="h-4 w-4 mr-2" />
|
|
427
|
+
Preview
|
|
428
|
+
</DropdownMenuItem>
|
|
429
|
+
<DropdownMenuItem data-testid="menu-item-download">
|
|
430
|
+
<Download className="h-4 w-4 mr-2" />
|
|
431
|
+
Download
|
|
432
|
+
</DropdownMenuItem>
|
|
433
|
+
<DropdownMenuItem data-testid="menu-item-transcode">
|
|
434
|
+
<Shuffle className="h-4 w-4 mr-2" />
|
|
435
|
+
Transcode
|
|
436
|
+
</DropdownMenuItem>
|
|
437
|
+
<DropdownMenuItem
|
|
438
|
+
className="text-destructive"
|
|
439
|
+
onClick={() => deleteCreativeMutation.mutate(creative.id)}
|
|
440
|
+
data-testid="menu-item-delete"
|
|
441
|
+
>
|
|
442
|
+
<Trash2 className="h-4 w-4 mr-2" />
|
|
443
|
+
Delete
|
|
444
|
+
</DropdownMenuItem>
|
|
445
|
+
</DropdownMenuContent>
|
|
446
|
+
</DropdownMenu>
|
|
447
|
+
),
|
|
448
|
+
},
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
const CreativeCard = ({ creative }: { creative: Creative }) => {
|
|
452
|
+
const TypeIcon = TYPE_ICONS[creative.type] || Image;
|
|
453
|
+
|
|
454
|
+
return (
|
|
455
|
+
<Card
|
|
456
|
+
className="relative overflow-visible cursor-pointer hover-elevate"
|
|
457
|
+
onClick={() => handleOpenPreview(creative)}
|
|
458
|
+
data-testid={`card-creative-${creative.id}`}
|
|
459
|
+
>
|
|
460
|
+
<div className={`aspect-video flex items-center justify-center ${TYPE_COLORS[creative.type] || "bg-muted"}`}>
|
|
461
|
+
<TypeIcon className="h-12 w-12 text-muted-foreground/50" />
|
|
462
|
+
</div>
|
|
463
|
+
|
|
464
|
+
<div className="absolute top-2 right-2">
|
|
465
|
+
<StatusBadgeComp status={creative.status} />
|
|
466
|
+
</div>
|
|
467
|
+
|
|
468
|
+
<div className="absolute top-2 left-2" onClick={(e) => e.stopPropagation()}>
|
|
469
|
+
<DropdownMenu>
|
|
470
|
+
<DropdownMenuTrigger asChild>
|
|
471
|
+
<Button size="icon" variant="secondary" className="h-7 w-7" data-testid={`button-menu-${creative.id}`}>
|
|
472
|
+
<MoreVertical className="h-4 w-4" />
|
|
473
|
+
</Button>
|
|
474
|
+
</DropdownMenuTrigger>
|
|
475
|
+
<DropdownMenuContent align="start">
|
|
476
|
+
<DropdownMenuItem onClick={() => handleOpenPreview(creative)} data-testid="menu-item-preview">
|
|
477
|
+
<Eye className="h-4 w-4 mr-2" />
|
|
478
|
+
Preview
|
|
479
|
+
</DropdownMenuItem>
|
|
480
|
+
<DropdownMenuItem data-testid="menu-item-download">
|
|
481
|
+
<Download className="h-4 w-4 mr-2" />
|
|
482
|
+
Download
|
|
483
|
+
</DropdownMenuItem>
|
|
484
|
+
<DropdownMenuItem data-testid="menu-item-transcode">
|
|
485
|
+
<Shuffle className="h-4 w-4 mr-2" />
|
|
486
|
+
Transcode
|
|
487
|
+
</DropdownMenuItem>
|
|
488
|
+
<DropdownMenuItem
|
|
489
|
+
className="text-destructive"
|
|
490
|
+
onClick={() => deleteCreativeMutation.mutate(creative.id)}
|
|
491
|
+
data-testid="menu-item-delete"
|
|
492
|
+
>
|
|
493
|
+
<Trash2 className="h-4 w-4 mr-2" />
|
|
494
|
+
Delete
|
|
495
|
+
</DropdownMenuItem>
|
|
496
|
+
</DropdownMenuContent>
|
|
497
|
+
</DropdownMenu>
|
|
498
|
+
</div>
|
|
499
|
+
|
|
500
|
+
<div className="p-3 space-y-2">
|
|
501
|
+
<h3 className="font-medium text-sm truncate" title={creative.name}>
|
|
502
|
+
{creative.name}
|
|
503
|
+
</h3>
|
|
504
|
+
<div className="flex items-center gap-2 text-xs text-muted-foreground">
|
|
505
|
+
<span>{creative.format}</span>
|
|
506
|
+
<span>•</span>
|
|
507
|
+
<span>{creative.width}x{creative.height}</span>
|
|
508
|
+
</div>
|
|
509
|
+
{creative.tags && creative.tags.length > 0 && (
|
|
510
|
+
<div className="flex flex-wrap gap-1">
|
|
511
|
+
{creative.tags.slice(0, 3).map((tag) => (
|
|
512
|
+
<Badge key={tag} variant="outline" className="text-xs" data-testid={`badge-tag-${tag}`}>
|
|
513
|
+
{tag}
|
|
514
|
+
</Badge>
|
|
515
|
+
))}
|
|
516
|
+
{creative.tags.length > 3 && (
|
|
517
|
+
<Badge variant="outline" className="text-xs">
|
|
518
|
+
+{creative.tags.length - 3}
|
|
519
|
+
</Badge>
|
|
520
|
+
)}
|
|
521
|
+
</div>
|
|
522
|
+
)}
|
|
523
|
+
<div className="flex items-center justify-between text-xs text-muted-foreground pt-1">
|
|
524
|
+
<span>{formatFileSize(creative.fileSize)}</span>
|
|
525
|
+
<span>{formatDate(creative.uploadedAt)}</span>
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
</Card>
|
|
529
|
+
);
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
return (
|
|
533
|
+
<div className="p-6 space-y-6">
|
|
534
|
+
<PageHeader
|
|
535
|
+
title="Content Hub"
|
|
536
|
+
description="Manage and organize your advertising creatives"
|
|
537
|
+
actions={
|
|
538
|
+
<>
|
|
539
|
+
<Button variant="outline" onClick={() => setIsNewFolderDialogOpen(true)} data-testid="button-new-folder">
|
|
540
|
+
<FolderPlus className="h-4 w-4 mr-2" />
|
|
541
|
+
New Folder
|
|
542
|
+
</Button>
|
|
543
|
+
<Button onClick={() => setIsUploadDialogOpen(true)} data-testid="button-upload-creatives">
|
|
544
|
+
<Upload className="h-4 w-4 mr-2" />
|
|
545
|
+
Upload Creatives
|
|
546
|
+
</Button>
|
|
547
|
+
</>
|
|
548
|
+
}
|
|
549
|
+
/>
|
|
550
|
+
|
|
551
|
+
<div className="flex flex-col sm:flex-row gap-4">
|
|
552
|
+
<div className="flex items-center gap-3 flex-1">
|
|
553
|
+
<div className="relative flex-1">
|
|
554
|
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
555
|
+
<Input
|
|
556
|
+
placeholder="Search creatives..."
|
|
557
|
+
className="pl-9 bg-white dark:bg-background border"
|
|
558
|
+
value={searchQuery}
|
|
559
|
+
onChange={(e) => setSearchQuery(e.target.value)}
|
|
560
|
+
data-testid="input-search"
|
|
561
|
+
/>
|
|
562
|
+
</div>
|
|
563
|
+
<Button
|
|
564
|
+
variant="outline"
|
|
565
|
+
onClick={() => setFilterOpen(true)}
|
|
566
|
+
className="bg-white dark:bg-background"
|
|
567
|
+
data-testid="button-open-filters"
|
|
568
|
+
>
|
|
569
|
+
<Filter className="h-4 w-4 mr-2" />
|
|
570
|
+
Filters
|
|
571
|
+
{activeFilterCount > 0 && (
|
|
572
|
+
<Badge variant="secondary" className="ml-2">{activeFilterCount}</Badge>
|
|
573
|
+
)}
|
|
574
|
+
</Button>
|
|
575
|
+
</div>
|
|
576
|
+
|
|
577
|
+
<div className="flex border rounded-md">
|
|
578
|
+
<Button
|
|
579
|
+
variant={viewMode === "grid" ? "default" : "ghost"}
|
|
580
|
+
size="icon"
|
|
581
|
+
onClick={() => setViewMode("grid")}
|
|
582
|
+
data-testid="button-view-grid"
|
|
583
|
+
>
|
|
584
|
+
<Grid3X3 className="h-4 w-4" />
|
|
585
|
+
</Button>
|
|
586
|
+
<Button
|
|
587
|
+
variant={viewMode === "list" ? "default" : "ghost"}
|
|
588
|
+
size="icon"
|
|
589
|
+
onClick={() => setViewMode("list")}
|
|
590
|
+
data-testid="button-view-list"
|
|
591
|
+
>
|
|
592
|
+
<List className="h-4 w-4" />
|
|
593
|
+
</Button>
|
|
594
|
+
</div>
|
|
595
|
+
</div>
|
|
596
|
+
|
|
597
|
+
{creativesLoading || foldersLoading ? (
|
|
598
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
|
599
|
+
{[...Array(8)].map((_, i) => (
|
|
600
|
+
<Card key={i} className="overflow-hidden">
|
|
601
|
+
<Skeleton className="aspect-video" />
|
|
602
|
+
<div className="p-3 space-y-2">
|
|
603
|
+
<Skeleton className="h-4 w-3/4" />
|
|
604
|
+
<Skeleton className="h-3 w-1/2" />
|
|
605
|
+
</div>
|
|
606
|
+
</Card>
|
|
607
|
+
))}
|
|
608
|
+
</div>
|
|
609
|
+
) : viewMode === "grid" ? (
|
|
610
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
|
611
|
+
{filteredCreatives.map((creative) => (
|
|
612
|
+
<CreativeCard key={creative.id} creative={creative} />
|
|
613
|
+
))}
|
|
614
|
+
{filteredCreatives.length === 0 && (
|
|
615
|
+
<div className="col-span-full text-center py-12 text-muted-foreground">
|
|
616
|
+
No creatives found. Upload your first creative to get started.
|
|
617
|
+
</div>
|
|
618
|
+
)}
|
|
619
|
+
</div>
|
|
620
|
+
) : (
|
|
621
|
+
<DataTable
|
|
622
|
+
columns={columns}
|
|
623
|
+
data={filteredCreatives}
|
|
624
|
+
isLoading={creativesLoading}
|
|
625
|
+
emptyMessage="No creatives found. Upload your first creative to get started."
|
|
626
|
+
onRowClick={handleOpenPreview}
|
|
627
|
+
sortKey={sortBy}
|
|
628
|
+
sortOrder={sortOrder}
|
|
629
|
+
onSort={handleSort}
|
|
630
|
+
/>
|
|
631
|
+
)}
|
|
632
|
+
|
|
633
|
+
<FilterDrawer
|
|
634
|
+
open={filterOpen}
|
|
635
|
+
onOpenChange={setFilterOpen}
|
|
636
|
+
fields={filterFields}
|
|
637
|
+
values={filterValues}
|
|
638
|
+
onChange={setFilterValues}
|
|
639
|
+
onApply={handleApplyFilters}
|
|
640
|
+
onClear={handleClearFilters}
|
|
641
|
+
title="Filter Creatives"
|
|
642
|
+
/>
|
|
643
|
+
|
|
644
|
+
<Sheet open={isPreviewOpen} onOpenChange={setIsPreviewOpen}>
|
|
645
|
+
<SheetContent className="w-[400px] sm:w-[540px] overflow-y-auto">
|
|
646
|
+
{selectedCreative && (
|
|
647
|
+
<>
|
|
648
|
+
<SheetHeader>
|
|
649
|
+
<SheetTitle className="pr-8">{selectedCreative.name}</SheetTitle>
|
|
650
|
+
</SheetHeader>
|
|
651
|
+
|
|
652
|
+
<div className="mt-6 space-y-6">
|
|
653
|
+
<div className={`aspect-video rounded-lg flex items-center justify-center ${TYPE_COLORS[selectedCreative.type] || "bg-muted"}`}>
|
|
654
|
+
{(() => {
|
|
655
|
+
const TypeIcon = TYPE_ICONS[selectedCreative.type] || Image;
|
|
656
|
+
return <TypeIcon className="h-16 w-16 text-muted-foreground/50" />;
|
|
657
|
+
})()}
|
|
658
|
+
</div>
|
|
659
|
+
|
|
660
|
+
<div className="space-y-4">
|
|
661
|
+
<div className="flex items-center justify-between">
|
|
662
|
+
<span className="text-sm text-muted-foreground">Status</span>
|
|
663
|
+
<StatusBadgeComp status={selectedCreative.status} />
|
|
664
|
+
</div>
|
|
665
|
+
<div className="flex items-center justify-between">
|
|
666
|
+
<span className="text-sm text-muted-foreground">Type</span>
|
|
667
|
+
<span className="text-sm font-medium capitalize">{selectedCreative.type}</span>
|
|
668
|
+
</div>
|
|
669
|
+
<div className="flex items-center justify-between">
|
|
670
|
+
<span className="text-sm text-muted-foreground">Format</span>
|
|
671
|
+
<span className="text-sm font-medium">{selectedCreative.format}</span>
|
|
672
|
+
</div>
|
|
673
|
+
<div className="flex items-center justify-between">
|
|
674
|
+
<span className="text-sm text-muted-foreground">Dimensions</span>
|
|
675
|
+
<span className="text-sm font-medium">{selectedCreative.width}x{selectedCreative.height}</span>
|
|
676
|
+
</div>
|
|
677
|
+
<div className="flex items-center justify-between">
|
|
678
|
+
<span className="text-sm text-muted-foreground">File Size</span>
|
|
679
|
+
<span className="text-sm font-medium">{formatFileSize(selectedCreative.fileSize)}</span>
|
|
680
|
+
</div>
|
|
681
|
+
{selectedCreative.duration && (
|
|
682
|
+
<div className="flex items-center justify-between">
|
|
683
|
+
<span className="text-sm text-muted-foreground">Duration</span>
|
|
684
|
+
<span className="text-sm font-medium">{selectedCreative.duration}s</span>
|
|
685
|
+
</div>
|
|
686
|
+
)}
|
|
687
|
+
<div className="flex items-center justify-between">
|
|
688
|
+
<span className="text-sm text-muted-foreground">Uploaded</span>
|
|
689
|
+
<span className="text-sm font-medium">{formatDate(selectedCreative.uploadedAt)}</span>
|
|
690
|
+
</div>
|
|
691
|
+
{selectedCreative.uploadedBy && (
|
|
692
|
+
<div className="flex items-center justify-between">
|
|
693
|
+
<span className="text-sm text-muted-foreground">Uploaded By</span>
|
|
694
|
+
<span className="text-sm font-medium">{selectedCreative.uploadedBy}</span>
|
|
695
|
+
</div>
|
|
696
|
+
)}
|
|
697
|
+
<div className="flex items-center justify-between">
|
|
698
|
+
<span className="text-sm text-muted-foreground">Source</span>
|
|
699
|
+
<Badge
|
|
700
|
+
variant="outline"
|
|
701
|
+
className={`text-xs font-medium border-0 ${
|
|
702
|
+
(() => {
|
|
703
|
+
const platform = selectedCreative.sourcePlatform || "influence";
|
|
704
|
+
const platformColors: Record<string, string> = {
|
|
705
|
+
planner: "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",
|
|
706
|
+
activate: "bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",
|
|
707
|
+
influence: "bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",
|
|
708
|
+
media_owner: "bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",
|
|
709
|
+
};
|
|
710
|
+
return platformColors[platform] || platformColors.influence;
|
|
711
|
+
})()
|
|
712
|
+
}`}
|
|
713
|
+
>
|
|
714
|
+
{(() => {
|
|
715
|
+
const source = selectedCreative.creativeSource || "uploaded";
|
|
716
|
+
const platform = selectedCreative.sourcePlatform || "influence";
|
|
717
|
+
|
|
718
|
+
const platformLabels: Record<string, string> = {
|
|
719
|
+
planner: "Planner",
|
|
720
|
+
activate: "Activate",
|
|
721
|
+
influence: "Influence",
|
|
722
|
+
media_owner: "Media Owner",
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
const sourceLabels: Record<string, string> = {
|
|
726
|
+
uploaded: "Uploaded",
|
|
727
|
+
bid_stream_vast: "Bid Stream",
|
|
728
|
+
api: "API",
|
|
729
|
+
media_owner: "Direct",
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
return platform === "influence"
|
|
733
|
+
? sourceLabels[source] || "Uploaded"
|
|
734
|
+
: `${platformLabels[platform] || platform} - ${sourceLabels[source] || source}`;
|
|
735
|
+
})()}
|
|
736
|
+
</Badge>
|
|
737
|
+
</div>
|
|
738
|
+
{selectedCreative.transcodingEnabled && (
|
|
739
|
+
<div className="flex items-center justify-between">
|
|
740
|
+
<span className="text-sm text-muted-foreground">Transcoding</span>
|
|
741
|
+
<Badge
|
|
742
|
+
variant="outline"
|
|
743
|
+
className={`text-xs ${
|
|
744
|
+
selectedCreative.transcodingStatus === "completed"
|
|
745
|
+
? "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"
|
|
746
|
+
: selectedCreative.transcodingStatus === "failed"
|
|
747
|
+
? "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"
|
|
748
|
+
: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"
|
|
749
|
+
}`}
|
|
750
|
+
>
|
|
751
|
+
{selectedCreative.transcodingStatus || "pending"}
|
|
752
|
+
</Badge>
|
|
753
|
+
</div>
|
|
754
|
+
)}
|
|
755
|
+
</div>
|
|
756
|
+
|
|
757
|
+
{selectedCreative.inadequateReason && (
|
|
758
|
+
<div className="bg-destructive/10 border border-destructive/20 rounded-md p-3">
|
|
759
|
+
<div className="flex items-start gap-2">
|
|
760
|
+
<AlertCircle className="h-4 w-4 text-destructive mt-0.5" />
|
|
761
|
+
<div>
|
|
762
|
+
<p className="text-sm font-medium text-destructive">Inadequate Reason</p>
|
|
763
|
+
<p className="text-sm text-muted-foreground">{selectedCreative.inadequateReason}</p>
|
|
764
|
+
</div>
|
|
765
|
+
</div>
|
|
766
|
+
</div>
|
|
767
|
+
)}
|
|
768
|
+
|
|
769
|
+
<div className="space-y-2">
|
|
770
|
+
<Label className="text-sm text-muted-foreground">Tags</Label>
|
|
771
|
+
<div className="flex flex-wrap gap-2">
|
|
772
|
+
{selectedCreative.tags?.map((tag) => (
|
|
773
|
+
<Badge key={tag} variant="secondary" className="gap-1">
|
|
774
|
+
{tag}
|
|
775
|
+
<button
|
|
776
|
+
onClick={() => handleRemoveTag(tag)}
|
|
777
|
+
className="ml-1 hover:text-destructive"
|
|
778
|
+
data-testid={`button-remove-tag-${tag}`}
|
|
779
|
+
>
|
|
780
|
+
<X className="h-3 w-3" />
|
|
781
|
+
</button>
|
|
782
|
+
</Badge>
|
|
783
|
+
))}
|
|
784
|
+
</div>
|
|
785
|
+
<div className="flex gap-2">
|
|
786
|
+
<Input
|
|
787
|
+
placeholder="Add tag..."
|
|
788
|
+
value={newTag}
|
|
789
|
+
onChange={(e) => setNewTag(e.target.value)}
|
|
790
|
+
onKeyDown={(e) => e.key === "Enter" && handleAddTag()}
|
|
791
|
+
data-testid="input-new-tag"
|
|
792
|
+
/>
|
|
793
|
+
<Button size="icon" onClick={handleAddTag} data-testid="button-add-tag">
|
|
794
|
+
<Plus className="h-4 w-4" />
|
|
795
|
+
</Button>
|
|
796
|
+
</div>
|
|
797
|
+
</div>
|
|
798
|
+
|
|
799
|
+
<div className="space-y-2 pt-4 border-t">
|
|
800
|
+
<Label className="text-sm text-muted-foreground">Actions</Label>
|
|
801
|
+
{selectedCreative.status !== "accepted" && (
|
|
802
|
+
<Button
|
|
803
|
+
className="w-full"
|
|
804
|
+
onClick={handleAcceptCreative}
|
|
805
|
+
data-testid="button-accept-creative"
|
|
806
|
+
>
|
|
807
|
+
<Check className="h-4 w-4 mr-2" />
|
|
808
|
+
Accept Creative
|
|
809
|
+
</Button>
|
|
810
|
+
)}
|
|
811
|
+
{!showInadequateInput && selectedCreative.status !== "inadequate" && (
|
|
812
|
+
<Button
|
|
813
|
+
variant="outline"
|
|
814
|
+
className="w-full"
|
|
815
|
+
onClick={() => setShowInadequateInput(true)}
|
|
816
|
+
data-testid="button-show-inadequate-form"
|
|
817
|
+
>
|
|
818
|
+
<AlertCircle className="h-4 w-4 mr-2" />
|
|
819
|
+
Mark as Inadequate
|
|
820
|
+
</Button>
|
|
821
|
+
)}
|
|
822
|
+
{showInadequateInput && (
|
|
823
|
+
<div className="space-y-2">
|
|
824
|
+
<Textarea
|
|
825
|
+
placeholder="Enter reason for marking as inadequate..."
|
|
826
|
+
value={inadequateReason}
|
|
827
|
+
onChange={(e) => setInadequateReason(e.target.value)}
|
|
828
|
+
data-testid="textarea-inadequate-reason"
|
|
829
|
+
/>
|
|
830
|
+
<div className="flex gap-2">
|
|
831
|
+
<Button
|
|
832
|
+
variant="destructive"
|
|
833
|
+
className="flex-1"
|
|
834
|
+
onClick={handleMarkInadequate}
|
|
835
|
+
disabled={!inadequateReason.trim()}
|
|
836
|
+
data-testid="button-confirm-inadequate"
|
|
837
|
+
>
|
|
838
|
+
Confirm
|
|
839
|
+
</Button>
|
|
840
|
+
<Button
|
|
841
|
+
variant="outline"
|
|
842
|
+
onClick={() => {
|
|
843
|
+
setShowInadequateInput(false);
|
|
844
|
+
setInadequateReason("");
|
|
845
|
+
}}
|
|
846
|
+
data-testid="button-cancel-inadequate"
|
|
847
|
+
>
|
|
848
|
+
Cancel
|
|
849
|
+
</Button>
|
|
850
|
+
</div>
|
|
851
|
+
</div>
|
|
852
|
+
)}
|
|
853
|
+
</div>
|
|
854
|
+
</div>
|
|
855
|
+
</>
|
|
856
|
+
)}
|
|
857
|
+
</SheetContent>
|
|
858
|
+
</Sheet>
|
|
859
|
+
|
|
860
|
+
<Dialog open={isNewFolderDialogOpen} onOpenChange={setIsNewFolderDialogOpen}>
|
|
861
|
+
<DialogContent>
|
|
862
|
+
<DialogHeader>
|
|
863
|
+
<DialogTitle>Create New Folder</DialogTitle>
|
|
864
|
+
</DialogHeader>
|
|
865
|
+
<div className="space-y-4 py-4">
|
|
866
|
+
<div className="space-y-2">
|
|
867
|
+
<Label htmlFor="folder-name">Folder Name</Label>
|
|
868
|
+
<Input
|
|
869
|
+
id="folder-name"
|
|
870
|
+
value={newFolderName}
|
|
871
|
+
onChange={(e) => setNewFolderName(e.target.value)}
|
|
872
|
+
placeholder="Enter folder name..."
|
|
873
|
+
data-testid="input-folder-name"
|
|
874
|
+
/>
|
|
875
|
+
</div>
|
|
876
|
+
</div>
|
|
877
|
+
<DialogFooter>
|
|
878
|
+
<Button variant="outline" onClick={() => setIsNewFolderDialogOpen(false)}>
|
|
879
|
+
Cancel
|
|
880
|
+
</Button>
|
|
881
|
+
<Button
|
|
882
|
+
onClick={() => createFolderMutation.mutate(newFolderName)}
|
|
883
|
+
disabled={!newFolderName.trim() || createFolderMutation.isPending}
|
|
884
|
+
data-testid="button-create-folder"
|
|
885
|
+
>
|
|
886
|
+
{createFolderMutation.isPending ? "Creating..." : "Create Folder"}
|
|
887
|
+
</Button>
|
|
888
|
+
</DialogFooter>
|
|
889
|
+
</DialogContent>
|
|
890
|
+
</Dialog>
|
|
891
|
+
|
|
892
|
+
<Dialog open={isUploadDialogOpen} onOpenChange={setIsUploadDialogOpen}>
|
|
893
|
+
<DialogContent className="max-w-4xl max-h-[90vh] overflow-y-auto">
|
|
894
|
+
<DialogHeader>
|
|
895
|
+
<DialogTitle>Upload Creatives</DialogTitle>
|
|
896
|
+
</DialogHeader>
|
|
897
|
+
|
|
898
|
+
<div className="space-y-6 py-4">
|
|
899
|
+
<div className="border-2 border-dashed border-muted rounded-lg p-8 text-center">
|
|
900
|
+
<Upload className="h-12 w-12 mx-auto text-muted-foreground mb-4" />
|
|
901
|
+
<p className="text-lg font-medium mb-2">Drag and drop files here</p>
|
|
902
|
+
<p className="text-sm text-muted-foreground mb-4">or click to browse files</p>
|
|
903
|
+
<Button variant="outline" data-testid="button-browse-files">
|
|
904
|
+
Browse Files
|
|
905
|
+
</Button>
|
|
906
|
+
</div>
|
|
907
|
+
|
|
908
|
+
<div className="border-t pt-6">
|
|
909
|
+
<h3 className="text-lg font-semibold mb-4">Creative Specifications</h3>
|
|
910
|
+
<p className="text-sm text-muted-foreground mb-6">
|
|
911
|
+
Please ensure your creatives meet the following requirements before uploading.
|
|
912
|
+
</p>
|
|
913
|
+
|
|
914
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
915
|
+
{creativeSpecs && Object.entries(creativeSpecs).map(([type, spec]) => (
|
|
916
|
+
<Card key={type} className="p-4">
|
|
917
|
+
<div className="flex items-center gap-3 mb-4">
|
|
918
|
+
{type === "display" && <Image className="h-5 w-5 text-purple-500" />}
|
|
919
|
+
{type === "video" && <Video className="h-5 w-5 text-red-500" />}
|
|
920
|
+
{type === "html" && <Code className="h-5 w-5 text-orange-500" />}
|
|
921
|
+
{type === "native" && <FileText className="h-5 w-5 text-teal-500" />}
|
|
922
|
+
<h4 className="font-medium capitalize">{type}</h4>
|
|
923
|
+
</div>
|
|
924
|
+
|
|
925
|
+
<div className="space-y-3 text-sm">
|
|
926
|
+
<div>
|
|
927
|
+
<span className="text-muted-foreground">Formats:</span>
|
|
928
|
+
<div className="flex flex-wrap gap-1 mt-1">
|
|
929
|
+
{spec.formats.map((format) => (
|
|
930
|
+
<Badge key={format} variant="secondary">{format}</Badge>
|
|
931
|
+
))}
|
|
932
|
+
</div>
|
|
933
|
+
</div>
|
|
934
|
+
|
|
935
|
+
<div>
|
|
936
|
+
<span className="text-muted-foreground">Max File Size:</span>
|
|
937
|
+
<span className="ml-2 font-medium">{spec.maxFileSize}</span>
|
|
938
|
+
</div>
|
|
939
|
+
|
|
940
|
+
<div>
|
|
941
|
+
<span className="text-muted-foreground">Dimensions:</span>
|
|
942
|
+
<div className="flex flex-wrap gap-1 mt-1">
|
|
943
|
+
{spec.dimensions.slice(0, 4).map((dim) => (
|
|
944
|
+
<Badge key={dim.label} variant="outline" className="text-xs">
|
|
945
|
+
{dim.width}x{dim.height}
|
|
946
|
+
</Badge>
|
|
947
|
+
))}
|
|
948
|
+
{spec.dimensions.length > 4 && (
|
|
949
|
+
<Badge variant="outline" className="text-xs">
|
|
950
|
+
+{spec.dimensions.length - 4} more
|
|
951
|
+
</Badge>
|
|
952
|
+
)}
|
|
953
|
+
</div>
|
|
954
|
+
</div>
|
|
955
|
+
|
|
956
|
+
{spec.maxDuration && (
|
|
957
|
+
<div>
|
|
958
|
+
<span className="text-muted-foreground">Max Duration:</span>
|
|
959
|
+
<span className="ml-2 font-medium">{spec.maxDuration}s</span>
|
|
960
|
+
</div>
|
|
961
|
+
)}
|
|
962
|
+
|
|
963
|
+
{spec.notes.length > 0 && (
|
|
964
|
+
<div className="pt-2 border-t">
|
|
965
|
+
<span className="text-muted-foreground text-xs">Notes:</span>
|
|
966
|
+
<ul className="mt-1 space-y-1">
|
|
967
|
+
{spec.notes.map((note, idx) => (
|
|
968
|
+
<li key={idx} className="text-xs text-muted-foreground flex items-start gap-1">
|
|
969
|
+
<Check className="h-3 w-3 text-green-500 mt-0.5 flex-shrink-0" />
|
|
970
|
+
{note}
|
|
971
|
+
</li>
|
|
972
|
+
))}
|
|
973
|
+
</ul>
|
|
974
|
+
</div>
|
|
975
|
+
)}
|
|
976
|
+
</div>
|
|
977
|
+
</Card>
|
|
978
|
+
))}
|
|
979
|
+
</div>
|
|
980
|
+
</div>
|
|
981
|
+
</div>
|
|
982
|
+
|
|
983
|
+
<DialogFooter>
|
|
984
|
+
<Button variant="outline" onClick={() => setIsUploadDialogOpen(false)}>
|
|
985
|
+
Cancel
|
|
986
|
+
</Button>
|
|
987
|
+
<Button data-testid="button-upload-submit" disabled>
|
|
988
|
+
Upload
|
|
989
|
+
</Button>
|
|
990
|
+
</DialogFooter>
|
|
991
|
+
</DialogContent>
|
|
992
|
+
</Dialog>
|
|
993
|
+
</div>
|
|
994
|
+
);
|
|
995
|
+
}
|