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

Tina/new student show #187

Merged
merged 10 commits into from
Feb 27, 2018
Merged

Tina/new student show #187

merged 10 commits into from
Feb 27, 2018

Conversation

chtinahow
Copy link
Collaborator

Resolves #182
This does the graphql query for all of the student side for the status.
This includes the new prototype of what Rob made shown here:
image

Copy link
Member

@billdybas billdybas left a comment

Choose a reason for hiding this comment

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

You also need to lint your files, and the "Back" buttons on each submission form broke because of the URL changes.

<h5>{props.entries ? props.entries.length : 0}/{props.entryCap} submissions</h5>
</div>
<div>
Submission Ends: <Moment format='YYYY/MM/DD'>{props.entryEnd}</Moment>
Copy link
Member

Choose a reason for hiding this comment

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

I'd make this in a format that's more readable / glanceable (eg. March 5, 2018).

I'd also word it as "Accepting Submissions Until"

Also, we seem to have different wording between the backend and frontend: should we call them "Submissions" or "Entries"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think they should be submissions as that's what Nanette usually uses, but @robmcl4 @Kayladavis opinions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, I don't think react-moment would be valid anymore if we decided to go with the glance able format

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with "submissions". At some point we just chose entries as types because it was slightly shorter of a word.

Also, I agree with Bill for the date format and wording.

judgingStart: PropTypes.string.isRequired,
judgingEnd: PropTypes.string.isRequired
}

Copy link
Member

Choose a reason for hiding this comment

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

I would change entries to be required, and you should give it a defaultProp:

defaultProps = {
  entries: []
}

</Card>
)

ShowCard.propTypes = {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of having all these props passed in shallowly, I would encapsulate them in a show prop:

ShowCard.propTypes = {
  show: PropTypes.shape({
    id: PropTypes.string,
    ...
    judgingEnd: PropTypes.string
  }).isRequired
}

See comment about entries below

import FaPlusCircle from 'babel-loader!react-icons/fa/plus-circle'
import { Button, ButtonGroup, Row, Col } from 'reactstrap'

const Card = styled.div`
Copy link
Member

Choose a reason for hiding this comment

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

Visually, this feels too narrow. min-height: 250px seems to work well. You'll have to recenter the "New Submission" button.

</Col>
<Col className="text-right">
<div>
<h5>{props.entries ? props.entries.length : 0}/{props.entryCap} submissions</h5>
Copy link
Member

Choose a reason for hiding this comment

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

With the defaultProps below, props.show.entries.length will be zero when there are no submissions, so you could simplify this to just {props.show.entries.length}/{props.show.entryCap}

Also, see comment below about "Submissions" vs. "Entries"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh true, good catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So doing so without the ternery causes a null if the entries are completely empty shown here in this error:
image

<Card>
<Row>
<Col>
<h2>{props.name}</h2>
Copy link
Member

Choose a reason for hiding this comment

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

I would align this text so the baseline is the same as "Submission Ends"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You want it centered with Accepting Submissions Until correct?

@@ -30,10 +30,6 @@ class OtherSubmissionForm extends Component {
user: PropTypes.shape({
username: PropTypes.string
}).isRequired,
forShow: PropTypes.shape({
Copy link
Member

Choose a reason for hiding this comment

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

If you're removing this in each of these files, you need to add in the propTypes for data

@@ -0,0 +1,6 @@
query Show($id: ID!) {
Copy link
Member

Choose a reason for hiding this comment

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

It feels weird to me making a query just for the name, but I guess it works: if we're coming to this page from the chooser, apollo probably has the data cached. If we're loading this page new, we'll need to fetch the name.

Still getting used to GraphQL ¯\_(ツ)_/¯

)

Shows.propTypes = {
shows: PropTypes.array,
Copy link
Member

Choose a reason for hiding this comment

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

I'd make this required and add a defaultProp of []

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If there are no so associated with the student, would they be able to still log in?

<Route exact path='/submit/photo' render={() => <PhotoSubmissionForm forShow={props.forShow} />} />
<Route exact path='/submit/video' render={() => <VideoSubmissionForm forShow={props.forShow} />} />
<Route exact path='/submit/other' render={() => <OtherMediaSubmissionForm forShow={props.forShow} />} />
<Route exact path='/submit/:id' component={SubmissionFormChooser} />
Copy link
Member

Choose a reason for hiding this comment

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

Not a huge fan of this URL format here.

Thoughts about doing:

/submit?to=<public_id>
/submit/photo?to=<public_id>
/submit/video?to=<public_id>
/submit/other?to=<public_id>

or

/submit?to=<public_id>
/submit?to=<public_id>&type=photo
/submit?to=<public_id>&type=video
/submit?to=<public_id>&type=other

Without the to param or an invalid/non-authorized public_id, you'd be redirected to your dashboard.

See #169 for my thoughts on using a public_id. We could just use the show's id for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably going with /submit?to=<public_id>
/submit/photo?to=<public_id>
/submit/video?to=<public_id>
/submit/other?to=<public_id>

Copy link
Contributor

@kaylaerdmann kaylaerdmann left a comment

Choose a reason for hiding this comment

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

Nit and some questions. Bill covers a lot in his review.

previewImage: state.student.ui.submission.previewFile || {},
user: state.shared.auth.user
user: state.shared.auth.user,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: extra comma

judgingEnd
entryCap
entries {
id
Copy link
Contributor

Choose a reason for hiding this comment

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

Will we need more than just the id?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think so? Would the invited status be associated with the entries?


import SubmissionFormChooser from '../components/SubmissionFormChooser'
import PhotoSubmissionForm from '../containers/PhotoSubmissionForm'
import VideoSubmissionForm from '../containers/VideoSubmissionForm'
import OtherMediaSubmissionForm from '../containers/OtherMediaSubmissionForm'

const Submit = props => (
const addIdPropFromQueryParams = () => {
return window.location.search.split('=')[1]
Copy link
Member

Choose a reason for hiding this comment

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

This is not the most robust way to do this, as any additional query parameters will cause issues.

eg. /submit?foo=bar&to=1 causes the buttons to link to /submit/<type>?to=bar

Additionally, no check is done to make sure a show w/ the id exists, so you can view the chooser for any id and when you attempt to view the submission forms for that non-existent show, the app crashes.

Ideally, we would parse the query string specifically for the param to and check if the id in the to query param is a valid show which this student can submit to, otherwise, render a Not Found page.

For MVP purposes, this'll work, but I'm making a story for having more robust query string parsing.

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.

None yet

3 participants