mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 13:33:40 +01:00
services should come first
This commit is contained in:
parent
b5410eea12
commit
484d69a4b5
@ -4,7 +4,7 @@ import classNames from "classnames";
|
||||
|
||||
import { resolveIcon } from "./services/item";
|
||||
|
||||
export default function QuickLaunch({bookmarksAndServices, searchString, setSearchString, isOpen, close}) {
|
||||
export default function QuickLaunch({servicesAndBookmarks, searchString, setSearchString, isOpen, close}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const searchField = useRef();
|
||||
@ -53,13 +53,13 @@ export default function QuickLaunch({bookmarksAndServices, searchString, setSear
|
||||
useEffect(() => {
|
||||
if (searchString.length === 0) setResults([]);
|
||||
else {
|
||||
const newResults = bookmarksAndServices.filter(r => r.name.toLowerCase().includes(searchString));
|
||||
const newResults = servicesAndBookmarks.filter(r => r.name.toLowerCase().includes(searchString));
|
||||
setResults(newResults);
|
||||
if (newResults.length) {
|
||||
setCurrentItemIndex(0);
|
||||
}
|
||||
}
|
||||
}, [searchString, bookmarksAndServices])
|
||||
}, [searchString, servicesAndBookmarks])
|
||||
|
||||
|
||||
const [hidden, setHidden] = useState(true);
|
||||
|
@ -175,7 +175,7 @@ function Home({ initialSettings }) {
|
||||
const { data: bookmarks } = useSWR("/api/bookmarks");
|
||||
const { data: widgets } = useSWR("/api/widgets");
|
||||
|
||||
const bookmarksAndServices = [...bookmarks.map(bg => bg.bookmarks).flat(), ...services.map(sg => sg.services).flat()]
|
||||
const servicesAndBookmarks = [...services.map(sg => sg.services).flat(), ...bookmarks.map(bg => bg.bookmarks).flat()]
|
||||
|
||||
useEffect(() => {
|
||||
if (settings.language) {
|
||||
@ -236,7 +236,7 @@ function Home({ initialSettings }) {
|
||||
headerStyles[initialSettings.headerStyle || "underlined"]
|
||||
)}
|
||||
>
|
||||
<QuickLaunch bookmarksAndServices={bookmarksAndServices} searchString={searchString} setSearchString={setSearchString} isOpen={searching} close={setSearching} />
|
||||
<QuickLaunch servicesAndBookmarks={servicesAndBookmarks} searchString={searchString} setSearchString={setSearchString} isOpen={searching} close={setSearching} />
|
||||
{widgets && (
|
||||
<>
|
||||
{widgets
|
||||
|
Loading…
x
Reference in New Issue
Block a user