Skip to content

Commit 8093409

Browse files
Another one
1 parent 62cef42 commit 8093409

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

app/components/colors-list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
3434
return palette.colors.sortBy('createdAt').reverse();
3535
} else {
3636
return palette.colorOrder.map((color: ColorModel) => {
37-
return palette.colors.findBy('id', color.id);
37+
return palette.colors.find((c) => c.id === color.id);
3838
});
3939
}
4040
}
@@ -77,7 +77,7 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
7777
return { type: 'color', id: color.id };
7878
});
7979

80-
const colorToRemove = colorsList.findBy('id', color.id);
80+
const colorToRemove = colorsList.find((c) => c.id === color.id);
8181

8282
if (colorToRemove) {
8383
colorsList.removeObject(colorToRemove);

app/components/palette-row.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export default class PaletteRowComponent extends Component<PaletteRowSignature>
157157
),
158158
];
159159

160+
// @ts-expect-error dragSort.on does not seem to exist in TS
160161
this.dragSort.on(
161162
'start',
162163
(event: { draggedItem: { hex: string | null } }) => {
@@ -175,7 +176,7 @@ export default class PaletteRowComponent extends Component<PaletteRowSignature>
175176
get sortedColors(): (ColorModel | undefined)[] {
176177
return this.args?.palette?.colorOrder?.map(
177178
(color: { type: string; id: string }) => {
178-
return this.args.palette.colors.findBy('id', color.id);
179+
return this.args.palette.colors.find((c) => c.id === color.id);
179180
},
180181
);
181182
}

app/components/palettes-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default class PalettesListComponent extends Component<PalettesListSignatu
6161
}): Promise<void> {
6262
if (sourceList === targetList && sourceIndex === targetIndex) return;
6363

64-
const movedItem = sourceList.objectAt(sourceIndex) as PaletteModel;
64+
const movedItem = sourceList[sourceIndex] as PaletteModel;
6565

6666
sourceList.removeAt(sourceIndex);
6767
targetList.insertAt(targetIndex, movedItem);

app/components/settings-data.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default class SettingsData extends Component {
5252

5353
IDBExportImport.exportToJsonString(
5454
idbDatabase,
55-
(err: Event, jsonString: string) => {
55+
(err: Event | null, jsonString: string) => {
5656
if (err) {
5757
this.flashMessages.danger('An error occurred.');
5858
// eslint-disable-next-line no-console
@@ -83,13 +83,13 @@ export default class SettingsData extends Component {
8383
DBOpenRequest.onsuccess = () => {
8484
const idbDatabase = DBOpenRequest.result;
8585

86-
IDBExportImport.clearDatabase(idbDatabase, (err: Event) => {
86+
IDBExportImport.clearDatabase(idbDatabase, (err: Event | null) => {
8787
if (!err) {
8888
// cleared data successfully
8989
IDBExportImport.importFromJsonString(
9090
idbDatabase,
9191
jsonString,
92-
async (err: Event) => {
92+
async (err: Event | null) => {
9393
if (!err) {
9494
idbDatabase.close();
9595

@@ -106,8 +106,8 @@ export default class SettingsData extends Component {
106106

107107
await this.store.sync((t) =>
108108
records.map((r) => {
109-
if (r?.attributes?.hex) {
110-
delete r.attributes.hex;
109+
if (r?.attributes?.['hex']) {
110+
delete r.attributes['hex'];
111111
}
112112

113113
return t.addRecord(r);

app/controllers/palettes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default class PalettesController extends Controller {
107107
// If the palette is locked, we should not allow dragging colors into or out of it
108108
if (sourcePalette?.isLocked || targetPalette?.isLocked) return;
109109

110-
const sourceColor = sourceList.objectAt(sourceIndex);
110+
const sourceColor = sourceList[sourceIndex];
111111

112112
if (sourceColor) {
113113
if (sourceArgs.isColorHistory) {

0 commit comments

Comments
 (0)