From 45d7a7de1af419be80459dc10a933c757f0fb556 Mon Sep 17 00:00:00 2001 From: susie-laptop Date: Wed, 28 May 2025 21:28:25 -0400 Subject: [PATCH] [dev]campaign tabs --- src/lib/constant.js | 64 +++---- src/pages/CampaignDetail.jsx | 345 ++++++++++++++++++++++++++++++++++- src/styles/Campaign.scss | 64 +++++++ 3 files changed, 428 insertions(+), 45 deletions(-) diff --git a/src/lib/constant.js b/src/lib/constant.js index 55ec385..137e64a 100644 --- a/src/lib/constant.js +++ b/src/lib/constant.js @@ -114,40 +114,32 @@ export const CREATOR_LEVELS = [ ]; export const CREATOR_CATEGORIES = [ - { - value: 'Phones & Electronics', - name: 'Phones & Electronics', - }, - { - value: 'Womenswear & Underwear', - name: 'Womenswear & Underwear', - }, - { - value: 'Sports & Outdoor', - name: 'Sports & Outdoor', - }, - { - value: 'Food & Beverage', - name: 'Food & Beverage', - }, - { - value: 'Health', - name: 'Health', - }, - { - value: 'Kitchenware', - name: 'Kitchenware', - }, - { - value: 'Household Appliances', - name: 'Household Appliances', - }, - { - value: 'Womensware & Underwear', - name: 'Womensware & Underwear', - }, - { - value: 'Other', - name: 'Other', - }, + { value: 'Phones & Electronics', name: 'Phones & Electronics' }, + { value: 'Homes Supplies', name: 'Homes Supplies' }, + { value: 'Health', name: 'Health' }, + { value: 'Textiles & Soft Furnishings', name: 'Textiles & Soft Furnishings' }, + { value: 'Household Appliances', name: 'Household Appliances' }, + { value: 'Womenswear & Underwear', name: 'Womenswear & Underwear' }, + { value: 'Muslim Fashion', name: 'Muslim Fashion' }, + { value: 'Shoes', name: 'Shoes' }, + { value: 'Beauty & Personal Care', name: 'Beauty & Personal Care' }, + { value: 'Pet Supplies', name: 'Pet Supplies' }, + { value: 'Computers & Office Equipment', name: 'Computers & Office Equipment' }, + { value: 'Baby & Maternity', name: 'Baby & Maternity' }, + { value: 'Sports & Outdoor', name: 'Sports & Outdoor' }, + { value: 'Toys', name: 'Toys' }, + { value: 'Furniture', name: 'Furniture' }, + { value: 'Kitchenware', name: 'Kitchenware' }, + { value: 'Home Improvement', name: 'Home Improvement' }, + { value: 'Tools & Hardware', name: 'Tools & Hardware' }, + { value: "Kids' Fashion", name: "Kids' Fashion" }, + { value: 'Automotive & Motorcycle', name: 'Automotive & Motorcycle' }, + { value: 'Fashion Accessories', name: 'Fashion Accessories' }, + { value: 'Food & Beverages', name: 'Food & Beverages' }, + { value: 'Books, Magazines & Audio', name: 'Books, Magazines & Audio' }, + { value: 'Menswear & Underwear', name: 'Menswear & Underwear' }, + { value: 'Pre-Owned Collections', name: 'Pre-Owned Collections' }, + { value: 'Luggage & Bags', name: 'Luggage & Bags' }, + { value: 'Jewellery Accessories & Derivatives', name: 'Jewellery Accessories & Derivatives' }, + { value: 'Other', name: 'Other' }, ]; diff --git a/src/pages/CampaignDetail.jsx b/src/pages/CampaignDetail.jsx index fde2571..bc5b0ca 100644 --- a/src/pages/CampaignDetail.jsx +++ b/src/pages/CampaignDetail.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { Link, useParams } from 'react-router-dom'; import SearchBar from '../components/SearchBar'; -import { Button, Form, Modal } from 'react-bootstrap'; +import { Button, Col, Form, Modal, Row, Spinner, Table } from 'react-bootstrap'; import { useSelector, useDispatch } from 'react-redux'; import { fetchBrands, fetchBrandDetail, fetchCampaignDetail, setSelectedProduct } from '../store/slices/brandsSlice'; import CampaignInfo from '../components/CampaignInfo'; @@ -134,18 +134,27 @@ export default function CampaignDetail() { Add Product - + setShowProductDetail(false)} title='Product Detail' size='xxl' > - + - setShowAddProductModal(false)} /> + setShowAddProductModal(false)} + /> )} + {activeTab === 'accepted_creators' && } + {activeTab === 'matching_result' && } ) ); @@ -184,11 +193,12 @@ function AddProductModal({ campaignId, show, onHide }) { onChange={(e) => setSelectedProduct(e.target.value)} > - {products?.length > 0 && products.map((product) => ( - - ))} + {products?.length > 0 && + products.map((product) => ( + + ))}
@@ -204,3 +214,320 @@ function AddProductModal({ campaignId, show, onHide }) { ); } + +function AcceptedCreators() { + const { selectedCampaign } = useSelector((state) => state.brands); + + const handleSort = (field) => { + return; + console.log(field); + }; + + const renderSortIcon = (field) => { + return; + return ; + }; + + const renderStatusPill = (status) => { + switch (status) { + case 'unconnected': + return Unconnected; + case 'connected': + return Connected; + case 'pending': + return Pending; + case 'rejected': + return Rejected; + case 'accepted': + return Accepted; + case 'provided': + return Provided; + case 'completed': + return Completed; + case 'draft': + return Draft; + case 'published': + return Published; + default: + return Unknown; + } + }; + + return ( +
+
+ + + + {/* */} + + + + + + + + + + + + + {!selectedCampaign?.creators || selectedCampaign?.creators?.length <= 0 ? ( + <> + + + + + + + + ) : ( + selectedCampaign?.creators?.map((creator) => ( + + {/* */} + + + + + + + + + + + + )) + )} + +
+ 0 + } + onChange={handleSelectAll} + /> + handleSort('name')} style={{ width: '180px' }}> + Creator {renderSortIcon('name')} + handleSort('category')} + style={{ width: '180px' }} + > + Category {renderSortIcon('category')} + handleSort('followers')}> + Followers {renderSortIcon('followers')} + handleSort('gmv')}> + GMV {renderSortIcon('gmv')} + handleSort('avg_video_views')}> + Avg. Video Views {renderSortIcon('avg_video_views')} + StatusPricingCollaborationProfile
+ No creators found. +
+ +
+ handleSelectCreator(creator.creator_id)} + /> + +
+
+ {creator.name} + {creator.status && } +
+ + {creator.name} + +
+
+ + {creator.category} + + {creator.followers} +
{creator.gmv}
+
Items Sold: {creator.soldPercentage}
+
{creator.avg_video_views} +
{renderStatusPill(creator.status)}
+
{creator.pricing}{creator.collaboration}{creator.profile} + +
+
+
+ ); +} + +function StepProgress({ dates = [] }) { + const labels = [ + 'Brand Review', + 'Price Negotiation', + 'Creator Confirmation', + 'Draft Ready', + 'Draft Approved', + 'Published', + ]; + const steps = [ + { label: 'Brand Review', date: '12/30/2020' }, + { label: 'Price Negotiation', date: '12/30/2020' }, + { label: 'Creator Confirmation', date: '12/30/2020' }, + { label: 'Draft Ready', date: '12/30/2020' }, + { label: 'Draft Approved', date: '12/30/2020' }, + { label: 'Published', date: '12/30/2020' }, + ]; + return ( +
+
+ {steps.map((step, index) => { + const isCompleted = !!dates[index]; + return ( +
+
+ {isCompleted ? '✔' : ''}1 +
+ {index !== steps.length - 1 &&
} +
+ {step.label} +
+ {step.date || 'N/A'} +
+
+ ); + })} +
+ ); +} + +function MatchingResult() { + const [showMatchingResultModal, setShowMatchingResultModal] = useState(false); + + const mockData = [ + { + operation: 'Operation 1', + creator_find: 100, + creator_accepted: 100, + avg_creator_pricing: 100, + date: '2020-01-01', + }, + ]; + return ( +
+
+ + + + + + + + + + + + + {mockData.length > 0 ? ( + mockData.map((item, index) => ( + + + + + + + + + )) + ) : ( + + + + )} + +
# Operation# Creator Find# Creator AcceptedAvg. Creator PricingDateView Details
{item.operation}{item.creator_find}{item.creator_accepted}{item.avg_creator_pricing}{item.date} + +
+ No data +
+ setShowMatchingResultModal(false)} + /> +
+
+ ); +} + +function CampaignMatchingResult({ show, onHide }) { + const mockData = [ + { + creator: 'Creator 1', + category: 'Category 1', + followers: 100, + gmv: 100, + avg_video_views: 100, + status: 'Status 1', + pricing: 100, + profile: 'Profile 1', + }, + ]; + + return ( + + + Campaign Matching Result + + +
+
+ + + + + + + + + + + + + + + {mockData.length > 0 ? ( + mockData.map((item, index) => ( + + + + + + + + + + + )) + ) : ( + + + + )} + +
CreatorCategoryFollowersGMVAvg. Video ViewsStatusPricingProfile
{item.creator}{item.category}{item.followers}{item.gmv}{item.avg_video_views}{item.status}{item.pricing}{item.profile}
+ No data +
+
+
+
+
+ ); +} diff --git a/src/styles/Campaign.scss b/src/styles/Campaign.scss index b81a256..9aa8698 100644 --- a/src/styles/Campaign.scss +++ b/src/styles/Campaign.scss @@ -47,3 +47,67 @@ } } } + +.inline-step-progress { + display: flex; + align-items: center; + position: relative; + width: 100%; + justify-content: space-between; + padding: 16px 0 65px 0; + + .inline-step { + position: relative; + display: flex; + align-items: center; + width: 100%; + } + + .circle { + width: 14px; + height: 14px; + border-radius: 50%; + font-size: 10px; + display: flex; + justify-content: center; + align-items: center; + z-index: 1; + } + + .completed { + background-color: #6f6ee3; + color: white; + } + + .pending { + background-color: #fff; + border: 1px solid #ccc; + color: transparent; + } + + .line { + height: 2px; + width: 100%; + background-color: #ccc; + z-index: 0; + } + .label { + position: absolute; + top: 18px; + text-align: center; + left: -45%; + width: 100%; + .label-text { + display: inline-block; + } + .label-date { + display: inline-block; + } + } +} + +.matching-result-table { + th, td { + text-align: center; + } +} \ No newline at end of file