From 401065a8b8e5a361f89b403eb635b16e601152fc Mon Sep 17 00:00:00 2001 From: prateek-pareek <97360950+prateek-pareek@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:55:15 +0530 Subject: [PATCH 1/6] campaign page added --- app/campaigns/create_campaigns/page.tsx | 12 + app/campaigns/page.tsx | 13 + app/layout.tsx | 4 +- app/reports/automation/page.tsx | 16 +- components/component/text.tsx | 19 + components/ui/campaigns/campaigns.tsx | 204 + components/ui/campaigns/create.tsx | 387 ++ components/ui/dashboard/dashboard.tsx | 280 +- components/ui/layout/index.tsx | 35 +- yarn.lock | 6045 +++++++++++++++++++++++ 10 files changed, 6849 insertions(+), 166 deletions(-) create mode 100644 app/campaigns/create_campaigns/page.tsx create mode 100644 app/campaigns/page.tsx create mode 100644 components/component/text.tsx create mode 100644 components/ui/campaigns/campaigns.tsx create mode 100644 components/ui/campaigns/create.tsx create mode 100644 yarn.lock diff --git a/app/campaigns/create_campaigns/page.tsx b/app/campaigns/create_campaigns/page.tsx new file mode 100644 index 0000000..c6a9d50 --- /dev/null +++ b/app/campaigns/create_campaigns/page.tsx @@ -0,0 +1,12 @@ +"use client"; + +import React from "react"; +import Layout from "@/components/ui/layout/index"; +import CampaignForm from "@/components/ui/campaigns/create" +export default function Page() { + return ( + + + + ); + }; \ No newline at end of file diff --git a/app/campaigns/page.tsx b/app/campaigns/page.tsx new file mode 100644 index 0000000..c6ffc64 --- /dev/null +++ b/app/campaigns/page.tsx @@ -0,0 +1,13 @@ +"use client"; + +import React from "react"; +import Layout from "@/components/ui/layout/index"; +import Campaigns from "@/components/ui/campaigns/campaigns"; + +export default function Page() { + return ( + + + + ); +}; diff --git a/app/layout.tsx b/app/layout.tsx index 3a787cc..d105aff 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -16,12 +16,12 @@ export default function RootLayout({ }) { return ( - + -
+
{children} diff --git a/app/reports/automation/page.tsx b/app/reports/automation/page.tsx index a318962..c076eb9 100644 --- a/app/reports/automation/page.tsx +++ b/app/reports/automation/page.tsx @@ -4,13 +4,11 @@ import React from "react"; import Layout from "@/components/ui/layout/index"; const Page: React.FC = () => { - return ( - - - - ); - }; - - - + return ( + + + + ); +}; + export default Page \ No newline at end of file diff --git a/components/component/text.tsx b/components/component/text.tsx new file mode 100644 index 0000000..0c59086 --- /dev/null +++ b/components/component/text.tsx @@ -0,0 +1,19 @@ +import React from 'react'; + +interface TextProps { + children: React.ReactNode; + className?: string; +} + +const Text: React.FC = ({ children, className, ...props }) => { + return ( + + {children} + + ); +}; + +export default Text; \ No newline at end of file diff --git a/components/ui/campaigns/campaigns.tsx b/components/ui/campaigns/campaigns.tsx new file mode 100644 index 0000000..5645df3 --- /dev/null +++ b/components/ui/campaigns/campaigns.tsx @@ -0,0 +1,204 @@ +"use client" +import { useState } from "react"; +import BarListChart from "../charts/barList"; +import BarChartComponent from "../charts/barChart"; +import LineCharts from "../charts/lineChart"; +import { data, pages, keyWords, campaignsData, BarData } from "../dummyData"; +import CampaignTable from '../dashboard/table' +import { format } from 'date-fns'; +import { Slider } from "@nextui-org/react"; +const Campaigns = () => { + const [value, setValue] = useState(0); + const [startDate, setStartDate] = useState(new Date('2023-01-01').getTime()); + const [endDate, setEndDate] = useState(new Date('2023-12-31').getTime()); + const [filteredData, setFilteredData] = useState([]); + + const handleChange = (event: React.ChangeEvent, isStart: boolean) => { + const newValue = +event; + if (isStart) { + setValue(newValue); + } else { + setValue(newValue); + } + filterData(newValue) + }; + + + const formatDate = (timestamp: number) => { + return format(new Date(timestamp), 'MM/dd/yyyy'); + }; + const monthMilliseconds = 30.44 * 24 * 60 * 60 * 1000; + + const filterData = (selectedDate: number) => { + const filtered: any = data.filter(entry => { + const entryDate = new Date(entry.filterDate.replace(/(\d{2})\/(\d{2})\/(\d{4})/, '$2/$1/$3')).getTime(); + return entryDate >= selectedDate && entryDate <= endDate; + }); + setFilteredData(filtered); + }; + + return ( +
+
+
+
+
+

Campaigns

+ +
+
+

Welcome, Xue!

+
+
+
+
+ + handleChange(event, true)} + aria-label={formatDate(value)} + classNames={{ + base: "max-w-md", + filler: "bg-orange-500" + }} + + /> + +
+
+ + + + +
+
+ + + + +
+
+
+

+ Top Channels +

+
+ By Connections ,Revenue ,Speed +
+ +
+ + +
+
+ + +
+
+
+ ); +}; + +export default Campaigns; diff --git a/components/ui/campaigns/create.tsx b/components/ui/campaigns/create.tsx new file mode 100644 index 0000000..1690097 --- /dev/null +++ b/components/ui/campaigns/create.tsx @@ -0,0 +1,387 @@ +import React, { useState } from 'react'; +import Head from 'next/head'; +import { RadioGroup, Radio, Input, Button } from '@nextui-org/react'; +const PencilIcon = () => { + return ( + + + + ); +}; + +function CampaignSetup() { + + + const [budget, setBudget] = useState('$10.00 per day'); + const [targetAudience, setTargetAudience] = useState({ + locations: 'All countries and territories', + networks: 'Search Network, Display Network', + keywords: 'content marketing', + }); + const [bid, setBid] = useState('AdWords automatically sets your bids to help you get as many clicks as possible within your budget.'); + const [ad, setAd] = useState('test - test\nAd www.getcodeless.com'); + + const [showEditBudget, setShowEditBudget] = useState(false); + const [showEditTargetAudience, setShowEditTargetAudience] = useState(false); + const [showEditBid, setShowEditBid] = useState(false); + const [showEditAd, setShowEditAd] = useState(false); + + const [location, setLocation] = useState(''); + + + const handleLocationChange = (event: React.ChangeEvent) => { + + setLocation(event.target.value); + + }; + + const handleEditBudget = () => { + setShowEditBudget(true); + }; + + const handleEditTargetAudience = () => { + setShowEditTargetAudience(true); + }; + + const handleEditBid = () => { + setShowEditBid(true); + }; + + const handleEditAd = () => { + setShowEditAd(true); + }; + + const handleSaveBudget = (newBudget) => { + setBudget(newBudget); + setShowEditBudget(false); + }; + + const handleSaveTargetAudience = (newTargetAudience) => { + setTargetAudience(newTargetAudience); + setShowEditTargetAudience(false); + }; + + const handleSaveBid = (newBid) => { + setBid(newBid); + setShowEditBid(false); + }; + + const handleSaveAd = (newAd) => { + setAd(newAd); + setShowEditAd(false); + }; + + return ( +
+ + Your First Campaign + +

Your First Campaign

+

+ A campaign focuses on a theme or a group of products. To create a campaign, you'll set a budget, choose your audience, and write your ad. Keep in mind, you won't be charged for selecting options, and you can always make changes later. +

+
+
+ + {!showEditBudget && ( +
+ +
{budget}
+ +
)} + {showEditBudget && ( +
+ + setBudget(e.target.value)} /> + +
+ )} +
+
+
+
+ +
+
+
+ +
{targetAudience.locations}
+ +
+ {showEditTargetAudience && ( +
+ + + + +
+ + + +
+ +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + + +
+ +
+ +
+ + + {location === 'custom-location' && ( + +
+ + + +

+ + For example, a country, city, region, or postal code. + +

+ +
+ + )} + + +
+ + + + + +
+ +
+ )} +
+
+
+ +
{targetAudience.networks}
+ +
+
+ +
+
+ +
{targetAudience.keywords}
+ +
+
+
+
+
+
+
+ +
+
{bid}
+ +
+ {showEditBid && ( +
+ setBid(e.target.value)} /> + +
+ )} +
+
+
+
+ +
+
{ad}
+ +
+ {showEditAd && ( +
+