Skip to content

Commit c023d7b

Browse files
authored
Merge pull request #149 from glific/task/remove_expired_category
disabled expired category from `enter a flow` node
2 parents cd1f49c + a6032c5 commit c023d7b

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@glific/flow-editor",
33
"license": "AGPL-3.0",
44
"repository": "git://github.com/glific/floweditor.git",
5-
"version": "1.26.3-23",
5+
"version": "1.26.3-24",
66
"description": "'Standalone flow editing tool designed for use within the Glific suite of messaging tools'",
77
"browser": "umd/flow-editor.min.js",
88
"unpkg": "umd/flow-editor.min.js",

src/components/flow/exit/Exit.module.scss

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,28 @@
103103
}
104104
}
105105
}
106+
107+
&.disabled {
108+
opacity: 0.5;
109+
color: $red;
110+
pointer-events: none;
111+
}
112+
113+
&.disabled::before {
114+
content: '';
115+
position: absolute;
116+
inset: 0;
117+
z-index: 100;
118+
cursor: not-allowed;
119+
}
120+
121+
&.disabled::before {
122+
pointer-events: all;
123+
}
124+
125+
&.disabled > * {
126+
pointer-events: none;
127+
}
106128
}
107129

108130
.activity {
@@ -167,7 +189,7 @@
167189
text-align: left;
168190
padding: 8px 10px;
169191
border-top: 1px solid $light_gray;
170-
192+
171193
.operand {
172194
padding-top: 3px;
173195
font-size: 12px;

src/components/flow/exit/Exit.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getExitActivityKey } from 'components/flow/exit/helpers';
66
import Loading from 'components/loading/Loading';
77
import { fakePropType } from 'config/ConfigProvider';
88
import { Cancel, getRecentMessages } from 'external';
9-
import { Category, Exit, FlowNode, LocalizationMap } from 'flowTypes';
9+
import { Category, Exit, FlowNode, LocalizationMap, StartFlowExitNames } from 'flowTypes';
1010
import * as React from 'react';
1111
import { connect } from 'react-redux';
1212
import { bindActionCreators } from 'redux';
@@ -252,7 +252,17 @@ export class ExitComp extends React.PureComponent<ExitProps, ExitState> {
252252
}
253253
}
254254

255-
public getName(): { name: string; localized?: boolean } {
255+
public getName(): { name: string; localized?: boolean; disabled?: boolean } {
256+
let disabled = false;
257+
if (
258+
this.props.categories &&
259+
this.props.categories.some(
260+
(category: Category) => category.name === StartFlowExitNames.Expired
261+
)
262+
) {
263+
disabled = true;
264+
}
265+
256266
if (this.props.translating) {
257267
let name = '';
258268
let delim = '';
@@ -272,15 +282,16 @@ export class ExitComp extends React.PureComponent<ExitProps, ExitState> {
272282
delim = ', ';
273283
});
274284

275-
return { name, localized };
285+
return { name, localized, disabled };
276286
} else {
277287
const names: string[] = [];
278288
this.props.categories.forEach((cat: Category) => {
279289
names.push(cat.name);
280290
});
281291

282292
return {
283-
name: names.join(', ')
293+
name: names.join(', '),
294+
disabled
284295
};
285296
}
286297
}
@@ -389,7 +400,7 @@ export class ExitComp extends React.PureComponent<ExitProps, ExitState> {
389400
}
390401

391402
public render(): JSX.Element {
392-
const { name, localized } = this.getName();
403+
const { name, localized, disabled } = this.getName();
393404

394405
const nameStyle = name ? styles.name : '';
395406
const connected = this.props.exit.destination_uuid ? ' jtk-connected' : '';
@@ -411,7 +422,8 @@ export class ExitComp extends React.PureComponent<ExitProps, ExitState> {
411422
[styles.translating]: this.props.translating,
412423
[styles.unnamed_exit]: name == null,
413424
[styles.missing_localization]: name && this.props.translating && !localized,
414-
[styles.confirm_delete]: confirmDelete
425+
[styles.confirm_delete]: confirmDelete,
426+
[styles.disabled]: disabled
415427
});
416428

417429
const activity = this.getSegmentCount();

0 commit comments

Comments
 (0)