A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/markerikson/project-minimek/commit/35e48d596189ab136f451b4691f2154a141e9b2c below:

Add the ability to delete individual Pilot entries · markerikson/project-minimek@35e48d5 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+31

-4

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+31

-4

lines changed Original file line number Diff line number Diff line change

@@ -16,9 +16,10 @@ const PilotsListHeader = () => (

16 16

<Table.HeaderCell width={2}>

17 17

Skills

18 18

</Table.HeaderCell>

19 -

<Table.HeaderCell width={4}>

19 +

<Table.HeaderCell width={3}>

20 20

Mech

21 21

</Table.HeaderCell>

22 +

<Table.HeaderCell width={1} />

22 23 23 24

</Table.Row>

24 25

</Table.Header>

Original file line number Diff line number Diff line change

@@ -1,9 +1,15 @@

1 1

import React from "react";

2 2

import {connect} from "react-redux";

3 -

import {Table} from "semantic-ui-react";

3 +

import {

4 +

Table,

5 +

Button,

6 +

Icon,

7 +

} from "semantic-ui-react";

4 8

import _ from "lodash";

5 9 6 10

import {getEntitiesSession} from "features/entities/entitySelectors";

11 +

import {deleteEntity} from "features/entities/entityActions";

12 + 7 13 8 14

const mapState = (state, ownProps) => {

9 15

const session = getEntitiesSession(state);

@@ -37,7 +43,12 @@ const mapState = (state, ownProps) => {

37 43

return {pilot};

38 44

}

39 45 40 -

const PilotsListRow = ({pilot={}, onPilotClicked=_.noop, selected}) => {

46 +

const actions = {

47 +

deleteEntity,

48 +

};

49 + 50 + 51 +

const PilotsListRow = ({pilot={}, onPilotClicked=_.noop, selected, deleteEntity}) => {

41 52

const {

42 53

id = null,

43 54

name = "",

@@ -48,6 +59,8 @@ const PilotsListRow = ({pilot={}, onPilotClicked=_.noop, selected}) => {

48 59

mechType = "",

49 60

} = pilot;

50 61 62 +

const onDeleteClicked = () => deleteEntity("Pilot", id);

63 + 51 64

return (

52 65

<Table.Row onClick={() => onPilotClicked(id)} active={selected}>

53 66

<Table.Cell>

@@ -65,8 +78,21 @@ const PilotsListRow = ({pilot={}, onPilotClicked=_.noop, selected}) => {

65 78

<Table.Cell>

66 79

{mechType}

67 80

</Table.Cell>

81 + 82 +

<Table.Cell>

83 +

<Button

84 +

compact

85 +

basic

86 +

circular

87 +

size="tiny"

88 +

color="red"

89 +

icon={<Icon name="delete" />}

90 +

onClick={onDeleteClicked}

91 +

>

92 +

</Button>

93 +

</Table.Cell>

68 94

</Table.Row>

69 95

);

70 96

}

71 97 72 -

export default connect(mapState)(PilotsListRow);

98 +

export default connect(mapState, actions)(PilotsListRow);

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4