Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15 create new campaign page #31

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

lihuicham
Copy link
Contributor

@lihuicham lihuicham commented Dec 19, 2022

Closes #15 .

Overview of changes:
Completed a basic page of Create New Campaign page.

Anything you'd like to highlight/discuss:
However, I do need help in a few things in the "Upload Media" section.

  1. When more than 1 files are uploaded, the Grid section for the upload media section is not expandable, therefore, the submit button will be pushed down. Is there a way to resolve this, probably some CSS tricks ? (see screenshot)
  2. Drag and drop doesn't really work for second file upload onwards. (It works for the first file i drag and drop into the section).

If it helps, I followed this tutorial to do.

Screenshot 2022-12-19 at 13 40 33

Thank you !

@lihuicham lihuicham requested a review from wilinetan December 19, 2022 05:48
@lihuicham lihuicham linked an issue Dec 19, 2022 that may be closed by this pull request
@netlify
Copy link

netlify bot commented Dec 19, 2022

Deploy Preview for elegant-klepon-993877 ready!

Name Link
🔨 Latest commit 73a3f9e
🔍 Latest deploy log https://app.netlify.com/sites/elegant-klepon-993877/deploys/63d09af31e3b5e00082c7b67
😎 Deploy Preview https://deploy-preview-31--elegant-klepon-993877.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@lihuicham lihuicham added the reviewable Ready for code review label Dec 19, 2022
Copy link
Collaborator

@wilinetan wilinetan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work. the file upload component looks very good 😄
some comments

  • the button getting pushed down issue, u can refer to the 2 files that i will be sending u on tele to see how to structure the components
  • the font size is very big. refer to the file i send u also for the updated size
  • the drag and drop not working after 1st file might be bcos it is buggy. i managed to get it to work multiple times at some times
  • add form validation and make every field required
  • add state or some logic of keeping track of all the values. we do not have API yet but we can implement all logic except for the step of calling API

pages/_app.tsx Outdated Show resolved Hide resolved
components/CreateNewCampaign/index.tsx Outdated Show resolved Hide resolved
Comment on lines 12 to 14
// const[value, setValue] = useState<DateRange<Date>>([null, null]);
const[startDate, setStartDate] = useState(null);
const[endDate, setEndDate] = useState(null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that now we still just making the skeletal pages, but can already start considering how you are going to store the states for all the fields being entered. you can either have an object that stores the value of all fields or one state variable for each value. otherwise, if you are using Formik as mentioned below, there might be a different way that Formik can keep track of all the states. You should be implement all logic except for the step where we actually call API to send our form values

components/CreateNewCampaign/index.tsx Outdated Show resolved Hide resolved
components/CreateNewCampaign/UploadMedia.tsx Outdated Show resolved Hide resolved
components/CreateNewCampaign/MultipleFileUploadField.tsx Outdated Show resolved Hide resolved
components/CreateNewCampaign/MultipleFileUploadField.tsx Outdated Show resolved Hide resolved
components/CreateNewCampaign/index.tsx Outdated Show resolved Hide resolved
Comment on lines +53 to +55
const mappedAcc = accFiles.map((file) => ({ file, errors: [], id: getNewId() }));
const mappedRej = rejFiles.map((r) => ({ ...r, id: getNewId() }));
setFiles((curr) => [...curr, ...mappedAcc, ...mappedRej]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we can do away with id and just use the file's name as the key for ur map below, and we should not allow file with same name to be uploaded.
https://stackoverflow.com/questions/26296232/dropzone-prevent-uploading-of-duplicate-files

Comment on lines +11 to +15
let currentId = 0;

function getNewId() {
return ++currentId;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not good to have a global variable. if we really need an id, put it as a state in the component.

@lihuicham lihuicham requested a review from wilinetan January 11, 2023 09:24
Copy link
Collaborator

@wilinetan wilinetan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good so far!
pending:

  • preview view
  • pop up when we click publish campaign
  • option to have no end dates set (as seen from figma)

see below image for the preview and pop up
Screen Shot 2023-01-25 at 5 24 58 PM

pages/campaign/index.tsx Show resolved Hide resolved
pages/campaign/index.tsx Show resolved Hide resolved
@wilinetan wilinetan linked an issue Mar 22, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reviewable Ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API Integration for Create New Campaign page Create new campaign page
2 participants