Fix nested services not showing up in quick launch
This commit is contained in:
parent
1b79e51194
commit
2b6990c3dd
@ -166,6 +166,22 @@ const headerStyles = {
|
|||||||
boxedWidgets: "m-5 mb-0 sm:m-9 sm:mb-0 sm:mt-1",
|
boxedWidgets: "m-5 mb-0 sm:m-9 sm:mb-0 sm:mt-1",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getAllServices(services) {
|
||||||
|
function get(sg){
|
||||||
|
let nestedServices = [];
|
||||||
|
if (sg.groups.length > 0) {
|
||||||
|
nestedServices = [...nestedServices, ...sg.groups.map(get).flat()]
|
||||||
|
}
|
||||||
|
nestedServices = [...nestedServices, ...sg.services.flat()]
|
||||||
|
return nestedServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
...services.map(get).flat()
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function Home({ initialSettings }) {
|
function Home({ initialSettings }) {
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
const { theme, setTheme } = useContext(ThemeContext);
|
const { theme, setTheme } = useContext(ThemeContext);
|
||||||
@ -183,8 +199,8 @@ function Home({ initialSettings }) {
|
|||||||
const { data: widgets } = useSWR("/api/widgets");
|
const { data: widgets } = useSWR("/api/widgets");
|
||||||
|
|
||||||
const servicesAndBookmarks = [
|
const servicesAndBookmarks = [
|
||||||
...services.map((sg) => sg.services).flat(),
|
|
||||||
...bookmarks.map((bg) => bg.bookmarks).flat(),
|
...bookmarks.map((bg) => bg.bookmarks).flat(),
|
||||||
|
...getAllServices(services)
|
||||||
].filter((i) => i?.href);
|
].filter((i) => i?.href);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user