-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 meta info to cards in editorial workflow #293
Add meta info to cards in editorial workflow #293
Conversation
|
||
.meta {} | ||
.label { | ||
padding: 5px .75em 4px .75em; |
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 use pixels for everything, browsers now handle them pretty well across display densities.
.meta {} | ||
.label { | ||
padding: 5px .75em 4px .75em; | ||
border-radius: 1em; |
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.
Use the borderRadius
variable from UI/theme
.
@@ -0,0 +1,23 @@ | |||
.cardMeta { |
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.
Import ../UI/theme
and use variables where it makes sense, especially for colors (add new ones where necessary). Doesn't have to be over-thought - lots of change is coming. Just want to establish the pattern of general re-use for these kinds of values.
import React, { PropTypes } from 'react'; | ||
import styles from './UnpublishedListingCardMeta.css'; | ||
|
||
const UnpublishedListingCardMeta = ({ meta, label }) => |
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.
👍 for splitting this into a new component.
src/valueObjects/Entry.js
Outdated
@@ -8,5 +8,8 @@ export function createEntry(collection, slug = '', path = '', options = {}) { | |||
returnObj.data = options.data || {}; | |||
returnObj.label = options.label || null; | |||
returnObj.metaData = options.metaData || null; | |||
returnObj.isModification = (options.isModification === true || options.isModification === false) |
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.
We can improve clarity and length using _.isBoolean
, make it a one-liner.
84ebafd
to
7ce1032
Compare
@erquhart I've added the |
7ce1032
to
9deb15f
Compare
@erquhart I've addressed your change requests - how does this look now? |
9deb15f
to
ba76de4
Compare
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.
This should be the last round, great work :)
@@ -77,6 +80,10 @@ class UnpublishedListing extends React.Component { | |||
> | |||
<div className={styles.draggable}> | |||
<Card className={styles.card}> | |||
<UnpublishedListingCardMeta | |||
meta={pluralize(collection.charAt(0).toUpperCase() + collection.slice(1), 1)} |
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 use lodash.capitalize
here.
src/lib/promiseHelper.js
Outdated
@@ -1,3 +1,23 @@ | |||
import _ from 'lodash'; |
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.
We can keep module size down by importing the specific functions that we need.
src/valueObjects/Entry.js
Outdated
@@ -1,3 +1,5 @@ | |||
import _ from "lodash"; |
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 here, just grab the one function.
src/backends/github/API.js
Outdated
return unpublishedPromise; | ||
} | ||
|
||
isUnpublishedEntryModification(path) { |
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.
We should be passing the path and the branch in.
`resolvePromiseProperties` takes on object and returns a promise which resolves to a copy of the object. This copy has all its immediate properties which were Promises replaced with the resolved value of those promises. Promises are run with `Promise.all`. Errors are passed up to the outer promise chain. Example usage: ```js resolvePromiseProperties({ promise: Promise.resolve("this property will resolve to this string"), nonPromise: "this will remain the same", // you can nest the function nestedPromiseInside: resolvePromiseProperties({ nestedPromise: Promise.resolve("this will resolve"), nestedNonPromise: "this stays the same", }), }) .then(obj => console.log(obj)) ``` That will produce the following output: ```js { promise: "this property will resolve to this string", nonPromise: "this will remain the same", nestedPromiseInside: { nestedPromise: "this will resolve", nestedNonPromise: "this stays the same", }, } ```
ba76de4
to
df89b50
Compare
df89b50
to
1aa02eb
Compare
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.
LGTM
Fixes #270
- Summary
Adds meta information to the cards in the editorial workflow. Currently this includes the following:
In order to retrieve the new/update info, it adds the field
state.editorialWorkflow.entities[i].isModification
, which is retrieved using the GitHub API whenever unpublished entries are loaded.- Test plan
Tested manually (no automated tests exist for the editorial workflow).
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)