mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	Fix: quick launch not showing nested services (#4561)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									1b79e51194
								
							
						
					
					
						commit
						2f7d948a5c
					
				@ -166,6 +166,18 @@ const headerStyles = {
 | 
			
		||||
  boxedWidgets: "m-5 mb-0 sm:m-9 sm:mb-0 sm:mt-1",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function getAllServices(services) {
 | 
			
		||||
  function get(sg) {
 | 
			
		||||
    let nestedServices = [...sg.services];
 | 
			
		||||
    if (sg.groups.length > 0) {
 | 
			
		||||
      nestedServices = [...nestedServices, ...sg.groups.map(get).flat()];
 | 
			
		||||
    }
 | 
			
		||||
    return nestedServices;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return [...services.map(get).flat()];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function Home({ initialSettings }) {
 | 
			
		||||
  const { i18n } = useTranslation();
 | 
			
		||||
  const { theme, setTheme } = useContext(ThemeContext);
 | 
			
		||||
@ -182,10 +194,9 @@ function Home({ initialSettings }) {
 | 
			
		||||
  const { data: bookmarks } = useSWR("/api/bookmarks");
 | 
			
		||||
  const { data: widgets } = useSWR("/api/widgets");
 | 
			
		||||
 | 
			
		||||
  const servicesAndBookmarks = [
 | 
			
		||||
    ...services.map((sg) => sg.services).flat(),
 | 
			
		||||
    ...bookmarks.map((bg) => bg.bookmarks).flat(),
 | 
			
		||||
  ].filter((i) => i?.href);
 | 
			
		||||
  const servicesAndBookmarks = [...bookmarks.map((bg) => bg.bookmarks).flat(), ...getAllServices(services)].filter(
 | 
			
		||||
    (i) => i?.href,
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    if (settings.language) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user