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

Add ability to edit events. Relies upon members_api adjust_event_route_and_permissions #10

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

zyphlar
Copy link
Member

@zyphlar zyphlar commented Oct 25, 2020

@monteslu please double check my changes, I basically cargo-culted your pages/cert_details and state/certs way of doing things without actually knowing what I'm doing.

@zyphlar zyphlar requested a review from monteslu October 25, 2020 07:20
Copy link
Contributor

@JulienTant JulienTant left a comment

Choose a reason for hiding this comment

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

Sorry it's not the best quality review as it's made from my phone!
There's a few things to discard and a few thing that will break from my latest changes, I'm not quite sure I get perfectly what's going on with the classes and cooldux but it seems like there's some mix and match between using local component states in place of the redux store. I would feel better with a second review on this

@@ -32,6 +32,8 @@ COPY package.json /home/app/
COPY . /home/app

#RUN npm run build
RUN npm install
#RUN npm install
Copy link
Contributor

Choose a reason for hiding this comment

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

Changes should probably be discarded

@@ -14,4 +14,6 @@

echo "Starting up. PORT is $PORT"
export PATH=$PATH:$(pwd)/node_modules/.bin
yarn
Copy link
Contributor

Choose a reason for hiding this comment

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

Changes should probably be discarded

@@ -59,6 +60,7 @@ render((
<PrivateRoute exact path="/users/:id" component={UserDetails} />
<PrivateRoute exact path="/events" component={Events} />
<PrivateRoute exact path="/events/:event_id" component={Event} />
<PrivateRoute exact path="/events/:event_id/edit" component={EventEdit} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Upon rebasing from the latest develop you'll notice that this section changed slightly.

const ev = events.one;
// let eventList = '';
// const ev = this.props.read;
const { read } = this.props.events;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: it would be nice to alias this name to something human friendly. "Read" is kid of a vague name for a variable

Comment on lines +42 to +52
const { id, name, frequency, location, description, start_date, end_date } = await this.props.read(this.props.match.params.event_id);
this.setState({ id, name, frequency, location, description, start_date, end_date });
}

render() {
const { events } = this.props;
// const event = this.props.getOne(1); //this.props.match.params.event_id
// const { events } = this.props;
// const event = this.props.read(1); //this.props.match.params.event_id

let eventList = '';
const ev = events.one;
// let eventList = '';
// const ev = this.props.read;
const { read } = this.props.events;
Copy link
Contributor

Choose a reason for hiding this comment

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

The call made line 42 will eventually populate the read variable line 52, we should not store the data loaded for redux in the component state

},
};

const columns = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I'm missing something this is unused?

};

async componentDidMount(){
const { event_id } = this.props.match.params;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reference to props.match.Paramus will break after the update. Tldr is react router stopped supporting classes and we have to use a hack to get access to the params (on my big update PR, look for withRouter calls.)

return <div key={e.id} style={baseStyles.card}>
<h5><Link to={`/events/${e.id}`}>{e.name}</Link></h5>
{dateRange.full_date_string} ({e.frequency}) <br/>
{formatDateRange(e.start_date, e.end_date).full_date_string} ({e.frequency}) <br/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This should probably be memoized to avoid having to execute the same function every time the page is retendered.

@@ -77,4 +94,4 @@ export function formatDateRange(event) {
return out;
}

export default reducerCombined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not exporting the reducer anymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants