Skip to content

Commit

Permalink
Merge pull request #579 from Real-Dev-Squad/develop
Browse files Browse the repository at this point in the history
Dev to main sync
  • Loading branch information
skv93-coder authored Feb 24, 2024
2 parents 9a52847 + b6aac58 commit 94ab9e0
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 81 deletions.
29 changes: 2 additions & 27 deletions app/components/progress-bar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,15 @@
step='10'
{{on 'change' this.onChange}}
{{on 'input' this.onInput}}
disabled={{not this.isEditable}}
/>
<button
data-test-progress-bar-button
{{on 'click' this.turnEditModeOn}}
class='progress-slider__button
{{unless this.isEditable "progress-slider__button--hover"}}'
type='button'
>
{{#if this.isEditable}}
<span class='progress-slider__button__text'>{{@value}}</span>
{{else}}
<svg
class='progress-slider__button__edit-icon'
viewBox='0 0 24 24'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<path
class='progress-slider__button__edit-icon__inner'
opacity='0.5'
d='M4 20H8L18 10L14 6L4 16V20Z'
fill='#000000'
/>
<path
class='progress-slider__button__edit-icon__outer'
d='M18 10L21 7L17 3L14 6M18 10L8 20H4V16L14 6M18 10L14 6'
stroke='#000000'
stroke-width='1.5'
stroke-linecap='round'
stroke-linejoin='round'
/>
</svg>
{{/if}}
<span class='progress-slider__button__text'>{{@value}}</span>

</button>

</div>
21 changes: 0 additions & 21 deletions app/components/progress-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,16 @@ import { action } from '@ember/object';
import { debounce } from '@ember/runloop';

export default class ProgressBarComponent extends Component {
@tracked isEditable = false;
@tracked value = this.args.value;
lastEditTime = null;

@action turnEditModeOn() {
this.isEditable = true;
this.lastEditTime = Date.now();
this.setEditableToFalse();
}

setEditableToFalse() {
setTimeout(() => {
const timeDelta = Date.now() - this.lastEditTime;
if (this.isEditable && timeDelta >= 5000) {
this.isEditable = false;
} else if (this.isEditable) {
this.setEditableToFalse();
}
}, 5000);
}

@action onInput(e) {
this.lastEditTime = Date.now();
this.value = e.target.value;
if (this.args.onInput) {
this.args.onInput(this.value);
}
}

@action onChange(e) {
this.lastEditTime = Date.now();
if (this.args.onChange) {
debounce(this, this.debouncedChange, e, 600);
}
Expand Down
57 changes: 36 additions & 21 deletions app/components/task/modal.hbs
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
{{#if @showModal}}
<div class="overlay">
<div class="modal" data-test-modal>
<button type="button" class="close" {{on "click" @goBack}} disabled={{@closeDisabled}} data-test-closeBtn>
<i class="fa fa-close"></i>
</button>
<p class="modal-title" data-test-title>{{@message}}</p>
{{#if @isUpdating}}
<Spinner data-test-spinner />
{{/if}}
{{#if @buttonRequired}}
<button type="button" class={{if (eq @dev true) "not-assign" "proceed-btn" }} {{on "click" @markComplete}}
data-test-notAssignBtn>
{{if (eq @dev true) "Don't assign task" "Proceed" }}
</button>
{{#if @dev}}
<button type="button" class="proceed-btn" {{on "click" @markCompleteAndAssignTask}} data-test-assignBtn>
Assign task
</button>
{{/if}}
{{/if}}
<div class='overlay'>
<div class='modal' data-test-modal>
<button
type='button'
class='close'
{{on 'click' @goBack}}
disabled={{@closeDisabled}}
data-test-closeBtn
>
<i class='fa fa-close'></i>
</button>
<p class='modal-title' data-test-title>{{@message}}</p>
{{#if @isUpdating}}
<Spinner data-test-spinner />
{{/if}}
{{#if @buttonRequired}}
<button
type='button'
class='proceed-btn'
{{on 'click' @markComplete}}
data-test-notAssignBtn
>
Proceed
</button>
{{#if @dev}}
<button
type='button'
class='proceed-btn hidden'
{{on 'click' @markCompleteAndAssignTask}}
data-test-assignBtn
>
Assign task
</button>
{{/if}}
{{/if}}
</div>
</div>
</div>
{{/if}}
2 changes: 1 addition & 1 deletion app/components/tasks.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class='tasks-container'>
{{#if @dev}}
{{#if @noInProgressTask}}
<div class='fetch-task' data-test-fetchSection>
<div class='fetch-task hidden' data-test-fetchSection>
<p>You have no task in progress! click below to fetch tasks</p>
<Button
@onClick={{@handleAssignment}}
Expand Down
3 changes: 1 addition & 2 deletions app/constants/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ const TABS_TASK_STATUS_LIST = [
},
];
export const TASK_MESSAGES = {
MARK_DONE:
'This task will be marked as done and a new task will be assigned to you',
MARK_DONE: 'This task will be marked as Done',
UPDATE_TASK: 'Updating task',
FIND_TASK: 'Finding new task for you!',
};
Expand Down
3 changes: 3 additions & 0 deletions app/styles/tasks.css
Original file line number Diff line number Diff line change
Expand Up @@ -736,3 +736,6 @@ div.buttons {
align-content: center;
justify-content: center;
}
.hidden {
display: none;
}
4 changes: 2 additions & 2 deletions tests/integration/components/tasks-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test } from 'qunit';
import { module, skip, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { find, render, waitUntil, fillIn } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
Expand All @@ -17,7 +17,7 @@ module('Integration | Component | tasks', function (hooks) {
assert.ok(this.element.textContent.trim().includes('tasks'));
});

test('there is a fetch task button if no in progress task are there', async function (assert) {
skip('there is a fetch task button if no in progress task are there', async function (assert) {
this.setProperties({
onTaskChange: () => {},
onTaskUpdate: () => {},
Expand Down
9 changes: 2 additions & 7 deletions tests/integration/components/tasks/modal-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ module('Integration | Component | tasks/modal', function (hooks) {
showModal: true,
buttonRequired: true,
dev: false,
message:
'This task will be marked as done and a new task will be assigned to you',
message: 'This task will be marked as Done',
});

await render(hbs`
Expand All @@ -219,11 +218,7 @@ module('Integration | Component | tasks/modal', function (hooks) {

assert.dom('[data-test-notAssignBtn]').exists();
assert.dom('[data-test-notAssignBtn]').hasProperty('button');
assert
.dom('[data-test-title]')
.hasText(
'This task will be marked as done and a new task will be assigned to you'
);
assert.dom('[data-test-title]').hasText('This task will be marked as Done');
assert.dom('[data-test-notAssignBtn]').hasText('Proceed');
});
});

0 comments on commit 94ab9e0

Please sign in to comment.