Skip to content

Commit 3080d91

Browse files
committed
refactor: - replace strings with values from TaskLayoutComponent
1 parent 97e92e0 commit 3080d91

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/TaskSerializer/DefaultTaskSerializer.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Moment } from 'moment';
2-
import { type TaskLayoutComponent, TaskLayoutOptions } from '../Layout/TaskLayoutOptions';
2+
import { TaskLayoutComponent, TaskLayoutOptions } from '../Layout/TaskLayoutOptions';
33
import { Recurrence } from '../Task/Recurrence';
44
import { Task } from '../Task/Task';
55
import { Priority } from '../Task/Priority';
@@ -136,9 +136,9 @@ export class DefaultTaskSerializer implements TaskSerializer {
136136

137137
switch (component) {
138138
// NEW_TASK_FIELD_EDIT_REQUIRED
139-
case 'description':
139+
case TaskLayoutComponent.Description:
140140
return task.description;
141-
case 'priority': {
141+
case TaskLayoutComponent.Priority: {
142142
let priority: string = '';
143143

144144
if (task.priority === Priority.Highest) {
@@ -154,29 +154,29 @@ export class DefaultTaskSerializer implements TaskSerializer {
154154
}
155155
return priority;
156156
}
157-
case 'startDate':
157+
case TaskLayoutComponent.StartDate:
158158
return symbolAndDateValue(shortMode, startDateSymbol, task.startDate);
159-
case 'createdDate':
159+
case TaskLayoutComponent.CreatedDate:
160160
return symbolAndDateValue(shortMode, createdDateSymbol, task.createdDate);
161-
case 'scheduledDate':
161+
case TaskLayoutComponent.ScheduledDate:
162162
if (task.scheduledDateIsInferred) return '';
163163
return symbolAndDateValue(shortMode, scheduledDateSymbol, task.scheduledDate);
164-
case 'doneDate':
164+
case TaskLayoutComponent.DoneDate:
165165
return symbolAndDateValue(shortMode, doneDateSymbol, task.doneDate);
166-
case 'cancelledDate':
166+
case TaskLayoutComponent.CancelledDate:
167167
return symbolAndDateValue(shortMode, cancelledDateSymbol, task.cancelledDate);
168-
case 'dueDate':
168+
case TaskLayoutComponent.DueDate:
169169
return symbolAndDateValue(shortMode, dueDateSymbol, task.dueDate);
170-
case 'recurrenceRule':
170+
case TaskLayoutComponent.RecurrenceRule:
171171
if (!task.recurrence) return '';
172172
return symbolAndStringValue(shortMode, recurrenceSymbol, task.recurrence.toText());
173-
case 'blockedBy': {
173+
case TaskLayoutComponent.BlockedBy: {
174174
if (task.blockedBy.length === 0) return '';
175175
return symbolAndStringValue(shortMode, blockedBySymbol, task.blockedBy.join(','));
176176
}
177-
case 'id':
177+
case TaskLayoutComponent.Id:
178178
return symbolAndStringValue(shortMode, idSymbol, task.id);
179-
case 'blockLink':
179+
case TaskLayoutComponent.BlockLink:
180180
return task.blockLink ?? '';
181181
default:
182182
throw new Error(`Don't know how to render task component of type '${component}'`);

0 commit comments

Comments
 (0)