Do a little formatting
This commit is contained in:
parent
1d1b19b336
commit
e8241a32c2
1 changed files with 4 additions and 6 deletions
|
|
@ -7,10 +7,9 @@ function isRecent(date: number): boolean {
|
||||||
return now - date < sixHours;
|
return now - date < sixHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const yazzyUrl = import.meta.env.YAZZY_URL;
|
||||||
const feedItems = await getAllFeedItems();
|
const feedItems = await getAllFeedItems();
|
||||||
const recentCount = feedItems.contents.filter((item) =>
|
|
||||||
isRecent(item.pubIsoDate),
|
|
||||||
).length;
|
|
||||||
const categories = [
|
const categories = [
|
||||||
"All",
|
"All",
|
||||||
"Recent",
|
"Recent",
|
||||||
|
|
@ -18,9 +17,6 @@ const categories = [
|
||||||
new Set(feedItems.contents.map((item) => item.category)),
|
new Set(feedItems.contents.map((item) => item.category)),
|
||||||
).sort(),
|
).sort(),
|
||||||
];
|
];
|
||||||
|
|
||||||
const yazzyUrl = import.meta.env.YAZZY_URL;
|
|
||||||
|
|
||||||
const categoryCounts = categories.reduce((acc, category) => {
|
const categoryCounts = categories.reduce((acc, category) => {
|
||||||
if (category === "All") {
|
if (category === "All") {
|
||||||
acc[category] = feedItems.contents.length;
|
acc[category] = feedItems.contents.length;
|
||||||
|
|
@ -88,10 +84,12 @@ const pickRandomAccentColor = () => {
|
||||||
const index = Math.floor(Math.random() * accentColorsKeys.length);
|
const index = Math.floor(Math.random() * accentColorsKeys.length);
|
||||||
return accentColors[accentColorsKeys[index]];
|
return accentColors[accentColorsKeys[index]];
|
||||||
};
|
};
|
||||||
|
|
||||||
const categoryColors = categories.reduce((acc, category) => {
|
const categoryColors = categories.reduce((acc, category) => {
|
||||||
acc[category] = pickRandomAccentColor();
|
acc[category] = pickRandomAccentColor();
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const categoriesSelectorCss = categories
|
const categoriesSelectorCss = categories
|
||||||
.filter((c) => c !== "All")
|
.filter((c) => c !== "All")
|
||||||
.map(
|
.map(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue