feat: add header channel selector & adding channel modal menu
This commit is contained in:
@@ -11,12 +11,6 @@ import {
|
||||
mockPlacements,
|
||||
mockSubscriptions,
|
||||
mockViewsHistory,
|
||||
mockAnalyticsOverview,
|
||||
mockCostsReportByDay,
|
||||
mockCostsReportByWeek,
|
||||
mockCostsReportByMonth,
|
||||
mockAnalyticsChannelsData,
|
||||
mockAnalyticsCreativesData,
|
||||
} from "./index";
|
||||
|
||||
import type {
|
||||
@@ -481,50 +475,99 @@ export const mockApiHandlers = {
|
||||
// --------------------------------------------------------------------------
|
||||
// Analytics
|
||||
// --------------------------------------------------------------------------
|
||||
async getAnalyticsOverview(params?: {
|
||||
async getSpendingAnalytics(params?: {
|
||||
target_channel_id?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
}) {
|
||||
await delay();
|
||||
return mockAnalyticsOverview;
|
||||
},
|
||||
|
||||
async getAnalyticsCosts(params?: {
|
||||
period?: "day" | "week" | "month";
|
||||
target_channel_id?: string;
|
||||
}) {
|
||||
await delay();
|
||||
const period = params?.period || "week";
|
||||
|
||||
if (period === "day") {
|
||||
return mockCostsReportByDay;
|
||||
} else if (period === "month") {
|
||||
return mockCostsReportByMonth;
|
||||
}
|
||||
return mockCostsReportByWeek;
|
||||
},
|
||||
|
||||
async getAnalyticsChannels(params?: {
|
||||
target_channel_id?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
type?: "external" | "target";
|
||||
grouping?: "day" | "week" | "month" | "quarter" | "year";
|
||||
}) {
|
||||
await delay();
|
||||
return {
|
||||
data: mockAnalyticsChannelsData,
|
||||
total_cost: 45000,
|
||||
total_subscriptions: 850,
|
||||
total_views: 125000,
|
||||
avg_cpf: 52.94,
|
||||
avg_cpm: 360,
|
||||
chart_data: [
|
||||
{
|
||||
period: "2024-03-01",
|
||||
cost: 15000,
|
||||
subscriptions: 280,
|
||||
views: 42000,
|
||||
cpf: 53.57,
|
||||
cpm: 357.14,
|
||||
},
|
||||
{
|
||||
period: "2024-03-08",
|
||||
cost: 18000,
|
||||
subscriptions: 340,
|
||||
views: 51000,
|
||||
cpf: 52.94,
|
||||
cpm: 352.94,
|
||||
},
|
||||
{
|
||||
period: "2024-03-15",
|
||||
cost: 12000,
|
||||
subscriptions: 230,
|
||||
views: 32000,
|
||||
cpf: 52.17,
|
||||
cpm: 375,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
async getAnalyticsCreatives(params?: {
|
||||
target_channel_id?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
}) {
|
||||
async getPlacementsAnalytics(params?: { target_channel_id?: string }) {
|
||||
await delay();
|
||||
return {
|
||||
data: mockAnalyticsCreativesData,
|
||||
placements: mockPlacements.map((p) => ({
|
||||
id: p.id,
|
||||
target_channel_id: p.target_channel_id,
|
||||
target_channel_title: p.target_channel_title,
|
||||
external_channel_id: p.external_channel_id,
|
||||
external_channel_title: p.external_channel_title,
|
||||
creative_id: p.creative_id,
|
||||
creative_name: p.creative_name,
|
||||
placement_date: p.placement_date,
|
||||
cost: p.cost,
|
||||
subscriptions_count: p.subscriptions_count,
|
||||
views_count: p.views_count,
|
||||
cpf: p.cost && p.subscriptions_count > 0 ? p.cost / p.subscriptions_count : null,
|
||||
cpm: p.cost && p.views_count ? (p.cost / p.views_count) * 1000 : null,
|
||||
})),
|
||||
};
|
||||
},
|
||||
|
||||
async getCreativesAnalytics(params?: { target_channel_id?: string }) {
|
||||
await delay();
|
||||
return {
|
||||
creatives: mockCreatives.map((c) => ({
|
||||
id: c.id,
|
||||
name: c.name,
|
||||
placements_count: c.placements_count,
|
||||
total_cost: 15000,
|
||||
total_subscriptions: 280,
|
||||
total_views: 42000,
|
||||
avg_cpf: 53.57,
|
||||
avg_cpm: 357.14,
|
||||
})),
|
||||
};
|
||||
},
|
||||
|
||||
async getExternalChannelsAnalytics(params?: { target_channel_id?: string }) {
|
||||
await delay();
|
||||
return {
|
||||
external_channels: mockExternalChannels.map((ec) => ({
|
||||
id: ec.id,
|
||||
title: ec.title,
|
||||
username: ec.username,
|
||||
placements_count: 3,
|
||||
total_cost: 12000,
|
||||
total_subscriptions: 210,
|
||||
total_views: 28000,
|
||||
avg_cpf: 57.14,
|
||||
avg_cpm: 428.57,
|
||||
})),
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user