Skip to content

Commit

Permalink
fix: reduce changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKrieger committed Aug 23, 2023
1 parent 2976bee commit 5bfc4c5
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 77 deletions.
1 change: 1 addition & 0 deletions src/components/Drawer/MiniSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function MiniSideBar({ children }: PropsWithChildren) {
/>
),
},
// Possible future enhancements, not visible to user but help keep spacing
{
label: "Creatives",
href: "/user/main/creatives",
Expand Down
40 changes: 21 additions & 19 deletions src/components/Navigation/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
import { useHistory, useRouteMatch } from "react-router-dom";

import { AppBar, Button, Divider, Stack, Toolbar } from "@mui/material";

import { DraftMenu } from "components/Navigation/DraftMenu";
import moment from "moment";
import ads from "../../../branding.svg";
import { useAdvertiser } from "auth/hooks/queries/useAdvertiser";
import { useSignOut } from "auth/hooks/mutations/useSignOut";
import { useHistory } from "react-router-dom";
import { NewCampaignButton } from "components/Navigation/NewCampaignButton";
import { NewCreativeButton } from "components/Navigation/NewCreativeButton";

export function Navbar() {
const history = useHistory();
const { signOut } = useSignOut();
const { advertiser } = useAdvertiser();

const routeButtons = [
{
component: <NewCampaignButton />,
route: "/user/main/campaign",
},
{
component: <NewCreativeButton />,
route: "/user/main/creatives",
},
];
const history = useHistory();
const { url } = useRouteMatch();
const isNewCampaignPage = url.includes("/user/main/adsmanager/advanced");
const isCompletePage = url.includes("/user/main/complete/new");
const newUrl = `/user/main/adsmanager/advanced/new/${moment()
.utc()
.valueOf()}/settings`;

return (
<AppBar
Expand All @@ -42,10 +37,17 @@ export function Navbar() {
{advertiser.selfServiceCreate && <DraftMenu />}
</Stack>
<div style={{ flexGrow: 1 }} />
{
routeButtons.find((r) => history.location.pathname.includes(r.route))
?.component
}
{advertiser.selfServiceCreate && (
<Button
onClick={() => history.push(newUrl)}
size="medium"
variant="contained"
sx={{ mr: 3 }}
disabled={isNewCampaignPage || isCompletePage || !advertiser.agreed}
>
New Campaign
</Button>
)}
<Button variant="outlined" size="medium" onClick={() => signOut()}>
Sign out
</Button>
Expand Down
24 changes: 0 additions & 24 deletions src/components/Navigation/NewCreativeButton.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions src/form/PersistCreativeValues.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion src/user/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function transformNewForm(
userId?: string,
): CreateCampaignInput {
return {
currency: "USD",
currency: form.currency,
dailyCap: 1,
dailyBudget: form.dailyBudget,
endAt: form.endAt,
Expand Down Expand Up @@ -150,6 +150,7 @@ export function editCampaignValues(
advertiserId,
creatives: creativeList(advertiserId, ads),
newCreative: initialCreative,
currency: campaign.currency,
price: price.toNumber(),
billingType: billingType,
validateStart: false,
Expand Down
4 changes: 3 additions & 1 deletion src/user/views/adsManager/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export type CampaignForm = {
id?: string;
draftId?: string;
advertiserId: string;
isCreating: boolean;
startAt: string;
endAt: string;
budget: number;
validateStart: boolean;
isCreating: boolean;
currency: string;
dailyBudget: number;
geoTargets: GeoTarget[];
adSets: AdSetForm[];
Expand Down Expand Up @@ -108,6 +109,7 @@ export const initialCampaign = (advertiser: IAdvertiser): CampaignForm => {
geoTargets: [],
newCreative: initialCreative,
billingType: "cpm",
currency: "USD",
price: 6,
adSets: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function AdSetFields({ isEdit }: Props) {
name={`adSets.${current}.name`}
label="Ad Set Name"
margin="none"
variant="standard"
/>
</CardContainer>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export function BudgetField({ isEdit }: Props) {
type="number"
InputProps={{
startAdornment: <InputAdornment position="start">$</InputAdornment>,
endAdornment: <InputAdornment position="end">USD</InputAdornment>,
endAdornment: (
<InputAdornment position="end">{values.currency}</InputAdornment>
),
}}
helperText={
errors.budget || errors.dailyBudget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function CampaignReview({ values, errors }: Props) {
/>
<ReviewField
caption="Lifetime Budget"
value={`$${values.budget} USD`}
value={`$${values.budget} ${values.currency}`}
error={errors.budget}
/>
<ReviewField
Expand Down

0 comments on commit 5bfc4c5

Please sign in to comment.