mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 21:43:39 +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";
|
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 { t } = useTranslation();
|
||||||
|
|
||||||
const searchField = useRef();
|
const searchField = useRef();
|
||||||
@ -53,13 +53,13 @@ export default function QuickLaunch({bookmarksAndServices, searchString, setSear
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (searchString.length === 0) setResults([]);
|
if (searchString.length === 0) setResults([]);
|
||||||
else {
|
else {
|
||||||
const newResults = bookmarksAndServices.filter(r => r.name.toLowerCase().includes(searchString));
|
const newResults = servicesAndBookmarks.filter(r => r.name.toLowerCase().includes(searchString));
|
||||||
setResults(newResults);
|
setResults(newResults);
|
||||||
if (newResults.length) {
|
if (newResults.length) {
|
||||||
setCurrentItemIndex(0);
|
setCurrentItemIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [searchString, bookmarksAndServices])
|
}, [searchString, servicesAndBookmarks])
|
||||||
|
|
||||||
|
|
||||||
const [hidden, setHidden] = useState(true);
|
const [hidden, setHidden] = useState(true);
|
||||||
|
@ -175,7 +175,7 @@ function Home({ initialSettings }) {
|
|||||||
const { data: bookmarks } = useSWR("/api/bookmarks");
|
const { data: bookmarks } = useSWR("/api/bookmarks");
|
||||||
const { data: widgets } = useSWR("/api/widgets");
|
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(() => {
|
useEffect(() => {
|
||||||
if (settings.language) {
|
if (settings.language) {
|
||||||
@ -236,7 +236,7 @@ function Home({ initialSettings }) {
|
|||||||
headerStyles[initialSettings.headerStyle || "underlined"]
|
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 && (
|
||||||
<>
|
<>
|
||||||
{widgets
|
{widgets
|
||||||
|
Loading…
x
Reference in New Issue
Block a user