-
Notifications
You must be signed in to change notification settings - Fork 1
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
Darien Classrooms & Assignments Mk2 - Part 1 #107
Conversation
PR UpdateI think I'll split the planned updates for this PR into multiple parts. In this PR:
Next PR:
As previously noted in "Expected Big Stuff": I'll likely need to clone & spinoff the Classroom and Assignment components used in I2A into "WildCamClassroomLayout" components. StatusReady for review. 👌 This will be followed up with a PR Part 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really only have non-blocking comments, some of which could be addressed in your part 2 PR. I'll hold off on merging so you can choose how you want to address them.
Organization is much better 👍 . The old routes container was a pretty WTF reaction to React Router v4's API and non-sensical.
404 and 401 pages work well. Perhaps we can think about sharing those between the I2A side of the app too?
src/components/darien/Darien401.jsx
Outdated
import PropTypes from 'prop-types'; | ||
import GenericStatusPage from '../../components/common/GenericStatusPage'; | ||
|
||
const Darien401 = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been switching to writing functional components using declaration rather than expression: function MyComponent() {}
. React will correctly use the function name as the component display name this way. For some reason, React won't use it if it's an expression. It really helps with debugging using the React Dev Tools to see the correct names.
src/components/darien/Darien404.jsx
Outdated
import PropTypes from 'prop-types'; | ||
import GenericStatusPage from '../../components/common/GenericStatusPage'; | ||
|
||
const Darien404 = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about declaration vs expression for ease of debugging purposes.
import PropTypes from 'prop-types'; | ||
import ClassroomsLayout from '../classrooms/ClassroomsLayout'; | ||
|
||
const DarienEducators = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about declaration.
src/components/darien/DarienHome.jsx
Outdated
constructor(props) { | ||
super(props); | ||
} | ||
const DarienHome = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about using declaration.
src/components/darien/DarienMap.jsx
Outdated
@@ -3,20 +3,20 @@ import PropTypes from 'prop-types'; | |||
import MapExplorer from '../../containers/maps/MapExplorer'; | |||
import mapConfig from '../../lib/wildcam-darien.mapConfig.js'; | |||
|
|||
const DarienExplorer = (props) => { | |||
const DarienMap = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about using declaration.
import Darien404 from '../../components/darien/Darien404'; | ||
import GenericStatusPage from '../../components/common/GenericStatusPage'; | ||
|
||
class DarienProgram extends React.Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can still use the higher order connect function with functional components, so I don't think this has to be a class, unless you have plans to add some lifecycle methods to handle something.
<ProgramHome className="darien-home"> | ||
<Hero | ||
className="program-home__hero" | ||
background={<Image src="https://placeimg.com/1000/1000/nature/any" fit="cover" />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Darien team might want to pick an actual background image here rather than use this placeholder. Maybe something from the project?
I put the string for the background source into the program metadata for I2A just so it's consistent with referencing everything about the program from the database. Just so you know, the controllers for update hasn't been done for programs on the API, so you have to ask for someone update it via the Rails console.
src/components/darien/DarienHome.jsx
Outdated
<Box align="center" direction="column"> | ||
<Paragraph>Investigate ecological questions by exploring trail camera data using an interactive map. Filter and download data to perform analyses and test hypotheses.</Paragraph> | ||
|
||
<Box pad="medium" size="medium"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor styling comment, but perhaps the Box should be defined as a bigger size to allow for the paragraphs to be displaying inline? Even with a fairly high resolution screen, I still have to scroll to see both options for the lab to get started.
src/components/darien/DarienHome.jsx
Outdated
|
||
<Box pad="medium" size="medium"> | ||
<Paragraph> Alternatively, you can simply explore the data.</Paragraph> | ||
<Button path="/wildcam-darien-lab/map/" label="Explorer" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add className="button--secondary"
here so this button correctly gets hover/focus styles? I still have had a moment to figure out why Grommet is being inconsistent with the styles.
src/components/darien/DarienHome.jsx
Outdated
<Box pad="medium" size="medium"> | ||
<Paragraph>If you are an educator, you can set up private classrooms and invite your students to join. Curate data sets or let your students explore on their own. Guided activities and supporting educational resources are also available. {(signedIn) ? null : '(Sign In required)'}</Paragraph> | ||
{(signedIn) | ||
? <Button path="/wildcam-darien-lab/educators/" label="Educator" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add className="button--secondary"
here too?
Thanks @srallen, that's some great feedback! I'll perform the following updates for this PR:
I won't touch the styling (background image, Box sizes) for WildCam Darien this round though, as I'll need to talk to HHMI about these things anyway, so I expect them to be changed soon-ish. |
Actually, dangit, now that I look at it, what WildCam Darien home page styling can be improved quite a bit. Mrrrgh! |
PR UpdateThis PR has been updated to reflect the excellent feedback from @srallen
StatusReady for re-review! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of minor comments on naming, but this otherwise looks good to merge!
import PropTypes from 'prop-types'; | ||
import GenericStatusPage from './GenericStatusPage'; | ||
|
||
function Darien401(props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe name the function Status401
?
import PropTypes from 'prop-types'; | ||
import GenericStatusPage from './GenericStatusPage'; | ||
|
||
function Darien404(props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name this Status404
?
Nyarp! 😱 Sorry, I forgot to rename Darien401/404's actual function names - I'll take care of that in part 2. Thanks for spotting that! |
PR Overview
This PR plans to improve the WildCam Darien Lab's Classrooms and Assignments.
Goals:
Expected BIG STUFF that needs handling:
NOT in the scope:
Dev Notes
Please note that I'm reorganising the way that the Darien components are organised, subdivided, and named.
Notably, I'm reconceptualising the "DarienRoutesContainer" container into the "DarienProgram" container, which contains more logic and (hopefully) is a better way of thinking of how we organise our Programs.
Status
WIP