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,1358 @@
|
|
|
1
|
+
import { useState, useMemo } from "react";
|
|
2
|
+
import { useLocation } from "wouter";
|
|
3
|
+
import { usePageTitle } from "@/hooks/use-page-title";
|
|
4
|
+
import { useToast } from "@/hooks/use-toast";
|
|
5
|
+
import {
|
|
6
|
+
useFolders,
|
|
7
|
+
useCreatives,
|
|
8
|
+
useDeleteCreative,
|
|
9
|
+
useApproveCreative,
|
|
10
|
+
useRejectCreative,
|
|
11
|
+
useUpdateCreative,
|
|
12
|
+
useTranscodeCreative,
|
|
13
|
+
useCreateFolder,
|
|
14
|
+
} from "@/lib/content-hub-api";
|
|
15
|
+
import type { Creative, CreativeFilters, Folder, FolderFilters } from "@/types/content-hub";
|
|
16
|
+
import { CreativeStatus } from "@/types/content-hub";
|
|
17
|
+
|
|
18
|
+
import { CreativeUpload } from "@/components/content-hub/creative-upload";
|
|
19
|
+
import { FolderCard } from "@/components/creative-library/folder-card";
|
|
20
|
+
import {
|
|
21
|
+
CreateFolderDialog,
|
|
22
|
+
UpdateFolderDialog,
|
|
23
|
+
DeleteFolderDialog,
|
|
24
|
+
} from "@/components/content-hub/folder-dialogs";
|
|
25
|
+
import { TranscodeDialog } from "@/components/content-hub/transcode-dialog";
|
|
26
|
+
import { ApproveDialog, RejectDialog } from "@/components/content-hub/review-dialogs";
|
|
27
|
+
|
|
28
|
+
import { Button } from "@moving-walls/design-system";
|
|
29
|
+
import { Input } from "@moving-walls/design-system";
|
|
30
|
+
import { Card, CardContent } from "@moving-walls/design-system";
|
|
31
|
+
import { Badge } from "@moving-walls/design-system";
|
|
32
|
+
import { Label } from "@moving-walls/design-system";
|
|
33
|
+
import { Separator } from "@moving-walls/design-system";
|
|
34
|
+
import {
|
|
35
|
+
Sheet,
|
|
36
|
+
SheetContent,
|
|
37
|
+
SheetHeader,
|
|
38
|
+
SheetTitle,
|
|
39
|
+
} from "@moving-walls/design-system";
|
|
40
|
+
import {
|
|
41
|
+
Dialog,
|
|
42
|
+
DialogContent,
|
|
43
|
+
DialogHeader,
|
|
44
|
+
DialogTitle,
|
|
45
|
+
DialogFooter,
|
|
46
|
+
} from "@moving-walls/design-system";
|
|
47
|
+
import {
|
|
48
|
+
DropdownMenu,
|
|
49
|
+
DropdownMenuContent,
|
|
50
|
+
DropdownMenuItem,
|
|
51
|
+
DropdownMenuTrigger,
|
|
52
|
+
} from "@moving-walls/design-system";
|
|
53
|
+
import { AgGridTable } from "@moving-walls/design-system";
|
|
54
|
+
import type { AgGridSortState, AgGridTableServerSideConfig, ColDef } from "@moving-walls/design-system";
|
|
55
|
+
|
|
56
|
+
import {
|
|
57
|
+
Select,
|
|
58
|
+
SelectContent,
|
|
59
|
+
SelectItem,
|
|
60
|
+
SelectTrigger,
|
|
61
|
+
SelectValue,
|
|
62
|
+
} from "@moving-walls/design-system";
|
|
63
|
+
import { Textarea } from "@moving-walls/design-system";
|
|
64
|
+
import { PageHeader } from "@moving-walls/design-system";
|
|
65
|
+
import { HStack, Stack, Text, Heading } from "@moving-walls/design-system";
|
|
66
|
+
|
|
67
|
+
import {
|
|
68
|
+
Plus,
|
|
69
|
+
Upload,
|
|
70
|
+
LayoutGrid,
|
|
71
|
+
List,
|
|
72
|
+
Search,
|
|
73
|
+
Filter,
|
|
74
|
+
MoreVertical,
|
|
75
|
+
Eye,
|
|
76
|
+
Download,
|
|
77
|
+
Trash2,
|
|
78
|
+
X,
|
|
79
|
+
Image as ImageIcon,
|
|
80
|
+
Video,
|
|
81
|
+
FileText,
|
|
82
|
+
Package,
|
|
83
|
+
Loader2,
|
|
84
|
+
Check,
|
|
85
|
+
XCircle,
|
|
86
|
+
Wand2,
|
|
87
|
+
} from "lucide-react";
|
|
88
|
+
import { useAuth } from "@/contexts/auth-context";
|
|
89
|
+
|
|
90
|
+
const STATUS_MAP: Record<string, string> = {
|
|
91
|
+
draft: "Processing",
|
|
92
|
+
pending_review: "New",
|
|
93
|
+
approved: "Accepted",
|
|
94
|
+
rejected: "Inadequate",
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const STATUS_COLORS: Record<string, string> = {
|
|
98
|
+
draft: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",
|
|
99
|
+
pending_review: "bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300",
|
|
100
|
+
approved: "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300",
|
|
101
|
+
rejected: "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300",
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const TYPE_COLORS: Record<string, string> = {
|
|
105
|
+
image: "bg-purple-100 dark:bg-purple-900",
|
|
106
|
+
video: "bg-red-100 dark:bg-red-900",
|
|
107
|
+
document: "bg-orange-100 dark:bg-orange-900",
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const TYPE_ICONS: Record<string, typeof ImageIcon> = {
|
|
111
|
+
image: ImageIcon,
|
|
112
|
+
video: Video,
|
|
113
|
+
document: FileText,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function getCreativeType(mimeType: string): string {
|
|
117
|
+
if (mimeType.startsWith("image/")) return "image";
|
|
118
|
+
if (mimeType.startsWith("video/")) return "video";
|
|
119
|
+
return "document";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getCreativeTypeLabel(mimeType: string): string {
|
|
123
|
+
if (mimeType.startsWith("image/")) return "Display";
|
|
124
|
+
if (mimeType.startsWith("video/")) return "Video";
|
|
125
|
+
if (mimeType.includes("html")) return "Html";
|
|
126
|
+
return "Native";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function formatBytes(bytes: number): string {
|
|
130
|
+
if (bytes === 0) return "0 B";
|
|
131
|
+
const k = 1024;
|
|
132
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
133
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
134
|
+
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function formatDate(dateStr: string): string {
|
|
138
|
+
const d = new Date(dateStr);
|
|
139
|
+
return `${d.getMonth() + 1}/${d.getDate()}/${d.getFullYear()}`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function StatusBadge({ status }: { status: string }) {
|
|
143
|
+
const label = STATUS_MAP[status] || status;
|
|
144
|
+
const colorClass = STATUS_COLORS[status] || "bg-gray-100 text-gray-800";
|
|
145
|
+
return (
|
|
146
|
+
<Badge variant="outline" className={`${colorClass} border-0 text-xs`}>
|
|
147
|
+
{label}
|
|
148
|
+
</Badge>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default function ContentHub() {
|
|
153
|
+
usePageTitle("Content Hub");
|
|
154
|
+
const { toast } = useToast();
|
|
155
|
+
const { user } = useAuth();
|
|
156
|
+
const [, setLocation] = useLocation();
|
|
157
|
+
|
|
158
|
+
const [viewMode, setViewMode] = useState<"grid" | "list">("grid");
|
|
159
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
160
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
161
|
+
const [pageSize, setPageSize] = useState(20);
|
|
162
|
+
const [sortBy, setSortBy] = useState<string>("created_at");
|
|
163
|
+
const [sortOrder, setSortOrder] = useState<"asc" | "desc">("desc");
|
|
164
|
+
|
|
165
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
166
|
+
const [statusFilter, setStatusFilter] = useState<string>("all");
|
|
167
|
+
const [typeFilter, setTypeFilter] = useState<string>("all");
|
|
168
|
+
const [folderFilter, setFolderFilter] = useState<string>("all");
|
|
169
|
+
|
|
170
|
+
const [uploadDialogOpen, setUploadDialogOpen] = useState(false);
|
|
171
|
+
const [createFolderOpen, setCreateFolderOpen] = useState(false);
|
|
172
|
+
const [updateFolderOpen, setUpdateFolderOpen] = useState(false);
|
|
173
|
+
const [deleteFolderOpen, setDeleteFolderOpen] = useState(false);
|
|
174
|
+
const [selectedFolder, setSelectedFolder] = useState<Folder | null>(null);
|
|
175
|
+
|
|
176
|
+
const [previewOpen, setPreviewOpen] = useState(false);
|
|
177
|
+
const [selectedCreative, setSelectedCreative] = useState<Creative | null>(null);
|
|
178
|
+
const [newTag, setNewTag] = useState("");
|
|
179
|
+
|
|
180
|
+
const [approveDialogOpen, setApproveDialogOpen] = useState(false);
|
|
181
|
+
const [rejectDialogOpen, setRejectDialogOpen] = useState(false);
|
|
182
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
183
|
+
const [creativeToDelete, setCreativeToDelete] = useState<Creative | null>(null);
|
|
184
|
+
const [transcodeCreative, setTranscodeCreative] = useState<Creative | null>(null);
|
|
185
|
+
|
|
186
|
+
const apiFilters: CreativeFilters = useMemo(() => {
|
|
187
|
+
const filters: CreativeFilters = {
|
|
188
|
+
page: currentPage,
|
|
189
|
+
limit: pageSize,
|
|
190
|
+
search: searchQuery || undefined,
|
|
191
|
+
};
|
|
192
|
+
if (statusFilter !== "all") {
|
|
193
|
+
filters.status = statusFilter as CreativeStatus;
|
|
194
|
+
}
|
|
195
|
+
if (folderFilter !== "all") {
|
|
196
|
+
filters.folder_id = folderFilter;
|
|
197
|
+
}
|
|
198
|
+
if (typeFilter !== "all") {
|
|
199
|
+
filters.mime_type = `${typeFilter}/*`;
|
|
200
|
+
}
|
|
201
|
+
return filters;
|
|
202
|
+
}, [currentPage, pageSize, searchQuery, statusFilter, typeFilter, folderFilter]);
|
|
203
|
+
|
|
204
|
+
const { data: foldersData } = useFolders({ page: 1, limit: 100 });
|
|
205
|
+
const folders = foldersData?.data || [];
|
|
206
|
+
|
|
207
|
+
const {
|
|
208
|
+
data: creativesData,
|
|
209
|
+
isLoading,
|
|
210
|
+
refetch: refetchCreatives,
|
|
211
|
+
} = useCreatives(apiFilters);
|
|
212
|
+
const creatives = creativesData?.data || [];
|
|
213
|
+
const totalPages = creativesData?.pagination?.total_pages || 1;
|
|
214
|
+
const totalItems = creativesData?.pagination?.total || 0;
|
|
215
|
+
|
|
216
|
+
const deleteCreativeMutation = useDeleteCreative();
|
|
217
|
+
const approveCreativeMutation = useApproveCreative();
|
|
218
|
+
const rejectCreativeMutation = useRejectCreative();
|
|
219
|
+
const updateCreativeMutation = useUpdateCreative();
|
|
220
|
+
const transcodeCreativeMutation = useTranscodeCreative();
|
|
221
|
+
const createFolderMutation = useCreateFolder();
|
|
222
|
+
|
|
223
|
+
const activeFilterCount = useMemo(() => {
|
|
224
|
+
let count = 0;
|
|
225
|
+
if (statusFilter !== "all") count++;
|
|
226
|
+
if (typeFilter !== "all") count++;
|
|
227
|
+
if (folderFilter !== "all") count++;
|
|
228
|
+
return count;
|
|
229
|
+
}, [statusFilter, typeFilter, folderFilter]);
|
|
230
|
+
|
|
231
|
+
const handleSearchChange = (query: string) => {
|
|
232
|
+
setSearchQuery(query);
|
|
233
|
+
setCurrentPage(1);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const handleSort = (key: string) => {
|
|
237
|
+
if (sortBy === key) {
|
|
238
|
+
setSortOrder(sortOrder === "asc" ? "desc" : "asc");
|
|
239
|
+
} else {
|
|
240
|
+
setSortBy(key);
|
|
241
|
+
setSortOrder("asc");
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const handlePreview = (creative: Creative) => {
|
|
246
|
+
setSelectedCreative(creative);
|
|
247
|
+
setPreviewOpen(true);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const handleApprove = async (data: { reviewer_id: string; comments?: string }) => {
|
|
251
|
+
if (!selectedCreative) return;
|
|
252
|
+
try {
|
|
253
|
+
await approveCreativeMutation.mutateAsync({
|
|
254
|
+
creativeId: selectedCreative.id,
|
|
255
|
+
payload: data,
|
|
256
|
+
});
|
|
257
|
+
toast({ title: "Creative approved successfully", variant: "default" });
|
|
258
|
+
setApproveDialogOpen(false);
|
|
259
|
+
refetchCreatives();
|
|
260
|
+
setSelectedCreative((prev) =>
|
|
261
|
+
prev ? { ...prev, status: "approved" } : null,
|
|
262
|
+
);
|
|
263
|
+
} catch (error: any) {
|
|
264
|
+
toast({
|
|
265
|
+
title: "Failed to approve creative",
|
|
266
|
+
description: error?.message,
|
|
267
|
+
variant: "destructive",
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const handleReject = async (data: { reviewer_id: string; comments?: string }) => {
|
|
273
|
+
if (!selectedCreative) return;
|
|
274
|
+
try {
|
|
275
|
+
await rejectCreativeMutation.mutateAsync({
|
|
276
|
+
creativeId: selectedCreative.id,
|
|
277
|
+
payload: data,
|
|
278
|
+
});
|
|
279
|
+
toast({ title: "Creative rejected", variant: "default" });
|
|
280
|
+
setRejectDialogOpen(false);
|
|
281
|
+
refetchCreatives();
|
|
282
|
+
setSelectedCreative((prev) =>
|
|
283
|
+
prev ? { ...prev, status: "rejected" } : null,
|
|
284
|
+
);
|
|
285
|
+
} catch (error: any) {
|
|
286
|
+
toast({
|
|
287
|
+
title: "Failed to reject creative",
|
|
288
|
+
description: error?.message,
|
|
289
|
+
variant: "destructive",
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const handleAddTag = async () => {
|
|
295
|
+
if (!selectedCreative || !newTag.trim()) return;
|
|
296
|
+
const currentTags = selectedCreative.tags || [];
|
|
297
|
+
if (currentTags.includes(newTag.trim())) {
|
|
298
|
+
toast({ title: "Tag already exists", variant: "destructive" });
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const updatedTags = [...currentTags, newTag.trim()];
|
|
302
|
+
try {
|
|
303
|
+
await updateCreativeMutation.mutateAsync({
|
|
304
|
+
creativeId: selectedCreative.id,
|
|
305
|
+
data: { tags: updatedTags },
|
|
306
|
+
});
|
|
307
|
+
setSelectedCreative({ ...selectedCreative, tags: updatedTags });
|
|
308
|
+
setNewTag("");
|
|
309
|
+
toast({ title: "Tag added" });
|
|
310
|
+
} catch (error: any) {
|
|
311
|
+
toast({
|
|
312
|
+
title: "Failed to update tags",
|
|
313
|
+
description: error?.message,
|
|
314
|
+
variant: "destructive",
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const handleRemoveTag = async (tag: string) => {
|
|
320
|
+
if (!selectedCreative) return;
|
|
321
|
+
const currentTags = selectedCreative.tags || [];
|
|
322
|
+
const updatedTags = currentTags.filter((t) => t !== tag);
|
|
323
|
+
try {
|
|
324
|
+
await updateCreativeMutation.mutateAsync({
|
|
325
|
+
creativeId: selectedCreative.id,
|
|
326
|
+
data: { tags: updatedTags },
|
|
327
|
+
});
|
|
328
|
+
setSelectedCreative({ ...selectedCreative, tags: updatedTags });
|
|
329
|
+
toast({ title: "Tag removed" });
|
|
330
|
+
} catch (error: any) {
|
|
331
|
+
toast({
|
|
332
|
+
title: "Failed to update tags",
|
|
333
|
+
description: error?.message,
|
|
334
|
+
variant: "destructive",
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const handleDeleteCreative = (creative: Creative) => {
|
|
340
|
+
setCreativeToDelete(creative);
|
|
341
|
+
setDeleteDialogOpen(true);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const confirmDeleteCreative = async () => {
|
|
345
|
+
if (!creativeToDelete) return;
|
|
346
|
+
try {
|
|
347
|
+
await deleteCreativeMutation.mutateAsync({
|
|
348
|
+
creativeId: creativeToDelete.id,
|
|
349
|
+
performerId: user?.id,
|
|
350
|
+
});
|
|
351
|
+
toast({ title: "Creative deleted" });
|
|
352
|
+
setDeleteDialogOpen(false);
|
|
353
|
+
setCreativeToDelete(null);
|
|
354
|
+
if (selectedCreative?.id === creativeToDelete.id) {
|
|
355
|
+
setPreviewOpen(false);
|
|
356
|
+
setSelectedCreative(null);
|
|
357
|
+
}
|
|
358
|
+
} catch (error: any) {
|
|
359
|
+
toast({
|
|
360
|
+
title: "Failed to delete creative",
|
|
361
|
+
description: error?.message,
|
|
362
|
+
variant: "destructive",
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
const handleTranscode = (profiles: any[], formats?: any[]) => {
|
|
368
|
+
if (!transcodeCreative) return;
|
|
369
|
+
transcodeCreativeMutation.mutate(
|
|
370
|
+
{
|
|
371
|
+
creativeId: transcodeCreative.id,
|
|
372
|
+
payload: { profiles, target_formats: formats },
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
onSuccess: () => {
|
|
376
|
+
toast({ title: "Transcoding started" });
|
|
377
|
+
setTranscodeCreative(null);
|
|
378
|
+
refetchCreatives();
|
|
379
|
+
},
|
|
380
|
+
onError: (error: any) => {
|
|
381
|
+
toast({
|
|
382
|
+
title: "Transcoding failed",
|
|
383
|
+
description: error?.message,
|
|
384
|
+
variant: "destructive",
|
|
385
|
+
});
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
const handleFolderClick = (folderId: string) => {
|
|
392
|
+
setLocation(`/contenthub/folder/${folderId}`);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const getFolderSize = (folder: Folder): string => {
|
|
396
|
+
const totalFiles = folder.no_of_creatives;
|
|
397
|
+
return `${totalFiles * 2} MB`;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
const handleClearFilters = () => {
|
|
401
|
+
setStatusFilter("all");
|
|
402
|
+
setTypeFilter("all");
|
|
403
|
+
setFolderFilter("all");
|
|
404
|
+
setCurrentPage(1);
|
|
405
|
+
setFilterOpen(false);
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const handlePageChange = (page: number) => {
|
|
409
|
+
setCurrentPage(page);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const handlePageSizeChange = (newSize: number) => {
|
|
413
|
+
setPageSize(newSize);
|
|
414
|
+
setCurrentPage(1);
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
const sortedCreatives = useMemo(() => {
|
|
418
|
+
const arr = [...creatives];
|
|
419
|
+
arr.sort((a, b) => {
|
|
420
|
+
let cmp = 0;
|
|
421
|
+
switch (sortBy) {
|
|
422
|
+
case "filename":
|
|
423
|
+
cmp = a.filename.localeCompare(b.filename);
|
|
424
|
+
break;
|
|
425
|
+
case "size_bytes":
|
|
426
|
+
cmp = a.size_bytes - b.size_bytes;
|
|
427
|
+
break;
|
|
428
|
+
case "created_at":
|
|
429
|
+
cmp = new Date(a.created_at).getTime() - new Date(b.created_at).getTime();
|
|
430
|
+
break;
|
|
431
|
+
case "status":
|
|
432
|
+
cmp = a.status.localeCompare(b.status);
|
|
433
|
+
break;
|
|
434
|
+
default:
|
|
435
|
+
cmp = 0;
|
|
436
|
+
}
|
|
437
|
+
return sortOrder === "asc" ? cmp : -cmp;
|
|
438
|
+
});
|
|
439
|
+
return arr;
|
|
440
|
+
}, [creatives, sortBy, sortOrder]);
|
|
441
|
+
|
|
442
|
+
const contentHubSortState: AgGridSortState[] = sortBy
|
|
443
|
+
? [{ key: sortBy, direction: sortOrder }]
|
|
444
|
+
: [];
|
|
445
|
+
|
|
446
|
+
const handleAgGridSortChange = (newSort: AgGridSortState[]) => {
|
|
447
|
+
if (newSort.length === 0) {
|
|
448
|
+
setSortBy("created_at");
|
|
449
|
+
setSortOrder("desc");
|
|
450
|
+
} else {
|
|
451
|
+
setSortBy(newSort[0].key);
|
|
452
|
+
setSortOrder(newSort[0].direction);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
const contentHubColumnDefs: ColDef<Creative>[] = [
|
|
457
|
+
{
|
|
458
|
+
colId: "filename",
|
|
459
|
+
headerName: "Name",
|
|
460
|
+
field: "filename",
|
|
461
|
+
sortable: true,
|
|
462
|
+
minWidth: 250,
|
|
463
|
+
flex: 1,
|
|
464
|
+
cellRenderer: (params: any) => {
|
|
465
|
+
const creative = params.data as Creative;
|
|
466
|
+
if (!creative) return null;
|
|
467
|
+
const cType = getCreativeType(creative.mime_type);
|
|
468
|
+
const TypeIcon = TYPE_ICONS[cType] || FileText;
|
|
469
|
+
return (
|
|
470
|
+
<div
|
|
471
|
+
className="flex items-center gap-3 cursor-pointer"
|
|
472
|
+
onClick={() => handlePreview(creative)}
|
|
473
|
+
>
|
|
474
|
+
<div className={`w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 ${TYPE_COLORS[cType] || "bg-muted"}`}>
|
|
475
|
+
<TypeIcon className="h-4 w-4 text-muted-foreground/70" />
|
|
476
|
+
</div>
|
|
477
|
+
<span className="text-sm font-medium text-mw-neutral-700 dark:text-mw-neutral-200 truncate max-w-[250px]">
|
|
478
|
+
{creative.filename}
|
|
479
|
+
</span>
|
|
480
|
+
</div>
|
|
481
|
+
);
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
colId: "type",
|
|
486
|
+
headerName: "Type",
|
|
487
|
+
sortable: false,
|
|
488
|
+
cellRenderer: (params: any) => {
|
|
489
|
+
const creative = params.data as Creative;
|
|
490
|
+
if (!creative) return null;
|
|
491
|
+
return (
|
|
492
|
+
<span className="text-sm text-mw-neutral-600 dark:text-mw-neutral-400">
|
|
493
|
+
{getCreativeTypeLabel(creative.mime_type)}
|
|
494
|
+
</span>
|
|
495
|
+
);
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
colId: "status",
|
|
500
|
+
headerName: "Status",
|
|
501
|
+
field: "status",
|
|
502
|
+
sortable: true,
|
|
503
|
+
cellRenderer: (params: any) => {
|
|
504
|
+
const creative = params.data as Creative;
|
|
505
|
+
if (!creative) return null;
|
|
506
|
+
return <StatusBadge status={creative.status} />;
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
colId: "dimensions",
|
|
511
|
+
headerName: "Dimensions",
|
|
512
|
+
sortable: false,
|
|
513
|
+
cellRenderer: (params: any) => {
|
|
514
|
+
const creative = params.data as Creative;
|
|
515
|
+
if (!creative) return null;
|
|
516
|
+
return (
|
|
517
|
+
<span className="text-sm text-mw-neutral-600 dark:text-mw-neutral-400">
|
|
518
|
+
{creative.width && creative.height
|
|
519
|
+
? `${creative.width}\u00d7${creative.height}`
|
|
520
|
+
: "0x0"}
|
|
521
|
+
</span>
|
|
522
|
+
);
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
colId: "size_bytes",
|
|
527
|
+
headerName: "Size",
|
|
528
|
+
field: "size_bytes",
|
|
529
|
+
sortable: true,
|
|
530
|
+
cellRenderer: (params: any) => {
|
|
531
|
+
const creative = params.data as Creative;
|
|
532
|
+
if (!creative) return null;
|
|
533
|
+
return (
|
|
534
|
+
<span className="text-sm text-mw-neutral-600 dark:text-mw-neutral-400">
|
|
535
|
+
{formatBytes(creative.size_bytes)}
|
|
536
|
+
</span>
|
|
537
|
+
);
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
colId: "created_at",
|
|
542
|
+
headerName: "Uploaded",
|
|
543
|
+
field: "created_at",
|
|
544
|
+
sortable: true,
|
|
545
|
+
cellRenderer: (params: any) => {
|
|
546
|
+
const creative = params.data as Creative;
|
|
547
|
+
if (!creative) return null;
|
|
548
|
+
return (
|
|
549
|
+
<span className="text-sm text-mw-neutral-600 dark:text-mw-neutral-400">
|
|
550
|
+
{formatDate(creative.created_at)}
|
|
551
|
+
</span>
|
|
552
|
+
);
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
colId: "actions",
|
|
557
|
+
headerName: "",
|
|
558
|
+
sortable: false,
|
|
559
|
+
width: 60,
|
|
560
|
+
cellRenderer: (params: any) => {
|
|
561
|
+
const creative = params.data as Creative;
|
|
562
|
+
if (!creative) return null;
|
|
563
|
+
return (
|
|
564
|
+
<DropdownMenu>
|
|
565
|
+
<DropdownMenuTrigger asChild>
|
|
566
|
+
<Button
|
|
567
|
+
variant="ghost"
|
|
568
|
+
size="sm"
|
|
569
|
+
isIconOnly
|
|
570
|
+
className="h-8 w-8 !p-0"
|
|
571
|
+
>
|
|
572
|
+
<MoreVertical className="h-4 w-4" />
|
|
573
|
+
</Button>
|
|
574
|
+
</DropdownMenuTrigger>
|
|
575
|
+
<DropdownMenuContent align="end">
|
|
576
|
+
<DropdownMenuItem
|
|
577
|
+
onClick={() => handlePreview(creative)}
|
|
578
|
+
>
|
|
579
|
+
<Eye className="h-4 w-4 mr-2" />
|
|
580
|
+
Preview
|
|
581
|
+
</DropdownMenuItem>
|
|
582
|
+
<DropdownMenuItem
|
|
583
|
+
onClick={() =>
|
|
584
|
+
window.open(creative.cdn_path, "_blank")
|
|
585
|
+
}
|
|
586
|
+
>
|
|
587
|
+
<Download className="h-4 w-4 mr-2" />
|
|
588
|
+
Download
|
|
589
|
+
</DropdownMenuItem>
|
|
590
|
+
<DropdownMenuItem
|
|
591
|
+
onClick={() => setTranscodeCreative(creative)}
|
|
592
|
+
>
|
|
593
|
+
<Wand2 className="h-4 w-4 mr-2" />
|
|
594
|
+
Transcode
|
|
595
|
+
</DropdownMenuItem>
|
|
596
|
+
<DropdownMenuItem
|
|
597
|
+
className="text-destructive"
|
|
598
|
+
onClick={() => handleDeleteCreative(creative)}
|
|
599
|
+
>
|
|
600
|
+
<Trash2 className="h-4 w-4 mr-2" />
|
|
601
|
+
Delete
|
|
602
|
+
</DropdownMenuItem>
|
|
603
|
+
</DropdownMenuContent>
|
|
604
|
+
</DropdownMenu>
|
|
605
|
+
);
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
];
|
|
609
|
+
|
|
610
|
+
return (
|
|
611
|
+
<div className="h-[calc(100vh-72px)] w-full flex flex-col bg-mw-neutral-50 dark:bg-mw-neutral-900 overflow-hidden">
|
|
612
|
+
<div className="flex-shrink-0">
|
|
613
|
+
<PageHeader
|
|
614
|
+
title="Content Hub"
|
|
615
|
+
subtitle="Manage and organize your advertising creatives"
|
|
616
|
+
className="px-6 py-4 border-b border-mw-neutral-200"
|
|
617
|
+
actions={
|
|
618
|
+
<>
|
|
619
|
+
<Button
|
|
620
|
+
variant="outline"
|
|
621
|
+
onClick={() => setCreateFolderOpen(true)}
|
|
622
|
+
>
|
|
623
|
+
<Plus className="w-4 h-4 mr-2" />
|
|
624
|
+
New Folder
|
|
625
|
+
</Button>
|
|
626
|
+
<Button
|
|
627
|
+
variant="primary"
|
|
628
|
+
onClick={() => setUploadDialogOpen(true)}
|
|
629
|
+
>
|
|
630
|
+
<Upload className="w-4 h-4 mr-2" />
|
|
631
|
+
Upload Creatives
|
|
632
|
+
</Button>
|
|
633
|
+
</>
|
|
634
|
+
}
|
|
635
|
+
/>
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
<Card className="flex-1 flex flex-col min-h-0 overflow-hidden border border-mw-neutral-200 rounded-lg bg-white mx-6 my-6">
|
|
639
|
+
<div className="flex-shrink-0 px-6 py-3 bg-white dark:bg-mw-neutral-800 border-b border-mw-neutral-100 dark:border-mw-neutral-700">
|
|
640
|
+
<div className="flex items-center gap-3">
|
|
641
|
+
<div className="relative flex-1">
|
|
642
|
+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-mw-neutral-400" />
|
|
643
|
+
<Input
|
|
644
|
+
placeholder="Search creatives..."
|
|
645
|
+
value={searchQuery}
|
|
646
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
647
|
+
handleSearchChange(e.target.value)
|
|
648
|
+
}
|
|
649
|
+
className="w-full pl-10 pr-3 py-2"
|
|
650
|
+
/>
|
|
651
|
+
</div>
|
|
652
|
+
<Button
|
|
653
|
+
variant="outline"
|
|
654
|
+
size="sm"
|
|
655
|
+
onClick={() => setFilterOpen(true)}
|
|
656
|
+
className="relative inline-flex items-center gap-2 px-3 py-2.5 text-sm font-medium"
|
|
657
|
+
>
|
|
658
|
+
<Filter className="h-4 w-4" />
|
|
659
|
+
Filters
|
|
660
|
+
{activeFilterCount > 0 && (
|
|
661
|
+
<Badge variant="secondary" className="ml-1">
|
|
662
|
+
{activeFilterCount}
|
|
663
|
+
</Badge>
|
|
664
|
+
)}
|
|
665
|
+
</Button>
|
|
666
|
+
<div className="flex border border-mw-neutral-200 dark:border-mw-neutral-600 rounded-md">
|
|
667
|
+
<Button
|
|
668
|
+
variant={viewMode === "grid" ? "primary" : "outline"}
|
|
669
|
+
size="sm"
|
|
670
|
+
isIconOnly
|
|
671
|
+
className="rounded-r-none"
|
|
672
|
+
onClick={() => setViewMode("grid")}
|
|
673
|
+
>
|
|
674
|
+
<LayoutGrid className="w-4 h-4" />
|
|
675
|
+
</Button>
|
|
676
|
+
<Button
|
|
677
|
+
variant={viewMode === "list" ? "primary" : "outline"}
|
|
678
|
+
size="sm"
|
|
679
|
+
isIconOnly
|
|
680
|
+
className="rounded-l-none"
|
|
681
|
+
onClick={() => setViewMode("list")}
|
|
682
|
+
>
|
|
683
|
+
<List className="w-4 h-4" />
|
|
684
|
+
</Button>
|
|
685
|
+
</div>
|
|
686
|
+
</div>
|
|
687
|
+
</div>
|
|
688
|
+
|
|
689
|
+
<div className="flex-1 flex flex-col overflow-y-auto min-h-0">
|
|
690
|
+
{folders.length > 0 && (
|
|
691
|
+
<div className="px-6 pt-4 pb-2">
|
|
692
|
+
<div className="flex items-center justify-between mb-3">
|
|
693
|
+
<Heading level={6}>Folders</Heading>
|
|
694
|
+
<Button
|
|
695
|
+
variant="ghost"
|
|
696
|
+
size="sm"
|
|
697
|
+
onClick={() => setLocation("/contenthub/folders")}
|
|
698
|
+
className="text-mw-primary-500 dark:text-mw-primary-400 p-0 h-auto hover:underline"
|
|
699
|
+
>
|
|
700
|
+
View All Folders
|
|
701
|
+
</Button>
|
|
702
|
+
</div>
|
|
703
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3">
|
|
704
|
+
{folders.slice(0, 4).map((folder) => (
|
|
705
|
+
<FolderCard
|
|
706
|
+
key={folder.id}
|
|
707
|
+
id={folder.id}
|
|
708
|
+
name={folder.name}
|
|
709
|
+
fileCount={folder.no_of_creatives}
|
|
710
|
+
size={getFolderSize(folder)}
|
|
711
|
+
onClick={() => handleFolderClick(folder.id)}
|
|
712
|
+
onRename={() => {
|
|
713
|
+
setSelectedFolder(folder);
|
|
714
|
+
setUpdateFolderOpen(true);
|
|
715
|
+
}}
|
|
716
|
+
onDelete={() => {
|
|
717
|
+
setSelectedFolder(folder);
|
|
718
|
+
setDeleteFolderOpen(true);
|
|
719
|
+
}}
|
|
720
|
+
/>
|
|
721
|
+
))}
|
|
722
|
+
</div>
|
|
723
|
+
</div>
|
|
724
|
+
)}
|
|
725
|
+
|
|
726
|
+
{isLoading ? (
|
|
727
|
+
<div className="flex items-center justify-center py-16">
|
|
728
|
+
<Loader2 className="w-8 h-8 animate-spin text-mw-primary-500" />
|
|
729
|
+
</div>
|
|
730
|
+
) : creatives.length === 0 ? (
|
|
731
|
+
<div className="flex flex-col items-center justify-center py-16 text-center gap-4">
|
|
732
|
+
<Package className="w-16 h-16 text-mw-neutral-400" />
|
|
733
|
+
<Heading level={4}>No creatives found</Heading>
|
|
734
|
+
<Text size="sm" variant="muted" className="max-w-sm">
|
|
735
|
+
Upload your first creative to get started, or adjust your
|
|
736
|
+
filters.
|
|
737
|
+
</Text>
|
|
738
|
+
<Button onClick={() => setUploadDialogOpen(true)}>
|
|
739
|
+
<Upload className="w-4 h-4 mr-2" />
|
|
740
|
+
Upload Creatives
|
|
741
|
+
</Button>
|
|
742
|
+
</div>
|
|
743
|
+
) : viewMode === "grid" ? (
|
|
744
|
+
<div className="px-6 py-4">
|
|
745
|
+
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3">
|
|
746
|
+
{sortedCreatives.map((creative) => {
|
|
747
|
+
const cType = getCreativeType(creative.mime_type);
|
|
748
|
+
const TypeIcon = TYPE_ICONS[cType] || FileText;
|
|
749
|
+
return (
|
|
750
|
+
<Card
|
|
751
|
+
key={creative.id}
|
|
752
|
+
className="relative overflow-hidden cursor-pointer hover:shadow-md transition-shadow"
|
|
753
|
+
onClick={() => handlePreview(creative)}
|
|
754
|
+
>
|
|
755
|
+
<div
|
|
756
|
+
className={`aspect-video flex items-center justify-center ${TYPE_COLORS[cType] || "bg-muted"}`}
|
|
757
|
+
>
|
|
758
|
+
{creative.thumbnail ? (
|
|
759
|
+
<img
|
|
760
|
+
src={creative.thumbnail}
|
|
761
|
+
alt={creative.filename}
|
|
762
|
+
className="w-full h-full object-cover"
|
|
763
|
+
/>
|
|
764
|
+
) : (
|
|
765
|
+
<TypeIcon className="h-10 w-10 text-muted-foreground/50" />
|
|
766
|
+
)}
|
|
767
|
+
</div>
|
|
768
|
+
<div className="absolute top-2 right-2">
|
|
769
|
+
<StatusBadge status={creative.status} />
|
|
770
|
+
</div>
|
|
771
|
+
<div
|
|
772
|
+
className="absolute top-2 left-2"
|
|
773
|
+
onClick={(e) => e.stopPropagation()}
|
|
774
|
+
>
|
|
775
|
+
<DropdownMenu>
|
|
776
|
+
<DropdownMenuTrigger asChild>
|
|
777
|
+
<Button
|
|
778
|
+
variant="secondary"
|
|
779
|
+
size="sm"
|
|
780
|
+
className="h-7 w-7 p-0"
|
|
781
|
+
>
|
|
782
|
+
<MoreVertical className="h-4 w-4" />
|
|
783
|
+
</Button>
|
|
784
|
+
</DropdownMenuTrigger>
|
|
785
|
+
<DropdownMenuContent align="left">
|
|
786
|
+
<DropdownMenuItem
|
|
787
|
+
onClick={() => handlePreview(creative)}
|
|
788
|
+
>
|
|
789
|
+
<Eye className="h-4 w-4 mr-2" />
|
|
790
|
+
Preview
|
|
791
|
+
</DropdownMenuItem>
|
|
792
|
+
<DropdownMenuItem
|
|
793
|
+
onClick={() =>
|
|
794
|
+
window.open(creative.cdn_path, "_blank")
|
|
795
|
+
}
|
|
796
|
+
>
|
|
797
|
+
<Download className="h-4 w-4 mr-2" />
|
|
798
|
+
Download
|
|
799
|
+
</DropdownMenuItem>
|
|
800
|
+
<DropdownMenuItem
|
|
801
|
+
onClick={() => setTranscodeCreative(creative)}
|
|
802
|
+
>
|
|
803
|
+
<Wand2 className="h-4 w-4 mr-2" />
|
|
804
|
+
Transcode
|
|
805
|
+
</DropdownMenuItem>
|
|
806
|
+
<DropdownMenuItem
|
|
807
|
+
className="text-destructive"
|
|
808
|
+
onClick={() => handleDeleteCreative(creative)}
|
|
809
|
+
>
|
|
810
|
+
<Trash2 className="h-4 w-4 mr-2" />
|
|
811
|
+
Delete
|
|
812
|
+
</DropdownMenuItem>
|
|
813
|
+
</DropdownMenuContent>
|
|
814
|
+
</DropdownMenu>
|
|
815
|
+
</div>
|
|
816
|
+
<CardContent className="p-3 space-y-1.5">
|
|
817
|
+
<p
|
|
818
|
+
className="font-medium text-sm truncate"
|
|
819
|
+
title={creative.filename}
|
|
820
|
+
>
|
|
821
|
+
{creative.filename}
|
|
822
|
+
</p>
|
|
823
|
+
<div className="flex items-center gap-2 text-xs text-muted-foreground">
|
|
824
|
+
<span className="capitalize">{cType}</span>
|
|
825
|
+
<span>•</span>
|
|
826
|
+
<span>
|
|
827
|
+
{creative.width && creative.height
|
|
828
|
+
? `${creative.width}x${creative.height}`
|
|
829
|
+
: creative.format}
|
|
830
|
+
</span>
|
|
831
|
+
</div>
|
|
832
|
+
{creative.tags && creative.tags.length > 0 && (
|
|
833
|
+
<div className="flex flex-wrap gap-1">
|
|
834
|
+
{creative.tags.slice(0, 3).map((tag) => (
|
|
835
|
+
<Badge
|
|
836
|
+
key={tag}
|
|
837
|
+
variant="outline"
|
|
838
|
+
className="text-xs"
|
|
839
|
+
>
|
|
840
|
+
{tag}
|
|
841
|
+
</Badge>
|
|
842
|
+
))}
|
|
843
|
+
{creative.tags.length > 3 && (
|
|
844
|
+
<Badge variant="outline" className="text-xs">
|
|
845
|
+
+{creative.tags.length - 3}
|
|
846
|
+
</Badge>
|
|
847
|
+
)}
|
|
848
|
+
</div>
|
|
849
|
+
)}
|
|
850
|
+
<div className="flex items-center justify-between text-xs text-muted-foreground pt-1">
|
|
851
|
+
<span>{formatBytes(creative.size_bytes)}</span>
|
|
852
|
+
<span>{formatDate(creative.created_at)}</span>
|
|
853
|
+
</div>
|
|
854
|
+
</CardContent>
|
|
855
|
+
</Card>
|
|
856
|
+
);
|
|
857
|
+
})}
|
|
858
|
+
</div>
|
|
859
|
+
</div>
|
|
860
|
+
) : (
|
|
861
|
+
<div className="px-6 py-4">
|
|
862
|
+
<AgGridTable
|
|
863
|
+
rowData={sortedCreatives}
|
|
864
|
+
columnDefs={contentHubColumnDefs}
|
|
865
|
+
getRowId={(row) => row.id}
|
|
866
|
+
loading={false}
|
|
867
|
+
emptyMessage="No creatives found."
|
|
868
|
+
sortState={contentHubSortState}
|
|
869
|
+
onSortChange={handleAgGridSortChange}
|
|
870
|
+
domLayout="autoHeight"
|
|
871
|
+
serverSidePagination={true}
|
|
872
|
+
serverSideConfig={{
|
|
873
|
+
totalCount: totalItems,
|
|
874
|
+
currentPage,
|
|
875
|
+
pageSize,
|
|
876
|
+
onPageChange: handlePageChange,
|
|
877
|
+
onPageSizeChange: handlePageSizeChange,
|
|
878
|
+
pageSizeSelector: [10, 20, 50, 100],
|
|
879
|
+
}}
|
|
880
|
+
/>
|
|
881
|
+
</div>
|
|
882
|
+
)}
|
|
883
|
+
</div>
|
|
884
|
+
</Card>
|
|
885
|
+
|
|
886
|
+
<Sheet open={previewOpen} onOpenChange={setPreviewOpen}>
|
|
887
|
+
<SheetContent side="right" className="w-[600px] p-0 overflow-y-auto">
|
|
888
|
+
{selectedCreative && (
|
|
889
|
+
<>
|
|
890
|
+
<SheetHeader className="p-4 border-b sticky top-0 bg-background z-10">
|
|
891
|
+
<div className="flex items-center justify-between">
|
|
892
|
+
<SheetTitle className="text-base truncate pr-4">
|
|
893
|
+
{selectedCreative.filename}
|
|
894
|
+
</SheetTitle>
|
|
895
|
+
</div>
|
|
896
|
+
</SheetHeader>
|
|
897
|
+
|
|
898
|
+
<div className="w-full aspect-video bg-muted">
|
|
899
|
+
{(() => {
|
|
900
|
+
const cType = getCreativeType(selectedCreative.mime_type);
|
|
901
|
+
const TypeIcon = TYPE_ICONS[cType] || FileText;
|
|
902
|
+
if (selectedCreative.thumbnail || selectedCreative.cdn_path) {
|
|
903
|
+
if (cType === "video") {
|
|
904
|
+
return (
|
|
905
|
+
<video
|
|
906
|
+
src={
|
|
907
|
+
selectedCreative.cdn_path ||
|
|
908
|
+
selectedCreative.thumbnail
|
|
909
|
+
}
|
|
910
|
+
controls
|
|
911
|
+
className="w-full h-full object-contain"
|
|
912
|
+
/>
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
return (
|
|
916
|
+
<img
|
|
917
|
+
src={
|
|
918
|
+
selectedCreative.thumbnail ||
|
|
919
|
+
selectedCreative.cdn_path
|
|
920
|
+
}
|
|
921
|
+
alt={selectedCreative.filename}
|
|
922
|
+
className="w-full h-full object-contain"
|
|
923
|
+
/>
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
return (
|
|
927
|
+
<div
|
|
928
|
+
className={`w-full h-full flex items-center justify-center ${TYPE_COLORS[cType] || "bg-muted"}`}
|
|
929
|
+
>
|
|
930
|
+
<TypeIcon className="h-16 w-16 text-muted-foreground/50" />
|
|
931
|
+
</div>
|
|
932
|
+
);
|
|
933
|
+
})()}
|
|
934
|
+
</div>
|
|
935
|
+
|
|
936
|
+
<div className="p-6 space-y-6">
|
|
937
|
+
<div>
|
|
938
|
+
<div className="flex items-center justify-between mb-4">
|
|
939
|
+
<h3 className="text-sm font-semibold">Status</h3>
|
|
940
|
+
<StatusBadge status={selectedCreative.status} />
|
|
941
|
+
</div>
|
|
942
|
+
<div className="flex gap-2">
|
|
943
|
+
<Button
|
|
944
|
+
variant="outline"
|
|
945
|
+
size="sm"
|
|
946
|
+
className="text-green-600 border-green-300 hover:bg-green-50 dark:text-green-400 dark:border-green-700 dark:hover:bg-green-900/20"
|
|
947
|
+
onClick={() => setApproveDialogOpen(true)}
|
|
948
|
+
disabled={
|
|
949
|
+
selectedCreative.status === "approved" ||
|
|
950
|
+
approveCreativeMutation.isPending
|
|
951
|
+
}
|
|
952
|
+
>
|
|
953
|
+
<Check className="w-4 h-4 mr-1" />
|
|
954
|
+
Accept
|
|
955
|
+
</Button>
|
|
956
|
+
<Button
|
|
957
|
+
variant="outline"
|
|
958
|
+
size="sm"
|
|
959
|
+
className="text-red-600 border-red-300 hover:bg-red-50 dark:text-red-400 dark:border-red-700 dark:hover:bg-red-900/20"
|
|
960
|
+
onClick={() => setRejectDialogOpen(true)}
|
|
961
|
+
disabled={
|
|
962
|
+
selectedCreative.status === "rejected" ||
|
|
963
|
+
rejectCreativeMutation.isPending
|
|
964
|
+
}
|
|
965
|
+
>
|
|
966
|
+
<XCircle className="w-4 h-4 mr-1" />
|
|
967
|
+
Mark Inadequate
|
|
968
|
+
</Button>
|
|
969
|
+
</div>
|
|
970
|
+
</div>
|
|
971
|
+
|
|
972
|
+
<Separator />
|
|
973
|
+
|
|
974
|
+
<div>
|
|
975
|
+
<h3 className="text-sm font-semibold mb-4">
|
|
976
|
+
Creative Information
|
|
977
|
+
</h3>
|
|
978
|
+
<div className="grid grid-cols-2 gap-4">
|
|
979
|
+
<div>
|
|
980
|
+
<p className="text-xs text-muted-foreground mb-1">Type</p>
|
|
981
|
+
<p className="text-sm font-medium capitalize">
|
|
982
|
+
{getCreativeType(selectedCreative.mime_type)}
|
|
983
|
+
</p>
|
|
984
|
+
</div>
|
|
985
|
+
<div>
|
|
986
|
+
<p className="text-xs text-muted-foreground mb-1">
|
|
987
|
+
Format
|
|
988
|
+
</p>
|
|
989
|
+
<p className="text-sm font-medium">
|
|
990
|
+
{selectedCreative.format}
|
|
991
|
+
</p>
|
|
992
|
+
</div>
|
|
993
|
+
<div>
|
|
994
|
+
<p className="text-xs text-muted-foreground mb-1">
|
|
995
|
+
Dimensions
|
|
996
|
+
</p>
|
|
997
|
+
<p className="text-sm font-medium">
|
|
998
|
+
{selectedCreative.width && selectedCreative.height
|
|
999
|
+
? `${selectedCreative.width}x${selectedCreative.height}`
|
|
1000
|
+
: "N/A"}
|
|
1001
|
+
</p>
|
|
1002
|
+
</div>
|
|
1003
|
+
<div>
|
|
1004
|
+
<p className="text-xs text-muted-foreground mb-1">
|
|
1005
|
+
File Size
|
|
1006
|
+
</p>
|
|
1007
|
+
<p className="text-sm font-medium">
|
|
1008
|
+
{formatBytes(selectedCreative.size_bytes)}
|
|
1009
|
+
</p>
|
|
1010
|
+
</div>
|
|
1011
|
+
{selectedCreative.duration_seconds && (
|
|
1012
|
+
<div>
|
|
1013
|
+
<p className="text-xs text-muted-foreground mb-1">
|
|
1014
|
+
Duration
|
|
1015
|
+
</p>
|
|
1016
|
+
<p className="text-sm font-medium">
|
|
1017
|
+
{Math.round(selectedCreative.duration_seconds)}s
|
|
1018
|
+
</p>
|
|
1019
|
+
</div>
|
|
1020
|
+
)}
|
|
1021
|
+
<div>
|
|
1022
|
+
<p className="text-xs text-muted-foreground mb-1">
|
|
1023
|
+
Uploaded
|
|
1024
|
+
</p>
|
|
1025
|
+
<p className="text-sm font-medium">
|
|
1026
|
+
{new Date(
|
|
1027
|
+
selectedCreative.created_at,
|
|
1028
|
+
).toLocaleString()}
|
|
1029
|
+
</p>
|
|
1030
|
+
</div>
|
|
1031
|
+
{selectedCreative.approved_at && (
|
|
1032
|
+
<div>
|
|
1033
|
+
<p className="text-xs text-muted-foreground mb-1">
|
|
1034
|
+
Approved
|
|
1035
|
+
</p>
|
|
1036
|
+
<p className="text-sm font-medium">
|
|
1037
|
+
{new Date(
|
|
1038
|
+
selectedCreative.approved_at,
|
|
1039
|
+
).toLocaleString()}
|
|
1040
|
+
</p>
|
|
1041
|
+
</div>
|
|
1042
|
+
)}
|
|
1043
|
+
{selectedCreative.approved_by && (
|
|
1044
|
+
<div>
|
|
1045
|
+
<p className="text-xs text-muted-foreground mb-1">
|
|
1046
|
+
Approved By
|
|
1047
|
+
</p>
|
|
1048
|
+
<p className="text-sm font-medium">
|
|
1049
|
+
{selectedCreative.approved_by}
|
|
1050
|
+
</p>
|
|
1051
|
+
</div>
|
|
1052
|
+
)}
|
|
1053
|
+
</div>
|
|
1054
|
+
</div>
|
|
1055
|
+
|
|
1056
|
+
<Separator />
|
|
1057
|
+
|
|
1058
|
+
<div>
|
|
1059
|
+
<h3 className="text-sm font-semibold mb-3">Tags</h3>
|
|
1060
|
+
<div className="flex flex-wrap gap-2 mb-3">
|
|
1061
|
+
{selectedCreative.tags &&
|
|
1062
|
+
selectedCreative.tags.length > 0 ? (
|
|
1063
|
+
selectedCreative.tags.map((tag) => (
|
|
1064
|
+
<Badge
|
|
1065
|
+
key={tag}
|
|
1066
|
+
variant="secondary"
|
|
1067
|
+
className="flex items-center gap-1"
|
|
1068
|
+
>
|
|
1069
|
+
{tag}
|
|
1070
|
+
<Button
|
|
1071
|
+
variant="ghost"
|
|
1072
|
+
size="sm"
|
|
1073
|
+
isIconOnly
|
|
1074
|
+
onClick={() => handleRemoveTag(tag)}
|
|
1075
|
+
className="ml-1 h-auto w-auto p-0"
|
|
1076
|
+
>
|
|
1077
|
+
<X className="w-3 h-3" />
|
|
1078
|
+
</Button>
|
|
1079
|
+
</Badge>
|
|
1080
|
+
))
|
|
1081
|
+
) : (
|
|
1082
|
+
<Text size="sm" variant="muted">
|
|
1083
|
+
No tags
|
|
1084
|
+
</Text>
|
|
1085
|
+
)}
|
|
1086
|
+
</div>
|
|
1087
|
+
<div className="flex gap-2">
|
|
1088
|
+
<Input
|
|
1089
|
+
placeholder="Add a tag..."
|
|
1090
|
+
value={newTag}
|
|
1091
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
1092
|
+
setNewTag(e.target.value)
|
|
1093
|
+
}
|
|
1094
|
+
onKeyDown={(e: React.KeyboardEvent) => {
|
|
1095
|
+
if (e.key === "Enter") {
|
|
1096
|
+
e.preventDefault();
|
|
1097
|
+
handleAddTag();
|
|
1098
|
+
}
|
|
1099
|
+
}}
|
|
1100
|
+
className="flex-1"
|
|
1101
|
+
/>
|
|
1102
|
+
<Button
|
|
1103
|
+
variant="outline"
|
|
1104
|
+
size="sm"
|
|
1105
|
+
onClick={handleAddTag}
|
|
1106
|
+
disabled={!newTag.trim()}
|
|
1107
|
+
>
|
|
1108
|
+
<Plus className="w-4 h-4" />
|
|
1109
|
+
</Button>
|
|
1110
|
+
</div>
|
|
1111
|
+
</div>
|
|
1112
|
+
|
|
1113
|
+
<Separator />
|
|
1114
|
+
|
|
1115
|
+
<div className="flex gap-2">
|
|
1116
|
+
<Button
|
|
1117
|
+
variant="outline"
|
|
1118
|
+
className="flex-1"
|
|
1119
|
+
onClick={() =>
|
|
1120
|
+
window.open(selectedCreative.cdn_path, "_blank")
|
|
1121
|
+
}
|
|
1122
|
+
>
|
|
1123
|
+
<Download className="w-4 h-4 mr-2" />
|
|
1124
|
+
Download
|
|
1125
|
+
</Button>
|
|
1126
|
+
<Button
|
|
1127
|
+
variant="outline"
|
|
1128
|
+
className="flex-1"
|
|
1129
|
+
onClick={() => setTranscodeCreative(selectedCreative)}
|
|
1130
|
+
>
|
|
1131
|
+
<Wand2 className="w-4 h-4 mr-2" />
|
|
1132
|
+
Transcode
|
|
1133
|
+
</Button>
|
|
1134
|
+
<Button
|
|
1135
|
+
variant="outline"
|
|
1136
|
+
className="flex-1 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20"
|
|
1137
|
+
onClick={() => handleDeleteCreative(selectedCreative)}
|
|
1138
|
+
>
|
|
1139
|
+
<Trash2 className="w-4 h-4 mr-2" />
|
|
1140
|
+
Delete
|
|
1141
|
+
</Button>
|
|
1142
|
+
</div>
|
|
1143
|
+
</div>
|
|
1144
|
+
</>
|
|
1145
|
+
)}
|
|
1146
|
+
</SheetContent>
|
|
1147
|
+
</Sheet>
|
|
1148
|
+
|
|
1149
|
+
<Sheet open={filterOpen} onOpenChange={setFilterOpen}>
|
|
1150
|
+
<SheetContent side="right" className="w-[400px]">
|
|
1151
|
+
<SheetHeader>
|
|
1152
|
+
<SheetTitle>Filter Creatives</SheetTitle>
|
|
1153
|
+
</SheetHeader>
|
|
1154
|
+
<div className="py-6 space-y-6">
|
|
1155
|
+
<div className="space-y-2">
|
|
1156
|
+
<Label>Status</Label>
|
|
1157
|
+
<Select
|
|
1158
|
+
options={[
|
|
1159
|
+
{ value: "all", label: "All Statuses" },
|
|
1160
|
+
{ value: CreativeStatus.DRAFT, label: "Processing" },
|
|
1161
|
+
{ value: CreativeStatus.APPROVED, label: "Accepted" },
|
|
1162
|
+
{ value: CreativeStatus.REJECTED, label: "Inadequate" },
|
|
1163
|
+
]}
|
|
1164
|
+
value={statusFilter}
|
|
1165
|
+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) =>
|
|
1166
|
+
setStatusFilter(e.target.value)
|
|
1167
|
+
}
|
|
1168
|
+
>
|
|
1169
|
+
<SelectTrigger>
|
|
1170
|
+
<SelectValue placeholder="All Statuses" />
|
|
1171
|
+
</SelectTrigger>
|
|
1172
|
+
<SelectContent>
|
|
1173
|
+
<SelectItem value="all">All Statuses</SelectItem>
|
|
1174
|
+
<SelectItem value={CreativeStatus.DRAFT}>
|
|
1175
|
+
Processing
|
|
1176
|
+
</SelectItem>
|
|
1177
|
+
<SelectItem value={CreativeStatus.APPROVED}>
|
|
1178
|
+
Accepted
|
|
1179
|
+
</SelectItem>
|
|
1180
|
+
<SelectItem value={CreativeStatus.REJECTED}>
|
|
1181
|
+
Inadequate
|
|
1182
|
+
</SelectItem>
|
|
1183
|
+
</SelectContent>
|
|
1184
|
+
</Select>
|
|
1185
|
+
</div>
|
|
1186
|
+
|
|
1187
|
+
<div className="space-y-2">
|
|
1188
|
+
<Label>Type</Label>
|
|
1189
|
+
<Select
|
|
1190
|
+
options={[
|
|
1191
|
+
{ value: "all", label: "All Types" },
|
|
1192
|
+
{ value: "image", label: "Image" },
|
|
1193
|
+
{ value: "video", label: "Video" },
|
|
1194
|
+
{ value: "audio", label: "Audio" },
|
|
1195
|
+
]}
|
|
1196
|
+
value={typeFilter}
|
|
1197
|
+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) =>
|
|
1198
|
+
setTypeFilter(e.target.value)
|
|
1199
|
+
}
|
|
1200
|
+
>
|
|
1201
|
+
<SelectTrigger>
|
|
1202
|
+
<SelectValue placeholder="All Types" />
|
|
1203
|
+
</SelectTrigger>
|
|
1204
|
+
<SelectContent>
|
|
1205
|
+
<SelectItem value="all">All Types</SelectItem>
|
|
1206
|
+
<SelectItem value="image">Image</SelectItem>
|
|
1207
|
+
<SelectItem value="video">Video</SelectItem>
|
|
1208
|
+
<SelectItem value="audio">Audio</SelectItem>
|
|
1209
|
+
</SelectContent>
|
|
1210
|
+
</Select>
|
|
1211
|
+
</div>
|
|
1212
|
+
|
|
1213
|
+
<div className="space-y-2">
|
|
1214
|
+
<Label>Folder</Label>
|
|
1215
|
+
<Select
|
|
1216
|
+
options={[
|
|
1217
|
+
{ value: "all", label: "All Folders" },
|
|
1218
|
+
...folders.map((f) => ({ value: f.id, label: f.name })),
|
|
1219
|
+
]}
|
|
1220
|
+
value={folderFilter}
|
|
1221
|
+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) =>
|
|
1222
|
+
setFolderFilter(e.target.value)
|
|
1223
|
+
}
|
|
1224
|
+
>
|
|
1225
|
+
<SelectTrigger>
|
|
1226
|
+
<SelectValue placeholder="All Folders" />
|
|
1227
|
+
</SelectTrigger>
|
|
1228
|
+
<SelectContent>
|
|
1229
|
+
<SelectItem value="all">All Folders</SelectItem>
|
|
1230
|
+
{folders.map((folder) => (
|
|
1231
|
+
<SelectItem key={folder.id} value={folder.id}>
|
|
1232
|
+
{folder.name}
|
|
1233
|
+
</SelectItem>
|
|
1234
|
+
))}
|
|
1235
|
+
</SelectContent>
|
|
1236
|
+
</Select>
|
|
1237
|
+
</div>
|
|
1238
|
+
</div>
|
|
1239
|
+
<div className="flex gap-2 pt-4 border-t">
|
|
1240
|
+
<Button
|
|
1241
|
+
variant="outline"
|
|
1242
|
+
className="flex-1"
|
|
1243
|
+
onClick={handleClearFilters}
|
|
1244
|
+
>
|
|
1245
|
+
Clear All
|
|
1246
|
+
</Button>
|
|
1247
|
+
<Button
|
|
1248
|
+
variant="primary"
|
|
1249
|
+
className="flex-1"
|
|
1250
|
+
onClick={() => {
|
|
1251
|
+
setCurrentPage(1);
|
|
1252
|
+
setFilterOpen(false);
|
|
1253
|
+
}}
|
|
1254
|
+
>
|
|
1255
|
+
Apply Filters
|
|
1256
|
+
</Button>
|
|
1257
|
+
</div>
|
|
1258
|
+
</SheetContent>
|
|
1259
|
+
</Sheet>
|
|
1260
|
+
|
|
1261
|
+
<CreateFolderDialog
|
|
1262
|
+
open={createFolderOpen}
|
|
1263
|
+
onOpenChange={setCreateFolderOpen}
|
|
1264
|
+
/>
|
|
1265
|
+
|
|
1266
|
+
<UpdateFolderDialog
|
|
1267
|
+
open={updateFolderOpen}
|
|
1268
|
+
onOpenChange={setUpdateFolderOpen}
|
|
1269
|
+
folder={selectedFolder}
|
|
1270
|
+
/>
|
|
1271
|
+
|
|
1272
|
+
<DeleteFolderDialog
|
|
1273
|
+
open={deleteFolderOpen}
|
|
1274
|
+
onOpenChange={setDeleteFolderOpen}
|
|
1275
|
+
folder={selectedFolder}
|
|
1276
|
+
/>
|
|
1277
|
+
|
|
1278
|
+
<CreativeUpload
|
|
1279
|
+
open={uploadDialogOpen}
|
|
1280
|
+
onOpenChange={setUploadDialogOpen}
|
|
1281
|
+
onUploadComplete={() => {
|
|
1282
|
+
setUploadDialogOpen(false);
|
|
1283
|
+
refetchCreatives();
|
|
1284
|
+
}}
|
|
1285
|
+
/>
|
|
1286
|
+
|
|
1287
|
+
{selectedCreative && (
|
|
1288
|
+
<>
|
|
1289
|
+
<ApproveDialog
|
|
1290
|
+
open={approveDialogOpen}
|
|
1291
|
+
onOpenChange={setApproveDialogOpen}
|
|
1292
|
+
creativeFilename={selectedCreative.filename}
|
|
1293
|
+
onConfirm={handleApprove}
|
|
1294
|
+
isPending={approveCreativeMutation.isPending}
|
|
1295
|
+
/>
|
|
1296
|
+
|
|
1297
|
+
<RejectDialog
|
|
1298
|
+
open={rejectDialogOpen}
|
|
1299
|
+
onOpenChange={setRejectDialogOpen}
|
|
1300
|
+
creativeFilename={selectedCreative.filename}
|
|
1301
|
+
onConfirm={handleReject}
|
|
1302
|
+
isPending={rejectCreativeMutation.isPending}
|
|
1303
|
+
/>
|
|
1304
|
+
</>
|
|
1305
|
+
)}
|
|
1306
|
+
|
|
1307
|
+
<Dialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
|
|
1308
|
+
<DialogContent className="max-w-md">
|
|
1309
|
+
<DialogHeader>
|
|
1310
|
+
<DialogTitle>Delete Creative</DialogTitle>
|
|
1311
|
+
</DialogHeader>
|
|
1312
|
+
<div className="py-4">
|
|
1313
|
+
<Text>
|
|
1314
|
+
Are you sure you want to delete{" "}
|
|
1315
|
+
<strong>{creativeToDelete?.filename}</strong>?
|
|
1316
|
+
</Text>
|
|
1317
|
+
<Text size="sm" variant="muted" className="mt-2">
|
|
1318
|
+
This action cannot be undone.
|
|
1319
|
+
</Text>
|
|
1320
|
+
</div>
|
|
1321
|
+
<DialogFooter>
|
|
1322
|
+
<Button
|
|
1323
|
+
variant="outline"
|
|
1324
|
+
onClick={() => {
|
|
1325
|
+
setDeleteDialogOpen(false);
|
|
1326
|
+
setCreativeToDelete(null);
|
|
1327
|
+
}}
|
|
1328
|
+
>
|
|
1329
|
+
Cancel
|
|
1330
|
+
</Button>
|
|
1331
|
+
<Button
|
|
1332
|
+
variant="destructive"
|
|
1333
|
+
onClick={confirmDeleteCreative}
|
|
1334
|
+
disabled={deleteCreativeMutation.isPending}
|
|
1335
|
+
>
|
|
1336
|
+
{deleteCreativeMutation.isPending ? (
|
|
1337
|
+
<>
|
|
1338
|
+
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
|
1339
|
+
Deleting...
|
|
1340
|
+
</>
|
|
1341
|
+
) : (
|
|
1342
|
+
"Delete"
|
|
1343
|
+
)}
|
|
1344
|
+
</Button>
|
|
1345
|
+
</DialogFooter>
|
|
1346
|
+
</DialogContent>
|
|
1347
|
+
</Dialog>
|
|
1348
|
+
|
|
1349
|
+
{transcodeCreative && (
|
|
1350
|
+
<TranscodeDialog
|
|
1351
|
+
creative={transcodeCreative}
|
|
1352
|
+
onTranscode={handleTranscode}
|
|
1353
|
+
isTranscoding={transcodeCreativeMutation.isPending}
|
|
1354
|
+
/>
|
|
1355
|
+
)}
|
|
1356
|
+
</div>
|
|
1357
|
+
);
|
|
1358
|
+
}
|