feat: reintroduce config.toggles to hide parts of the radar and change behaviour
This commit is contained in:
@@ -9,4 +9,8 @@ if (userConfig.colors)
|
||||
|
||||
if (userConfig.labels)
|
||||
config.labels = { ...defaultConfig.labels, ...userConfig.labels };
|
||||
|
||||
if (userConfig.toggles)
|
||||
config.toggles = { ...defaultConfig.toggles, ...userConfig.toggles };
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -8,6 +8,10 @@ export function getLabel(key: keyof typeof config.labels) {
|
||||
return config.labels[key] || "";
|
||||
}
|
||||
|
||||
export function getToggle(key: keyof typeof config.toggles) {
|
||||
return config.toggles[key] || false;
|
||||
}
|
||||
|
||||
export function getAppName() {
|
||||
return getLabel("title");
|
||||
}
|
||||
@@ -80,10 +84,11 @@ export const sortByFeaturedAndTitle = (a: Item, b: Item) =>
|
||||
Number(b.featured) - Number(a.featured) || a.title.localeCompare(b.title);
|
||||
|
||||
export const groupItemsByRing = (items: Item[]) => {
|
||||
const showEmptyRings = getToggle("showEmptyRings");
|
||||
return getRings().reduce(
|
||||
(acc, ring) => {
|
||||
const ringItems = items.filter((item) => item.ring === ring.id);
|
||||
if (ringItems.length) acc[ring.id] = ringItems;
|
||||
if (ringItems.length || showEmptyRings) acc[ring.id] = ringItems;
|
||||
return acc;
|
||||
},
|
||||
{} as { [ringId: string]: Item[] },
|
||||
|
||||
Reference in New Issue
Block a user