From e78da1e0010a8029dd965a8a58b189aac30d8016 Mon Sep 17 00:00:00 2001 From: Lukas Brabec Date: Jan 29 2019 12:11:07 +0000 Subject: easyfix cleanup --- diff --git a/src/wizard/Easyfix.js b/src/wizard/Easyfix.js index 22a3a95..4ebf5a1 100644 --- a/src/wizard/Easyfix.js +++ b/src/wizard/Easyfix.js @@ -1,19 +1,72 @@ import React, { Component } from 'react'; import { Card, CardHeader, CardBody, UncontrolledCollapse, Row } from 'reactstrap'; - +import _ from 'lodash'; export default class Easyfix extends Component { render() { - let sections = Object.keys(this.props.data).map(k => ()); - return(
{sections}
) + console.log(this.props.data) + return ( +
+ { + Object.keys(this.props.data).map(k => { + return ( + + ) + }) + } +
+ ) } } +class EasyfixSection extends Component { + render() { + var title = this.props.title; + var subsections = Object.keys(this.props.data); -class EasyfixItemsListSub2 extends Component { + + if (subsections.length > 1){ + subsections = Object.keys(this.props.data).map(k => { + const title = {k} - {this.props.data[k][0].extra_data.description} + + return ( + + + + ) + }); + title = {title} - Is a group containing several projects. Expand to see more.; + + return ( + + {subsections} + + ) + } + else { + if (title !== subsections[0]){ + title = {title + '/' + subsections[0]} - {this.props.data[subsections[0]][0].extra_data.description}; + } + else { + title = {title} - {this.props.data[subsections[0]][0].extra_data.description}; + } + const links = Object.keys(this.props.data).map(k => ( + + )) + + return ( + + {links} + + ) + } + } +} + +class EasyfixLinksList extends Component { render() { const items = this.props.data.map(action => ( -
  • +
  • {action.name} @@ -28,79 +81,38 @@ class EasyfixItemsListSub2 extends Component { } } - -class EasyfixItemsListSub1 extends Component { +class CollapsableCard extends Component { render() { - var subsections = Object.keys(this.props.data); - var title = this.props.title; - var btn_expand_class = 'primary'; - var btn_expand_text = "Show me"; - if (subsections.length > 1){ - subsections = Object.keys(this.props.data).map(k => { - - var subtoggler = "easyfix_il_subtoggler_"+title+"_"+k; - subtoggler = subtoggler.replace(/[\W_]+/g,"_"); - - return( - - - -
    - {k} - {this.props.data[k][0].extra_data.description} -
    -
    - Show me! -
    -
    -
    - - - - - -
    ); - } - ); - title = {title} - Is a group containing several projects. Expand to see more.; - btn_expand_class = 'warning'; - btn_expand_text = 'Expand'; - } - else{ - if (title !== subsections[0]){ - title = {title + '/' + subsections[0]} - {this.props.data[subsections[0]][0].extra_data.description}; - } - else { - title = {title} - {this.props.data[subsections[0]][0].extra_data.description}; - } - subsections = Object.keys(this.props.data).map(k => ( - - ) - ); - } - - var toggler="easyfix_il_toggle_"+this.props.title; - toggler = toggler.replace(/[\W_]+/g,"_"); - - return( - + const {title, expand_text, expand_class, children} = this.props + const id = _.uniqueId('collapsable-card-id-') + return ( +
    {title}
    - + - {subsections} + {children} -
    ); +
    + ) } } - - +class Toggler extends Component { + render() { + const {id, text, color} = this.props + const classes = "btn btn-sm float-right btn-" + color + return ( + + ) + } +} \ No newline at end of file diff --git a/src/wizard/FedoraEasyKarma.js b/src/wizard/FedoraEasyKarma.js index 844d18d..5f86c26 100644 --- a/src/wizard/FedoraEasyKarma.js +++ b/src/wizard/FedoraEasyKarma.js @@ -63,7 +63,7 @@ export default class FedoraEasyKarmaItemsList extends Component {
  • Enter 1 to mark positive karma (the update works just fine, as far as you can tell), or -1{' '} to mark the package as broken.
    - Not sure you can judge the package's state? Have a look at the Update Feedback Guidelines
    + Not sure you can judge the package's state? Have a look at the Update Feedback Guidelines
    Still not sure? Just press Enter to skip it.
  • diff --git a/src/wizard/FedoraManualTesting.js b/src/wizard/FedoraManualTesting.js index 6f25081..a530238 100644 --- a/src/wizard/FedoraManualTesting.js +++ b/src/wizard/FedoraManualTesting.js @@ -71,7 +71,7 @@ class FedoraManualTestingItemsListSub1 extends Component { {l1}
    - Show me! +
    diff --git a/src/wizard/WizardForm.js b/src/wizard/WizardForm.js index 61e4a88..ea9b91b 100644 --- a/src/wizard/WizardForm.js +++ b/src/wizard/WizardForm.js @@ -45,7 +45,7 @@ class WizardForm extends Component { const duration_providers = this.props.providers.filter(p => p.duration === duration).map(p => { const btncolor = (this.state.selected_provider.provider === p.provider) ? 'selected' : 'primary' return ( -
    +
    @@ -112,8 +112,10 @@ class Tags extends Component { } render() { - var x = this.props.data.map(t => ( - + var x = this.props.data.map(tag => ( + )); return (
    {x}
    ) }