-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
689 additions
and
559 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/assets/javascripts/components/story/CollapsedStory/CollapsedStoryEstimate.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const estimateRule = (estimate) => estimate > 0 ? estimate : '-'; | ||
|
||
const CollapsedStoryEstimate = ({ estimate }) => ( | ||
<span className='Story__estimated'>{estimateRule(estimate)}</span> | ||
); | ||
|
||
CollapsedStoryEstimate.propTypes = { | ||
estimate: PropTypes.number, | ||
}; | ||
|
||
CollapsedStoryEstimate.defaultProp = { | ||
estimate: '-', | ||
}; | ||
|
||
export default CollapsedStoryEstimate; |
17 changes: 17 additions & 0 deletions
17
app/assets/javascripts/components/story/CollapsedStory/CollapsedStoryInfo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import CollapsedStoryTitle from './CollapsedStoryTitle' | ||
import CollapsedStoryLabels from './CollapsedStoryLabels' | ||
|
||
const CollapsedStoryInfo = ({ story }) => ( | ||
<div className="Story__info"> | ||
<CollapsedStoryLabels story={story} /> | ||
<CollapsedStoryTitle story={story} /> | ||
</div> | ||
); | ||
|
||
CollapsedStoryInfo.propTypes = { | ||
story: PropTypes.object.isRequired | ||
}; | ||
|
||
export default CollapsedStoryInfo; |
32 changes: 32 additions & 0 deletions
32
app/assets/javascripts/components/story/CollapsedStory/CollapsedStoryLabels.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const labelSplit = (labels) => labels.split(','); | ||
|
||
const StoryLabel = ( { label } ) => ( | ||
<a href="#" className="Story__label" title={label}>{label}</a> | ||
); | ||
|
||
StoryLabel.propTypes = { | ||
label: PropTypes.string.isRequired, | ||
}; | ||
|
||
const CollapsedStoryLabels = ({ story }) => { | ||
if (!story.labels) { | ||
return null | ||
} | ||
|
||
return ( | ||
<span className='Story__labels'> | ||
{labelSplit(story.labels).map(label => ( | ||
<StoryLabel key={label} label={label} /> | ||
))} | ||
</span> | ||
); | ||
}; | ||
|
||
CollapsedStoryLabels.propTypes = { | ||
story: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default CollapsedStoryLabels; |
13 changes: 13 additions & 0 deletions
13
app/assets/javascripts/components/story/CollapsedStory/CollapsedStoryPoints.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
|
||
const CollapsedStoryPoints = () => ( | ||
<div> | ||
<span className="Story__estimate">1</span> | ||
<span className="Story__estimate">2</span> | ||
<span className="Story__estimate">3</span> | ||
<span className="Story__estimate">5</span> | ||
<span className="Story__estimate">8</span> | ||
</div> | ||
); | ||
|
||
export default CollapsedStoryPoints; |
35 changes: 35 additions & 0 deletions
35
app/assets/javascripts/components/story/CollapsedStory/CollapsedStoryStateActions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import CollapsedStoryPoints from './CollapsedStoryPoints'; | ||
import CollapsedStoryStateButton from './CollapsedStoryStateButton'; | ||
import { isStoryNotEstimated } from '../../../models/beta/story'; | ||
|
||
const StoryActionFor = (state) => StateAction[state] || StateAction.unstarted; | ||
|
||
const StateAction = { | ||
started: ["finish"], | ||
finished: ["deliver"], | ||
delivered: ["accept", "reject"], | ||
rejected: ["restart"], | ||
accepted: [], | ||
unstarted: ["start"] | ||
}; | ||
|
||
const CollapsedStoryStateActions = ({ story }) => ( | ||
<div className='Story__actions'> | ||
{ | ||
isStoryNotEstimated(story.storyType, story.estimate) ? | ||
<CollapsedStoryPoints /> | ||
: StoryActionFor(story.state).map((stateAction) => | ||
<CollapsedStoryStateButton action={stateAction} key={stateAction} /> | ||
) | ||
} | ||
</div> | ||
); | ||
|
||
CollapsedStoryStateActions.propTypes = { | ||
story: PropTypes.object.isRequired, | ||
}; | ||
|
||
|
||
export default CollapsedStoryStateActions; |
14 changes: 14 additions & 0 deletions
14
app/assets/javascripts/components/story/CollapsedStory/CollapsedStoryStateButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types'; | ||
|
||
const CollapsedStoryStateButton = ({ action }) => ( | ||
<button type="button" className={`Story__btn Story__btn--${action}`}> | ||
{ I18n.translate(`story.events.${action}`) } | ||
</button> | ||
); | ||
|
||
CollapsedStoryStateButton.propTypes = { | ||
action: PropTypes.string.isRequired | ||
}; | ||
|
||
export default CollapsedStoryStateButton; |
21 changes: 21 additions & 0 deletions
21
app/assets/javascripts/components/story/CollapsedStory/CollapsedStoryTitle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const CollapsedStoryTitle = ({ story }) => ( | ||
<div className="Story__title"> | ||
{story.title} | ||
<abbr | ||
className="Story__initials" | ||
title={story.ownedByName} | ||
> | ||
{story.ownedByInitials} | ||
</abbr> | ||
</div> | ||
); | ||
|
||
CollapsedStoryTitle.propTypes = { | ||
story: PropTypes.object.isRequired, | ||
}; | ||
|
||
|
||
export default CollapsedStoryTitle |
44 changes: 44 additions & 0 deletions
44
app/assets/javascripts/components/story/CollapsedStory/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import classname from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import StoryPopover from '../StoryPopover'; | ||
import StoryDescriptionIcon from '../StoryDescriptionIcon'; | ||
import CollapsedStoryEstimate from './CollapsedStoryEstimate'; | ||
import CollapsedStoryStateActions from './CollapsedStoryStateActions'; | ||
import CollapsedStoryInfo from './CollapsedStoryInfo'; | ||
import StoryIcon from '../StoryIcon'; | ||
import * as StoryModel from '../../../models/beta/story'; | ||
|
||
const classNameStory = (storyType, estimate) => { | ||
|
||
const isStoryNotEstimated = StoryModel.isStoryNotEstimated(storyType, estimate); | ||
const isRelease = StoryModel.isRelease(storyType); | ||
|
||
return classname('Story', { | ||
'Story--unestimated': isStoryNotEstimated, | ||
'Story--estimated': !isStoryNotEstimated, | ||
'Story--release': isRelease | ||
}); | ||
}; | ||
|
||
const CollapsedStory = ({ story }) => ( | ||
<div className={classNameStory(story.storyType, story.estimate)}> | ||
<StoryPopover story={story}> | ||
<div className='Story__icons-block'> | ||
<StoryIcon storyType={story.storyType} /> | ||
<CollapsedStoryEstimate estimate={story.estimate} /> | ||
<StoryDescriptionIcon description={story.description} /> | ||
</div> | ||
</StoryPopover> | ||
|
||
<CollapsedStoryInfo story={story}/> | ||
|
||
<CollapsedStoryStateActions story={story}/> | ||
</div> | ||
); | ||
|
||
CollapsedStory.propTypes = { | ||
story: PropTypes.object.isRequired | ||
}; | ||
|
||
export default CollapsedStory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import _ from 'underscore'; | ||
|
||
const iconRules = { | ||
feature: { icon: 'start', className: 'star' }, | ||
bug: { icon: 'bug_report', className: 'bug' }, | ||
chore: { icon: 'settings', className: 'dark' }, | ||
release: { icon: 'bookmark', className: 'bookmark' } | ||
}; | ||
|
||
const iconRuleFor = _.propertyOf(iconRules); | ||
|
||
const iconRule = (storyType) => iconRuleFor([storyType, 'icon']); | ||
|
||
const classIconRule = (storyType) => iconRuleFor([storyType, 'className']); | ||
|
||
const CollapsedStoryIcon = ({ storyType }) => ( | ||
<span className='Story__icon'> | ||
<i className={`mi md-${classIconRule(storyType)} md-16`}>{iconRule(storyType)}</i> | ||
</span> | ||
); | ||
|
||
CollapsedStoryIcon.propTypes = { | ||
storyType: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default CollapsedStoryIcon; |
Oops, something went wrong.