Skip to content

Commit 2e3d6d7

Browse files
Feature: Add toggle approval (#26)
* feat: approval
1 parent ec44fb0 commit 2e3d6d7

File tree

117 files changed

+4482
-1363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+4482
-1363
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ jobs:
4848
# If you wish to specify custom queries, you can do so here or in a config file.
4949
# By default, queries listed here will override any specified in a config file.
5050
# Prefix the list here with "+" to use these queries and those in the config file.
51-
51+
5252
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
5353
# queries: security-extended,security-and-quality
5454

55-
55+
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild
@@ -61,7 +61,7 @@ jobs:
6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6363

64-
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
6565
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
6666

6767
# - run: |

.github/workflows/publish-docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
permissions:
99
contents: read
10-
10+
1111
jobs:
1212
buildx:
1313
runs-on: ubuntu-latest

src/components/CopyToClipboard/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.icon-success {
2-
color: #34C38F;
2+
color: #34c38f;
33
font-size: 20px !important;
44
margin-right: 4px;
55
vertical-align: middle;

src/components/FormItem/index.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
}
55

66
.label-required {
7-
color: #FF5F57;
7+
color: #ff5f57;
88
font-size: 20px;
99
vertical-align: middle;
1010
margin-right: 4px;
@@ -13,7 +13,7 @@
1313
}
1414

1515
.error-text {
16-
color: #F46A6A;
16+
color: #f46a6a;
1717
margin-top: -15px;
1818
margin-bottom: 15px;
1919
font-size: 12px;
@@ -23,7 +23,7 @@
2323

2424

2525
.tip-text {
26-
color: #74788D;
26+
color: #74788d;
2727
margin-top: -15px;
2828
margin-bottom: 15px;
2929
font-size: 12px;
@@ -38,5 +38,5 @@
3838
.icon-question {
3939
vertical-align: middle;
4040
margin-left: 4px;
41-
color: #74788D;
41+
color: #74788d;
4242
}

src/components/MessageBox/index.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
}
1010

1111
.icon-info-circle {
12-
color: #0A70F5;
12+
color: #0a70f5;
1313
vertical-align: middle;
1414
}
1515

1616
.icon-success-circle {
17-
color: #00B365;
17+
color: #00b365;
1818
vertical-align: middle;
1919
}
2020

2121
.icon-warning-circle {
22-
color: #FFC300;
22+
color: #ffc300;
2323
vertical-align: middle;
2424
}
2525

2626
.icon-error-circle {
27-
color: #F5483B;
27+
color: #f5483b;
2828
vertical-align: middle;
2929
}

src/components/PopupConfirm/index.module.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
color: rgba(0,0,0,0.87);
99
line-height: 24px;
1010
display: flex;
11-
padding: 8px 10px 0 10px;
11+
padding: 8px 10px 0;
1212
}
1313

1414
.iconfont {
15-
color: #F5483B;
15+
color: #f5483b;
1616
font-size: 20px !important;
1717
vertical-align: middle;
1818
margin-right: 10px;
@@ -21,7 +21,7 @@
2121
.btn-group {
2222
margin-top: 16px;
2323
text-align: right;
24-
padding: 0 10px 8px 10px;
24+
padding: 0 10px 8px;
2525
}
2626

2727
.btn-cancel {

src/components/PutAway/index.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
position: absolute;
33
bottom: 10px;
44
font-size: 13px;
5-
color: #ADB5BC;
5+
color: #adb5bc;
66
line-height: 32px;
77
width: 180px;
88
cursor: pointer;
@@ -19,7 +19,7 @@
1919
width: 160px;
2020
height: 1px;
2121
opacity: 0.2;
22-
background-image: linear-gradient(180deg, #74788D 0%, #F4F4F8 100%);
22+
background-image: linear-gradient(180deg, #74788d 0%, #F4F4F8 100%);
2323
}
2424

2525
.put-away-divider-close {

src/components/Rule/RuleContent.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Button from 'components/Button';
55
import Serve from 'components/Serve';
66
import Icon from 'components/Icon';
77
import Condition from './condition';
8-
import { IRule, ICondition } from 'interfaces/targeting';
8+
import { IRule, ICondition, IOption } from 'interfaces/targeting';
99
import { IContainer } from 'interfaces/provider';
1010
import { STRING_TYPE, NUMBER_TYPE, SEMVER_TYPE, DATETIME_TYPE, SEGMENT_TYPE } from './constants';
1111
import styles from './index.module.scss';
@@ -16,6 +16,7 @@ interface IProps {
1616
disabled?: boolean;
1717
useSegment?: boolean;
1818
ruleContainer: IContainer;
19+
subjectOptions: IOption[];
1920
variationContainer?: IContainer;
2021
segmentContainer?: IContainer;
2122
hooksFormContainer: IContainer;
@@ -28,6 +29,7 @@ const RuleContent = (props: IProps) => {
2829
ruleIndex,
2930
useSegment,
3031
ruleContainer,
32+
subjectOptions,
3133
segmentContainer,
3234
variationContainer,
3335
hooksFormContainer,
@@ -65,6 +67,7 @@ const RuleContent = (props: IProps) => {
6567
useSegment={useSegment}
6668
conditionIndex={index}
6769
condition={condition}
70+
subjectOptions={subjectOptions}
6871
ruleContainer={ruleContainer}
6972
segmentContainer={segmentContainer}
7073
variationContainer={variationContainer}

src/components/Rule/condition.tsx

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { IContainer } from 'interfaces/provider';
1111
import { ISegment, ISegmentList } from 'interfaces/segment';
1212
import {
1313
getAttrOptions,
14-
attributeOptions,
15-
getSubjectSegmentOptions,
14+
// attributeOptions,
15+
// getSubjectSegmentOptions,
1616
timezoneOptions,
1717
DATETIME_TYPE,
1818
SEGMENT_TYPE,
@@ -28,6 +28,7 @@ interface IProps {
2828
useSegment?: boolean;
2929
conditionIndex: number;
3030
condition: ICondition;
31+
subjectOptions: IOption[];
3132
ruleContainer: IContainer;
3233
variationContainer?: IContainer;
3334
segmentContainer?: IContainer;
@@ -43,7 +44,8 @@ const RuleContent = (props: IProps) => {
4344
rule,
4445
disabled,
4546
ruleIndex,
46-
useSegment,
47+
// useSegment,
48+
subjectOptions,
4749
conditionIndex,
4850
condition,
4951
ruleContainer,
@@ -54,7 +56,6 @@ const RuleContent = (props: IProps) => {
5456
const intl = useIntl();
5557
const [ options, setOption ] = useState<IOption[]>();
5658
const segmentList: ISegmentList = segmentContainer?.useContainer().segmentList;;
57-
let subjectOptions: IOption[] = attributeOptions;
5859

5960
const {
6061
handleChangeAttr,
@@ -114,22 +115,6 @@ const RuleContent = (props: IProps) => {
114115
};
115116
});
116117

117-
if (useSegment) {
118-
subjectOptions = getSubjectSegmentOptions();
119-
}
120-
121-
const subjectIndex = subjectOptions?.findIndex((attr) => {
122-
return attr.value === condition.subject;
123-
});
124-
125-
if (subjectIndex === -1 && condition.subject) {
126-
subjectOptions.push({
127-
key: condition.subject,
128-
text: condition.subject,
129-
value: condition.subject,
130-
});
131-
}
132-
133118
const inputProps = {
134119
placeholder: intl.formatMessage({id: 'common.dropdown.placeholder'}),
135120
disabled: disabled,
@@ -140,7 +125,7 @@ const RuleContent = (props: IProps) => {
140125
{
141126
conditionIndex === 0 ? (
142127
<span className={`${styles['rule-item-prefix']} ${styles['rule-item-first']}`}>
143-
<span className={styles['rule-item-text']}>if</span>
128+
<span className={styles['rule-item-text']}>If</span>
144129
</span>
145130
) : (
146131
<span className={styles['rule-item-prefix']}>
@@ -158,11 +143,11 @@ const RuleContent = (props: IProps) => {
158143
allowAdditions
159144
options={subjectOptions}
160145
value={condition.subject}
161-
openOnFocus={false}
162-
selectOnBlur={false}
146+
openOnFocus={true}
163147
closeOnChange={true}
148+
noResultsMessage={null}
164149
disabled={condition.type === SEGMENT_TYPE || disabled}
165-
icon={<Icon customClass={styles['angle-down']} type='angle-down' />}
150+
icon={null}
166151
error={ errors[`rule_${rule.id}_condition_${condition.id}_subject`] ? true : false }
167152
{
168153
...register(`rule_${rule.id}_condition_${condition.id}_subject`, {
@@ -363,7 +348,7 @@ const RuleContent = (props: IProps) => {
363348
<div className={styles['error-text']}>
364349
{
365350
condition.type !== SEGMENT_TYPE
366-
? intl.formatMessage({id: 'targeting.rule.values.placeholder'})
351+
? intl.formatMessage({id: 'targeting.rule.values.required'})
367352
: intl.formatMessage({id: 'common.dropdown.placeholder'})
368353
}
369354
</div>

src/components/Rule/index.module.scss

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313

1414
.rule:hover {
15-
border: 1px solid #556EE6;
15+
border: 1px solid #556ee6;
1616
border-radius: 8px;
1717
}
1818

@@ -55,25 +55,24 @@
5555

5656
.rule-item-prefix {
5757
display: inline-block;
58-
width: 24px;
59-
height: 24px;
58+
width: 26px;
59+
height: 26px;
6060
border-radius: 100%;
61-
font-size: 12px;
61+
font-size: 13px;
6262
text-align: center;
63-
line-height: 24px;
63+
line-height: 26px;
6464
color: #ffffff;
6565
position: relative;
6666
top: 4px;
6767
margin: 0 14px 0 10px;
68-
background-color: #26A4BA;
68+
background-color: #26a4ba;
6969
}
7070

7171
.rule-item-first {
7272
background-color: #556ee6;
7373
}
7474

7575
.rule-item-text {
76-
transform: scale(0.8);
7776
display: inline-block;
7877
}
7978

@@ -121,7 +120,6 @@
121120
position: absolute;
122121
top: 6px;
123122
left: 12px;
124-
border-radius: 4px;
125123
padding: 0 4px;
126124
}
127125

@@ -167,7 +165,7 @@
167165
line-height: 24px;
168166
text-align: center;
169167
display: inline-block;
170-
color: #74788D;
168+
color: #74788d;
171169
}
172170

173171
.icon-archive:hover {
@@ -184,18 +182,31 @@
184182
line-height: 24px;
185183
text-align: center;
186184
display: inline-block;
187-
color: #74788D;
185+
color: #74788d;
188186
}
189187

190188
.icon-drag:hover {
191189
background: rgba(33, 37, 41, 0.04);
192190
color: #495057;
193191
}
194192

193+
.subject-angle-down {
194+
position: absolute;
195+
right: 0;
196+
color: #74788d;
197+
top: 0;
198+
width: 24px;
199+
background: rgba(0, 0, 0, 0.02);
200+
height: 32px;
201+
line-height: 32px;
202+
cursor: pointer !important;
203+
text-align: center;
204+
}
205+
195206
.angle-down {
196207
position: absolute;
197208
right: 10px;
198-
color: #74788D;
209+
color: #74788d;
199210
top: 8px;
200211
}
201212

@@ -214,7 +225,7 @@
214225
border-radius: 100%;
215226
line-height: 24px;
216227
text-align: center;
217-
color: #74788D;
228+
color: #74788d;
218229
}
219230

220231
.icon-minus:hover {
@@ -223,7 +234,7 @@
223234
}
224235

225236
.error-text {
226-
color: #F46A6A;
237+
color: #f46a6a;
227238
font-size: 12px;
228239
}
229240

@@ -235,7 +246,7 @@
235246
.dropdown-remove-icon {
236247
font-size: 12px !important;
237248
margin-left: 12px;
238-
color: #74788D;
249+
color: #74788d;
239250
}
240251

241252
.popup {
@@ -257,5 +268,5 @@
257268
}
258269

259270
.menu-item:hover {
260-
background-color: #F8F9FA;
271+
background-color: #f8f9fa;
261272
}

0 commit comments

Comments
 (0)