Skip to content

Commit 6ed8130

Browse files
authoredDec 4, 2024
Fix priority icons for task (#1874)
* refactor task to be common to crm * fix priority icons * fix css gap * fix priority icon to be displayed * more fix on completed status
1 parent e00154f commit 6ed8130

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed
 

‎packages/experiments-realm/TaskBase/c0bf3231-435c-4363-ad92-a1d756aea8d9.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
"label": "In Progress"
1313
},
1414
"taskDetail": null,
15+
"priority": {
16+
"index": 1,
17+
"label": "Low"
18+
},
1519
"description": null,
1620
"thumbnailURL": null
1721
},
@@ -34,4 +38,4 @@
3438
}
3539
}
3640
}
37-
}
41+
}

‎packages/experiments-realm/loosey-goosey.gts

+2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import {
55
StringField,
66
} from 'https://cardstack.com/base/card-api';
77
import NumberField from 'https://cardstack.com/base/number';
8+
import type IconComponent from '@cardstack/boxel-icons/captions';
89

910
export interface LooseyGooseyData {
1011
index: number;
1112
label: string;
1213
color?: string;
14+
icon?: typeof IconComponent;
1315
}
1416

1517
export class LooseGooseyField extends FieldDef {

‎packages/experiments-realm/task.gts

+33-6
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ import { LooseGooseyField, type LooseyGooseyData } from './loosey-goosey';
2121
import { tracked } from '@glimmer/tracking';
2222
import { action } from '@ember/object';
2323
import { fn } from '@ember/helper';
24+
import ChevronsUp from '@cardstack/boxel-icons/chevrons-up';
25+
import ChevronUp from '@cardstack/boxel-icons/chevron-up';
26+
import ChevronsDown from '@cardstack/boxel-icons/chevrons-down';
27+
import ChevronDown from '@cardstack/boxel-icons/chevrons-down';
28+
import CircleEqual from '@cardstack/boxel-icons/circle-equal';
2429
import { isToday, isThisWeek, addWeeks } from 'date-fns';
2530
import GlimmerComponent from '@glimmer/component';
2631
import Calendar from '@cardstack/boxel-icons/calendar';
27-
import ChevronsUp from '@cardstack/boxel-icons/chevrons-up';
2832
import { Pill } from '@cardstack/boxel-ui/components';
2933
import { CheckMark } from '@cardstack/boxel-ui/icons';
3034

@@ -143,7 +147,7 @@ export class FittedTask extends Component<typeof TaskBase> {
143147
{{/if}}
144148
</div>
145149
<div class='short-id-container'>
146-
<ChevronsUp width='14px' height='14px' />
150+
<@fields.priority @format='atom' />
147151
<span class='short-id'>{{@model.shortId}}</span>
148152
</div>
149153
</header>
@@ -229,7 +233,7 @@ export class FittedTask extends Component<typeof TaskBase> {
229233
.short-id-container {
230234
display: flex;
231235
align-items: center;
232-
gap: var(--boxel-sp-3xs);
236+
gap: var(--boxel-sp-xxxs);
233237
margin-left: auto;
234238
}
235239
.short-id {
@@ -483,14 +487,22 @@ class EditPriority extends Component<typeof BaseTaskPriority> {
483487
export class BaseTaskPriority extends LooseGooseyField {
484488
// loosey goosey pattern
485489
static values = [
486-
{ index: 0, label: 'Low' },
490+
{ index: 0, label: 'Lowest', icon: ChevronsDown },
491+
{ index: 1, label: 'Low', icon: ChevronDown },
487492
{
488-
index: 1,
493+
index: 2,
489494
label: 'Medium',
495+
icon: CircleEqual,
490496
},
491497
{
492-
index: 2,
498+
index: 3,
493499
label: 'High',
500+
icon: ChevronUp,
501+
},
502+
{
503+
index: 4,
504+
label: 'Highest',
505+
icon: ChevronsUp,
494506
},
495507
];
496508

@@ -500,6 +512,21 @@ export class BaseTaskPriority extends LooseGooseyField {
500512
{{@model.label}}
501513
</template>
502514
};
515+
516+
static atom = class Atom extends Component<typeof this> {
517+
get selectedPriority() {
518+
return BaseTaskPriority.values.find((priority) => {
519+
return priority.label === this.args.model.label;
520+
});
521+
}
522+
523+
get selectedIcon() {
524+
return this.selectedPriority?.icon;
525+
}
526+
<template>
527+
<this.selectedIcon width='14px' height='14px' />
528+
</template>
529+
};
503530
}
504531

505532
export class TaskBase extends CardDef {

0 commit comments

Comments
 (0)