Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"react-helmet": "^6.1.0",
"react-images-upload": "^1.2.8",
"react-markdown": "^4.3.1",
"react-material-ui-form-validator": "^2.1.1",
"react-material-ui-form-validator": "^2.1.4",
"react-modal-image": "^2.5.0",
"react-perfect-scrollbar": "^1.5.8",
"react-quill": "^1.3.5",
Expand Down
133 changes: 79 additions & 54 deletions src/components/CreateNewEvent.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import React, { useState } from 'react';
import { makeStyles } from '@material-ui/styles';
import DrawerLayout from 'src/layouts/DrawerLayout';
import {
ValidatorForm,
TextValidator,
} from 'react-material-ui-form-validator';
// import CircularProgress from '@material-ui/core/CircularProgress';
import {
Button,
Grid,
Box,
Typography,
InputBase,
TextField,
LinearProgress
} from '@material-ui/core';
import ImageUploader from 'react-images-upload';
import { useSelector } from 'react-redux';
import { firebase } from 'src/services/authService';
import firebase from 'firebase';
import { useHistory } from 'react-router';

const useStyles = makeStyles((theme) => ({
Expand All @@ -23,14 +26,14 @@ const useStyles = makeStyles((theme) => ({
borderRadius: '20px',
fontSize: '16px'
},
social: {
borderBottom: '1.3px solid #291757',
speaker: {
marginBottom: '10px'
},
socialLinks: {
speakerInput: {
marginBottom: '16px',
marginTop: '8px',
backgroundColor: '#CCD2E3',
backgroundColor: 'rgb(232, 240, 254)',
border:'0',
borderRadius: '20px',
padding: '20px',
'& .MuiOutlinedInput-notchedOutline': {
Expand Down Expand Up @@ -62,23 +65,15 @@ const useStyles = makeStyles((theme) => ({
borderRadius: '20px',
marginRight: '60px'
},
inputDiv: {
background: 'rgba(42, 23, 89, 0.25)',
borderRadius: '17px',
width: '451px',
marginBottom: '10px',
height: '70px'
},
input1: {
border: '0',
// padding: '10px',
font: 'inherit',
// border: '1px solid #848c83',
width: '100%',
backgroundColor: '#CCD2E3',
backgroundColor: 'rgb(232, 240, 254)',
borderRadius: '20px',
outline: '0',
borderBlockColor: 'green',
borderColor: 'green',
padding: '12px',
'& .MuiOutlinedInput-notchedOutline': {
borderColor: '#F2F7FF',
borderRadius: '20px',
Expand Down Expand Up @@ -156,16 +151,15 @@ const useStyles = makeStyles((theme) => ({
},
date: {
marginBottom: '16px',
backgroundColor: '#CCD2E3',

backgroundColor: 'rgb(232, 240, 254)',
borderRadius: '20px',
padding: '12.5px 14px',
// border:'1px solid #848c83',
'&:focus': {
outline: 'none'
},

'& .MuiOutlinedInput-notchedOutline': {
// borderColor: '#F2F7FF',
borderRadius: '20px'
},
[theme.breakpoints.down('md')]: {
Expand All @@ -175,10 +169,10 @@ const useStyles = makeStyles((theme) => ({
textField: {
marginBottom: '16px',
marginTop: '8px',
backgroundColor: '#CCD2E3',
border: '0',
backgroundColor: 'rgb(232, 240, 254)',
borderRadius: '20px',
borderBlockColor: 'green',
borderColor: 'green',
padding: '20px',
'& .MuiOutlinedInput-notchedOutline': {
borderColor: '#F2F7FF',
borderRadius: '20px'
Expand Down Expand Up @@ -206,19 +200,21 @@ function CreateNewEvent() {
description: '',
date: '',
time: '',
eventLink: ''
eventLink: '',
speakerName: '',
speakerLinkedIn: '',
};
const [formData, setFormData] = useState(initialFieldValues);

// const [submit, setsubmit] = useState(0);
const handleChange = (e) => {
const { name, value } = e.target;
setFormData({ ...formData, [name]: value });
};

const handleSpeakerChange = (e) => {
const { id, name, value } = e.target;
const s = [...speaker];
s[parseInt(id, 10)][name] = value;
let { id, name, value } = e.target;
let s = [...speaker];
s[parseInt(id)][name] = value;

Choose a reason for hiding this comment

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

missing radix parameter take reference here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This all errors are not from my code someone has added these functions i don't know who is but that person has not resolved all this and i have to face this all issue,

setSpeaker(s);
};

Expand Down Expand Up @@ -261,10 +257,14 @@ function CreateNewEvent() {
history.push(`/events/${docRef.id}`);
});
};
// const handleSubmit = () =>{
// console.log('submit');
// }

return (
<DrawerLayout>
<div className={classes.root}>
<DrawerLayout>
<div className={classes.root}>
<ValidatorForm onSubmit={handleSubmit} onError={errors => console.log(errors)}>

Choose a reason for hiding this comment

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

missing arrow-parens onError func

<Box display="flex" style={{ width: '100%' }}>
<Box flexGrow={1}>
<Grid container>
Expand All @@ -276,31 +276,35 @@ function CreateNewEvent() {
</Grid>
<Grid container className={classes.event}>
<Grid style={{ width: '100%' }}>
<TextField
<TextValidator
placeholder="Enter name of the event"
className={classes.textField}
fullWidth
name="eventName"
value={formData.eventName}
variant="outlined"
// variant="outlined"
onChange={handleChange}
validators={['required']}
errorMessages={['This is a required field']}
/>

<TextField
placeholder="Add Description of the event"
<TextValidator
placeholder="Add Description of the event"
className={classes.textField}
multiline
rows={4}
fullWidth
name="description"
value={formData.description}
variant="outlined"
// variant="outlined"
onChange={handleChange}
validators={['required']}
errorMessages={['This is a required field']}
/>

<Grid container>
<Grid item xs={12} sm={12} md={6}>
<TextField
<TextValidator
id="date"
type="date"
defaultValue="2017-05-24"
Expand All @@ -312,54 +316,75 @@ function CreateNewEvent() {
shrink: true
}}
style={{ marginRight: '30px' }}
validators={['required']}
errorMessages={['This is a required field']}
/>
</Grid>
<Grid item xs={12} sm={12} md={6}>
<TextField
<TextValidator
fullWidth
className={classes.input1}
type="time"
name="time"
value={formData.time}
id="time"
defaultValue="07:30"
variant="outlined"
// variant="outlined"
onChange={handleChange}
validators={['required']}
errorMessages={['This is a required field']}
/>
</Grid>
</Grid>

<TextField
<TextValidator
fullWidth
className={classes.textField}
placeholder="Event link / Registration link"
name="eventLink"
value={formData.eventLink}
variant="outlined"
// variant="outlined"
onChange={handleChange}
validators={[
'required']}
errorMessages={[
'This is a required field',
'Please enter a valid contact number'
]}
/>
{speaker.map((item, idx) => (
<fieldset className={classes.socialLinks}>
<InputBase
className={classes.social}
<fieldset className={classes.speakerInput}>
<TextValidator
className={classes.speaker}
fullWidth
id={idx.toString()}
name="speakerName"
value={speaker.speakerName}
value={item.speakerName}
placeholder="Speaker Name"
onChange={handleSpeakerChange}
validators={['required']}
errorMessages={['This is a required field']}
/>
<InputBase
className={classes.social}
<TextValidator
key="linkedIn"

Choose a reason for hiding this comment

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

indentation error use preferred code formator to resolve all indent-related errors in one go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I already formatted the code with prettier but ok I am doing changes.

className={classes.speaker}
fullWidth
id={idx.toString()}
name="speakerLinkedIn"
value={speaker.speakerLinkedIn}
value={item.speakerLinkedIn}
placeholder="Speaker LinkedIn Profile Link"
onChange={handleSpeakerChange}
validators={[
'required',
'matchRegexp:^(http(s)?://)?([w]+.)?linkedin.com/(pub|in|profile)'
]}
errorMessages={[
'This is a required field',
'Please enter a valid URL'
]}
/>
</fieldset>
))}
))}

Choose a reason for hiding this comment

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

indentation error and no-trailing-spaces allowed acc to preferred code formator


{speaker.length > 1 && (
<Button className={classes.button} onClick={removeSpeaker}>
Expand All @@ -369,7 +394,6 @@ function CreateNewEvent() {
<Button className={classes.button} onClick={addSpeaker}>
Add Speaker
</Button>
{/* </div> */}
</Grid>
</Grid>
<div className={classes.createbtn}>
Expand All @@ -379,7 +403,7 @@ function CreateNewEvent() {
>
Cancel
</Button>
<Button className={classes.addbtn} onClick={handleSubmit}>
<Button className={classes.addbtn} type="submit">
Create
</Button>
</div>
Expand All @@ -391,7 +415,7 @@ function CreateNewEvent() {
onChange={onDrop}
withPreview={imageURL !== null}
singleImage
imgExtension={['.jpg', '.gif', '.png', '.gif']}
imgExtension={['.jpg', '.gif', '.png']}
maxFileSize={5242880}
fileContainerStyle={{
boxShadow: '2px 2px 3px 1px rgb(0, 0, 0, 0.5)'
Expand All @@ -405,8 +429,9 @@ function CreateNewEvent() {
style={{ marginLeft: '10px', marginTop: '20px' }}
/>
</Box>
</Box>
</div>
</Box>
</ValidatorForm>
</div>
</DrawerLayout>

Choose a reason for hiding this comment

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

indent this too

);
}
Expand Down
16 changes: 7 additions & 9 deletions src/views/pages/events/eventdefault.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import {
Box, Button, Grid, makeStyles
} from '@material-ui/core';
import { Box, Button, Grid, makeStyles } from '@material-ui/core';

Choose a reason for hiding this comment

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

object-curly-newline according to code formator revert this as it is.

import React, { useState, useEffect } from 'react';
import BookmarkedEvents from 'src/components/BookmarkedEvents';
import UserNewEvents from 'src/components/UserNewEvents';
import UserUpcomingEvents from 'src/components/UserUpcomingEvents';
import UserEventStats from 'src/components/UserEventStats';
// import SearchBar from 'src/components/search';
import SearchBar from 'src/components/search';
import DrawerLayout from 'src/layouts/DrawerLayout';
import { useHistory } from 'react-router-dom';

const useStyles = makeStyles((theme) => ({
const useStyles = makeStyles(theme => ({

Choose a reason for hiding this comment

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

use func arrow-parens properly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This all codes are not written by me that's why I am facing more problem.

button: {
marginLeft: '120px',
marginTop: '20px',
Expand All @@ -31,7 +29,6 @@ const useStyles = makeStyles((theme) => ({

export default function EventDefaultPage() {
const classes = useStyles();
const [bookmarkEvent] = useState(null);
const history = useHistory();
const handleClick = () => {
history.push('/createEvent');
Expand All @@ -40,15 +37,16 @@ export default function EventDefaultPage() {
const [eventsAttended, setEventsAttended] = useState(0);

useEffect(() => {
setEventsConducted(2);
setEventsAttended(2);
}, []);

return (
<DrawerLayout>
<Grid container>
<Grid justify="center" md={8} sm={12} xs={12}>
{ bookmarkEvent !== null && <BookmarkedEvents /> }
{/* <SearchBar /> */}
<BookmarkedEvents />
<SearchBar />
<UserNewEvents />
<Box textAlign="center">
<Button className={classes.button} onClick={handleClick}>
Expand All @@ -57,7 +55,7 @@ export default function EventDefaultPage() {
</Box>
</Grid>
<Grid md={4} sm={12} xs={12}>
<UserUpcomingEvents setConducted={setEventsConducted} />
<UserUpcomingEvents />
<UserEventStats
conducted={eventsConducted}
attended={eventsAttended}
Expand Down