-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23935 from code-dot-org/staging
DTT (Staging > Test) [ErinP]
- Loading branch information
Showing
10 changed files
with
157 additions
and
76 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
80 changes: 80 additions & 0 deletions
80
apps/src/templates/projects/PersonalProjectsTableActionsCell.jsx
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,80 @@ | ||
import React, {Component, PropTypes} from 'react'; | ||
import {connect} from 'react-redux'; | ||
import QuickActionsCell from "../tables/QuickActionsCell"; | ||
import PopUpMenu, {MenuBreak} from "@cdo/apps/lib/ui/PopUpMenu"; | ||
import color from "../../util/color"; | ||
import FontAwesome from '../FontAwesome'; | ||
import i18n from '@cdo/locale'; | ||
import {showPublishDialog} from './publishDialog/publishDialogRedux'; | ||
|
||
export const styles = { | ||
xIcon: { | ||
paddingRight: 5, | ||
}, | ||
}; | ||
|
||
class PersonalProjectsTableActionsCell extends Component { | ||
static propTypes = { | ||
isPublished: PropTypes.bool.isRequired, | ||
projectId: PropTypes.string.isRequired, | ||
projectType: PropTypes.string.isRequired, | ||
showPublishDialog: PropTypes.func.isRequired, | ||
}; | ||
|
||
state = { | ||
deleting: false, | ||
publishing: false, | ||
unpublishing: false, | ||
renaming: false, | ||
remixing: false | ||
}; | ||
|
||
onPublish = () => { | ||
this.props.showPublishDialog(this.props.projectId, this.props.projectType); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<QuickActionsCell> | ||
<PopUpMenu.Item | ||
onClick={() => console.log("Rename was clicked")} | ||
> | ||
{i18n.rename()} | ||
</PopUpMenu.Item> | ||
<PopUpMenu.Item | ||
onClick={() => console.log("Remix was clicked")} | ||
> | ||
{i18n.remix()} | ||
</PopUpMenu.Item> | ||
{this.props.isPublished && ( | ||
<PopUpMenu.Item | ||
onClick={() => console.log("Unpublish was clicked")} | ||
> | ||
{i18n.unpublish()} | ||
</PopUpMenu.Item> | ||
)} | ||
{!this.props.isPublished && ( | ||
<PopUpMenu.Item | ||
onClick={this.onPublish} | ||
> | ||
{i18n.publish()} | ||
</PopUpMenu.Item> | ||
)} | ||
<MenuBreak/> | ||
<PopUpMenu.Item | ||
onClick={() => console.log("Delete was clicked")} | ||
color={color.red} | ||
> | ||
<FontAwesome icon="times-circle" style={styles.xIcon}/> | ||
{i18n.delete()} | ||
</PopUpMenu.Item> | ||
</QuickActionsCell> | ||
); | ||
} | ||
} | ||
|
||
export default connect(state => ({}), dispatch => ({ | ||
showPublishDialog(projectId, projectType) { | ||
dispatch(showPublishDialog(projectId, projectType)); | ||
}, | ||
}))(PersonalProjectsTableActionsCell); |
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
20 changes: 12 additions & 8 deletions
20
apps/test/unit/templates/projects/PersonalProjectsTableTest.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
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
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
Oops, something went wrong.