Skip to content

Commit 61d50c6

Browse files
Convert scss files to css (#2281)
* Convert main scss files to css * Finish converting styles to css * Kind of fix restore from backup * Fix variables * Fix loading dots
1 parent de9d752 commit 61d50c6

36 files changed

Lines changed: 211 additions & 1508 deletions

.stylelintrc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
'use strict';
22

33
module.exports = {
4-
extends: ['stylelint-config-standard-scss'],
4+
extends: ['stylelint-config-standard'],
55
rules: {
66
'at-rule-no-deprecated': [true, { ignoreAtRules: ['/^view/', 'apply'] }],
7-
'scss/at-rule-no-unknown': [true, { ignoreAtRules: ['tailwind'] }],
87
},
98
};

app/components/colors-list.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
3232
if (!palette.$isDisconnected) {
3333
if (palette.isColorHistory) {
3434
return [...palette.colors].sort((a, b) => {
35-
return b.createdAt?.localeCompare(a.createdAt);
35+
return (
36+
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
37+
);
3638
});
3739
} else {
3840
return palette.colorOrder.map((color: { type: string; id: string }) => {

app/components/settings-data.ts

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -73,60 +73,64 @@ export default class SettingsData extends Component {
7373
importIndexedDB = async () => {
7474
if (this.ipcRenderer) {
7575
this.isImporting = true;
76-
await this.ipcRenderer.invoke('importData').then((jsonString: string) => {
77-
if (jsonString) {
78-
const DBOpenRequest = getDBOpenRequest();
79-
80-
DBOpenRequest.onsuccess = () => {
81-
const idbDatabase = DBOpenRequest.result;
82-
83-
IDBExportImport.clearDatabase(idbDatabase, (err: Event | null) => {
84-
if (!err) {
85-
// cleared data successfully
86-
IDBExportImport.importFromJsonString(
87-
idbDatabase,
88-
jsonString,
89-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
90-
async (err: Event | null) => {
91-
if (!err) {
92-
idbDatabase.close();
93-
94-
// TODO is pulling from the backup with orbit the best "refresh" here?
95-
const backup =
96-
this.dataCoordinator.getSource<IndexedDBSource>(
97-
'backup',
98-
);
99-
100-
if (backup) {
101-
const records = await backup.query<InitializedRecord[]>(
102-
(q) => q.findRecords(),
103-
);
104-
105-
await this.store.sync((t) =>
106-
records.map((r) => {
107-
if (r?.attributes?.['hex']) {
108-
delete r.attributes['hex'];
109-
}
110-
111-
return t.addRecord(r);
112-
}),
113-
);
114-
this.flashMessages.success(
115-
'Data successfully replaced.',
116-
);
117-
}
76+
const jsonString = await this.ipcRenderer.invoke('importData') as string;
77+
78+
if (jsonString) {
79+
const DBOpenRequest = getDBOpenRequest();
80+
81+
DBOpenRequest.onsuccess = () => {
82+
const idbDatabase = DBOpenRequest.result;
83+
84+
IDBExportImport.clearDatabase(idbDatabase, (err: Event | null) => {
85+
if (!err) {
86+
// cleared data successfully
87+
IDBExportImport.importFromJsonString(
88+
idbDatabase,
89+
jsonString,
90+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
91+
async (err: Event | null) => {
92+
if (!err) {
93+
idbDatabase.close();
94+
95+
// TODO is pulling from the backup with orbit the best "refresh" here?
96+
const backup =
97+
this.dataCoordinator.getSource<IndexedDBSource>('backup');
98+
99+
if (backup) {
100+
const records = await backup.query<InitializedRecord[]>(
101+
(q) => q.findRecords(),
102+
);
103+
104+
await this.store.sync((t) =>
105+
records.map((r) => {
106+
if (r?.attributes?.['hex']) {
107+
delete r.attributes['hex'];
108+
}
109+
110+
// We have to make sure these are all Date objects
111+
// otherwise orbit will throw a validation error
112+
if (r?.attributes?.['createdAt']) {
113+
r.attributes['createdAt'] = new Date(
114+
r.attributes['createdAt'] as string,
115+
);
116+
}
117+
118+
return t.addRecord(r);
119+
}),
120+
);
121+
this.flashMessages.success('Data successfully replaced.');
118122
}
123+
}
119124

120-
this.isImporting = false;
121-
},
122-
);
123-
}
124-
});
125-
};
126-
} else {
127-
this.isImporting = false;
128-
}
129-
});
125+
this.isImporting = false;
126+
},
127+
);
128+
}
129+
});
130+
};
131+
} else {
132+
this.isImporting = false;
133+
}
130134
}
131135
};
132136
}

app/controllers/palettes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export default class PalettesController extends Controller {
3434
return [...colorHistory.colors]
3535
.slice()
3636
.sort((a, b) => {
37-
return b.createdAt?.localeCompare(a.createdAt);
37+
return (
38+
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
39+
);
3840
})
3941
.slice(0, 16);
4042
} else {
File renamed without changes.

0 commit comments

Comments
 (0)