mirror of
https://github.com/Funkoala14/CreatorCenter_OOIN.git
synced 2025-06-07 22:58:14 +08:00
Compare commits
2 Commits
930c21ff2f
...
4653afdefe
Author | SHA1 | Date | |
---|---|---|---|
4653afdefe | |||
6fd9458d07 |
@ -4,6 +4,7 @@ import { fetchBrands } from '../store/slices/brandsSlice';
|
||||
import { Card } from 'react-bootstrap';
|
||||
import { Folders, Hash, Link, Users } from 'lucide-react';
|
||||
import SpinningComponent from './SpinningComponent';
|
||||
import { getBrandSourceName } from '../lib/utils';
|
||||
|
||||
export default function BrandsList({ openBrandDetail }) {
|
||||
const { brands, status, error } = useSelector((state) => state.brands);
|
||||
@ -37,7 +38,7 @@ export default function BrandsList({ openBrandDetail }) {
|
||||
<Folders size={16} />
|
||||
Category
|
||||
</span>
|
||||
<span className='card-text-content'>{brand.category}</span>
|
||||
<span className='card-text-content'>{brand.category || '--'}</span>
|
||||
</Card.Text>
|
||||
<Card.Text className=''>
|
||||
<span className='card-text-title'>
|
||||
@ -58,7 +59,7 @@ export default function BrandsList({ openBrandDetail }) {
|
||||
<Link size={16} />
|
||||
Source
|
||||
</span>
|
||||
<span className='card-text-content'>{brand.source}</span>
|
||||
<span className='card-text-content'>{getBrandSourceName(brand.source)}</span>
|
||||
</Card.Text>
|
||||
</Card.Body>
|
||||
</div>
|
||||
|
@ -70,7 +70,6 @@ export default function DiscoveryList() {
|
||||
function SeesionResultModal({ session, show, onHide }) {
|
||||
if (!show) return null;
|
||||
const { creators } = session || {};
|
||||
console.log(creators);
|
||||
return (
|
||||
<Modal show={show} onHide={onHide} size={creators.length > 0 ? 'xl' : ''}>
|
||||
<Modal.Header closeButton>
|
||||
@ -134,7 +133,7 @@ function SeesionResultModal({ session, show, onHide }) {
|
||||
</td>
|
||||
<td className='text-center'>
|
||||
<span className={`category-pill ${getCategoryClassName(creator.category)}`}>
|
||||
{creator.category}
|
||||
{creator.category || '--'}
|
||||
</span>
|
||||
</td>
|
||||
<td className='text-center'>
|
||||
|
@ -68,7 +68,7 @@ export default function InboxList() {
|
||||
<div className='list-content'>
|
||||
{status === 'loading' && <div>Loading...</div>}
|
||||
{status === 'failed' && <div>Error: {error}</div>}
|
||||
{status === 'succeeded' && inboxList.length > 0 &&
|
||||
{status === 'succeeded' && (inboxList.length > 0 ?
|
||||
inboxList.map((item) => (
|
||||
<div
|
||||
key={item.id}
|
||||
@ -91,7 +91,7 @@ export default function InboxList() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
)) : <div className='list-item-empty'>No Chats Found</div>)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -97,7 +97,7 @@ export default function ProductsList({ products, onShowProductDetail, type = 'de
|
||||
<tbody>
|
||||
{products?.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan='10' className='text-center py-4'>
|
||||
<td colSpan='11' className='text-center py-4'>
|
||||
No products found for this brand.
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,8 +0,0 @@
|
||||
export default function SessionResult() {
|
||||
return (
|
||||
<div>
|
||||
<h1>Session Result</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { Copy, Edit, FileText, LayoutTemplate } from 'lucide-react';
|
||||
import { Button } from 'react-bootstrap';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useSelector, useDispatch } from 'react-redux';
|
||||
import Spinning from './SpinningComponent';
|
||||
import { getTemplateDetail } from '../store/slices/inboxSlice';
|
||||
|
||||
export default function TemplateList({ activeTab, openModal, setFormData }) {
|
||||
const dispatch = useDispatch();
|
||||
const { templates, templatesStatus } = useSelector((state) => state.inbox);
|
||||
// 如果正在加载,显示加载中
|
||||
if (templatesStatus === 'loading') {
|
||||
@ -16,13 +18,14 @@ export default function TemplateList({ activeTab, openModal, setFormData }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const handleEdit = (template) => {
|
||||
const handleEdit = async (template) => {
|
||||
await dispatch(getTemplateDetail(template.id)).unwrap();
|
||||
setFormData({
|
||||
id: template.id,
|
||||
mission: template.type,
|
||||
platform: template.platform,
|
||||
service: template.service,
|
||||
content: template.preview,
|
||||
content: template?.content || template.preview,
|
||||
title: template.title,
|
||||
category: template.category,
|
||||
collaboration_type: template.collaboration_type,
|
||||
|
@ -145,7 +145,6 @@ export const CREATOR_CATEGORIES = [
|
||||
];
|
||||
|
||||
export const TEMPLATE_MISSIONS = [
|
||||
{ value: 'all', name: '全部' },
|
||||
{ value: 'initial_contact', name: '初步建联' },
|
||||
{ value: 'negotiation', name: '砍价邮件' },
|
||||
{ value: 'script', name: '脚本邮件' },
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { BRAND_SOURCES } from "./constant";
|
||||
|
||||
/**
|
||||
* 格式化日期
|
||||
* @param {Date} date - 要格式化的日期对象
|
||||
@ -51,3 +53,11 @@ export const getCategoryClassName = (category) => {
|
||||
|
||||
return categoryMap[category] || '';
|
||||
};
|
||||
|
||||
export const getBrandSourceName = (source) => {
|
||||
return BRAND_SOURCES.find(item => item.value === source)?.name || source;
|
||||
};
|
||||
|
||||
export const getTemplateMissionName = (mission) => {
|
||||
return TEMPLATE_MISSIONS.find(item => item.value === mission)?.name || mission;
|
||||
};
|
@ -120,6 +120,9 @@ function AddBrandModal({ show, onHide }) {
|
||||
</Form.Group>
|
||||
<Form.Group className='mb-3' controlId='formBasicCampaignId'>
|
||||
<Form.Label>Campaign ID</Form.Label>
|
||||
<Form.Text className='text-muted'>
|
||||
这个活动ID没必要在新增品牌的时候添加吧?
|
||||
</Form.Text>
|
||||
<Form.Control
|
||||
type='text'
|
||||
required
|
||||
|
@ -238,6 +238,19 @@ export const addTemplateThunk = createAsyncThunk(
|
||||
}
|
||||
);
|
||||
|
||||
export const getTemplateDetail = createAsyncThunk('inbox/getTemplateDetail', async (id, { rejectWithValue }) => {
|
||||
try {
|
||||
const response = await api.get(`/template/${id}/`);
|
||||
if (response.code === 200) {
|
||||
return response.data;
|
||||
} else {
|
||||
throw new Error(response.message);
|
||||
}
|
||||
} catch (error) {
|
||||
return rejectWithValue(error.response.data.message);
|
||||
}
|
||||
});
|
||||
|
||||
const initialState = {
|
||||
inboxList: [],
|
||||
inboxStatus: 'idle', // 'idle' | 'loading' | 'succeeded' | 'failed'
|
||||
@ -321,7 +334,13 @@ const inboxSlice = createSlice({
|
||||
.addCase(addTemplateThunk.rejected, (state, action) => {
|
||||
state.templatesStatus = 'failed';
|
||||
state.error = action.payload;
|
||||
});
|
||||
})
|
||||
.addCase(getTemplateDetail.fulfilled, (state, action) => {
|
||||
const template = state.templates.find(item => item.id === action.payload.id);
|
||||
if (template) {
|
||||
Object.assign(template, action.payload);
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -365,9 +365,6 @@
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 1rem;
|
||||
margin-top: 1rem;
|
||||
overflow-y: auto;
|
||||
max-height: calc(100% - 85px);
|
||||
padding-bottom: 1rem;
|
||||
|
||||
.template-item {
|
||||
background-color: #fff;
|
||||
|
Loading…
Reference in New Issue
Block a user