From ef78bc6a084f92b4794e987b5832240d85b6479e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 22 Jul 2020 14:05:15 +0200 Subject: refactor app using babel module-resolver --- .../app/views/media/components/media.menu.js | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 animism-align/frontend/app/views/media/components/media.menu.js (limited to 'animism-align/frontend/app/views/media/components/media.menu.js') diff --git a/animism-align/frontend/app/views/media/components/media.menu.js b/animism-align/frontend/app/views/media/components/media.menu.js new file mode 100644 index 0000000..b782cdc --- /dev/null +++ b/animism-align/frontend/app/views/media/components/media.menu.js @@ -0,0 +1,58 @@ +import React, { Component } from 'react' +import { Route, Link } from 'react-router-dom' +import { connect } from 'react-redux' + +import { history } from 'app/store' +import actions from 'app/actions' +import { MenuButton, FileInput } from 'app/common' + +const mapStateToProps = state => ({ + media: state.media, +}) + +export default class MediaMenu extends Component { + render() { + return ( +
+ + + + +
+ ) + } +} + +const MediaIndexMenu = () => ([ + , +]) + +const MediaShowMenu = connect(mapStateToProps)((props) => ([ + , + , + { + const { res: media } = props.media.show + if (confirm("Really delete this media?")) { + actions.media.destroy(media).then(() => { + history.push('/media/') + }) + } + }} />, +])) + +const MediaNewMenu = (props) => ([ + , +]) + +const MediaEditMenu = connect(mapStateToProps)((props) => ([ + , + , + { + const { res: media } = props.media.show + if (confirm("Really delete this media?")) { + actions.media.destroy(media).then(() => { + history.push('/media/') + }) + } + }} />, +])) -- cgit v1.2.3-70-g09d2