Skip to content

Commit 490efed

Browse files
authored
Merge pull request #200 from cachho/chore/DatabaseUpdate
chore: database update
2 parents f070c21 + 9f9e1d1 commit 490efed

File tree

4 files changed

+15
-139
lines changed

4 files changed

+15
-139
lines changed

src/components/Popup.tsx

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -375,76 +375,16 @@ const Popup = () => {
375375
<br />
376376
<input
377377
type="checkbox"
378-
checked={settings.showAmountSoldSummary}
378+
checked={settings.showAmountSold}
379379
onChange={() =>
380380
setSettings({
381381
...settings,
382-
showAmountSoldSummary: !settings.showAmountSoldSummary,
382+
showAmountSold: !settings.showAmountSold,
383383
})
384384
}
385385
/>
386-
display amount sold total summary
386+
display amount sold (last 30 days)
387387
<br />
388-
<input
389-
type="checkbox"
390-
checked={settings.showAmountSold1}
391-
onChange={() =>
392-
setSettings({
393-
...settings,
394-
showAmountSold1: !settings.showAmountSold1,
395-
})
396-
}
397-
/>
398-
display amount sold 24 hours
399-
<br />
400-
<input
401-
type="checkbox"
402-
checked={settings.showAmountSold7}
403-
onChange={() =>
404-
setSettings({
405-
...settings,
406-
showAmountSold7: !settings.showAmountSold7,
407-
})
408-
}
409-
/>
410-
display amount sold 7 days
411-
<br />
412-
<input
413-
type="checkbox"
414-
checked={settings.showAmountSold30}
415-
onChange={() =>
416-
setSettings({
417-
...settings,
418-
showAmountSold30: !settings.showAmountSold30,
419-
})
420-
}
421-
/>
422-
display amount sold 30 days
423-
<br />
424-
<input
425-
type="checkbox"
426-
checked={settings.showAmountSoldAt}
427-
onChange={() =>
428-
setSettings({
429-
...settings,
430-
showAmountSoldAt: !settings.showAmountSoldAt,
431-
})
432-
}
433-
/>
434-
display amount sold all time
435-
<br />
436-
<input
437-
type="checkbox"
438-
checked={settings.showAmountSoldTimeframeLabel}
439-
onChange={() =>
440-
setSettings({
441-
...settings,
442-
showAmountSoldTimeframeLabel:
443-
!settings.showAmountSoldTimeframeLabel,
444-
})
445-
}
446-
/>
447-
display amount sold timeframe label
448388
<br />
449389
<input
450390
type="checkbox"
@@ -456,7 +396,7 @@ const Popup = () => {
456396
})
457397
}
458398
/>
459-
display 30 day position (ranking)
399+
display ranking (last 30 days)
460400
<br />
461401
<input
462402
type="checkbox"

src/lib/html/addHtmlOnlineElements.ts

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,67 +26,21 @@ export function addHtmlOnlineElements(
2626
);
2727
}
2828

29-
if (settings.showPos && details.amountSold[30] > 0) {
29+
if (settings.showPos && details.amountSold.pos < 1000) {
3030
link.insertAdjacentElement(
3131
'afterend',
3232
addDetailsElement(`#${details.amountSold.pos}`, true)
3333
);
3434
}
3535

36-
if (settings.showAmountSoldAt) {
36+
if (
37+
settings.showAmountSold &&
38+
details.amountSold !== undefined &&
39+
details.amountSold !== null
40+
) {
3741
link.insertAdjacentElement(
3842
'afterend',
39-
addDetailsElement(
40-
`${settings.showAmountSoldTimeframeLabel ? 'all-time: ' : ''}${
41-
details.amountSold.at
42-
} sold`,
43-
true
44-
)
45-
);
46-
}
47-
48-
if (settings.showAmountSold30) {
49-
link.insertAdjacentElement(
50-
'afterend',
51-
addDetailsElement(
52-
`${settings.showAmountSoldTimeframeLabel ? '30d: ' : ''}${
53-
details.amountSold[30]
54-
} sold`,
55-
true
56-
)
57-
);
58-
}
59-
60-
if (settings.showAmountSold7) {
61-
link.insertAdjacentElement(
62-
'afterend',
63-
addDetailsElement(
64-
`${settings.showAmountSoldTimeframeLabel ? '7d: ' : ''}${
65-
details.amountSold[7]
66-
} sold`,
67-
true
68-
)
69-
);
70-
}
71-
72-
if (settings.showAmountSold1) {
73-
link.insertAdjacentElement(
74-
'afterend',
75-
addDetailsElement(
76-
`${settings.showAmountSoldTimeframeLabel ? '24h: ' : ''}${
77-
details.amountSold[1]
78-
} sold`,
79-
true
80-
)
81-
);
82-
}
83-
84-
if (settings.showAmountSoldSummary) {
85-
link.insertAdjacentElement(
86-
'afterend',
87-
addDetailsElement(
88-
`sold: 24h: ${details.amountSold[1]} / 7d: ${details.amountSold[7]} / 30d: ${details.amountSold[30]} / all-time: ${details.amountSold.at}`
89-
)
43+
addDetailsElement(`${details.amountSold.count} sold`, true)
9044
);
9145
}
9246

src/models/Details.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
export type Details = {
22
amountSold: {
3-
1: number;
4-
7: number;
5-
30: number;
6-
at: number;
3+
count: number;
74
pos: number;
85
};
96
item: {

src/models/Settings.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ export const settingNames: (keyof Settings)[] = [
1818
'onlineFeaturesQcPhotos',
1919
'showThumbnail',
2020
'showPrice',
21-
'showAmountSoldSummary',
22-
'showAmountSold1',
23-
'showAmountSold7',
24-
'showAmountSold30',
25-
'showAmountSoldAt',
26-
'showAmountSoldTimeframeLabel',
21+
'showAmountSold',
2722
'showPos',
2823
'showTitle',
2924
'displayTitleLength',
@@ -51,12 +46,7 @@ export type Settings = {
5146
onlineFeaturesQcPhotos: boolean;
5247
showThumbnail: boolean;
5348
showPrice: boolean;
54-
showAmountSoldSummary: boolean;
55-
showAmountSold1: boolean;
56-
showAmountSold7: boolean;
57-
showAmountSold30: boolean;
58-
showAmountSoldAt: boolean;
59-
showAmountSoldTimeframeLabel: boolean;
49+
showAmountSold: boolean;
6050
showPos: boolean;
6151
showTitle: boolean;
6252
displayTitleLength: string;
@@ -84,12 +74,7 @@ export const defaultSettings: Settings = {
8474
onlineFeaturesQcPhotos: true,
8575
showThumbnail: true,
8676
showPrice: true,
87-
showAmountSoldSummary: false,
88-
showAmountSold1: false,
89-
showAmountSold7: false,
90-
showAmountSold30: true,
91-
showAmountSoldAt: false,
92-
showAmountSoldTimeframeLabel: false,
77+
showAmountSold: true,
9378
showPos: false,
9479
showTitle: true,
9580
displayTitleLength: '64',

0 commit comments

Comments
 (0)