//@flow import React from "react"; import injectSheet from "react-jss"; import type { Plugin } from "@scm-manager/ui-types"; import { CardColumn } from "@scm-manager/ui-components"; import PluginAvatar from "./PluginAvatar"; import PluginModal from "./PluginModal"; type Props = { plugin: Plugin, // context props classes: any }; type State = { showModal: boolean }; const styles = { link: { pointerEvents: "all" } }; class PluginEntry extends React.Component { constructor(props: Props) { super(props); this.state = { showModal: false }; } createAvatar = (plugin: Plugin) => { return ; }; toggleModal = () => { this.setState(prevState => ({ showModal: !prevState.showModal })); }; createContentRight = (plugin: Plugin) => { const { classes } = this.props; if (plugin._links && plugin._links.install && plugin._links.install.href) { return (
); } }; createFooterLeft = (plugin: Plugin) => { return {plugin.author}; }; createFooterRight = (plugin: Plugin) => { return

{plugin.version}

; }; render() { const { plugin } = this.props; const { showModal } = this.state; const avatar = this.createAvatar(plugin); const contentRight = this.createContentRight(plugin); const footerLeft = this.createFooterLeft(plugin); const footerRight = this.createFooterRight(plugin); const modal = showModal ? : null; // TODO: Add link to plugin page below return ( <> {modal} ); } } export default injectSheet(styles)(PluginEntry);