diff --git a/package-lock.json b/package-lock.json index c06aeb7..04364c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,9 @@ "@mantine/form": "^8.2.8", "@mantine/hooks": "^8.2.8", "@mantine/notifications": "^8.2.8", - "@tanstack/react-query": "^5.85.9", - "@tanstack/react-query-devtools": "^5.85.9", - "@tanstack/react-query-persist-client": "^5.85.9", + "@tanstack/react-query": "^5.86.0", + "@tanstack/react-query-devtools": "^5.86.0", + "@tanstack/react-query-persist-client": "^5.86.0", "idb-keyval": "^6.2.2", "jotai": "^2.13.1", "react": "^19.1.1", @@ -26,7 +26,7 @@ "recharts": "^3.1.2" }, "devDependencies": { - "@types/node": "^24.3.0", + "@types/node": "^24.3.1", "@types/react": "^19.1.12", "@types/react-dom": "^19.1.9", "@vitejs/plugin-react": "^5.0.2", @@ -1642,9 +1642,9 @@ "license": "MIT" }, "node_modules/@tanstack/query-core": { - "version": "5.85.9", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.85.9.tgz", - "integrity": "sha512-5fxb9vwyftYE6KFLhhhDyLr8NO75+Wpu7pmTo+TkwKmMX2oxZDoLwcqGP8ItKSpUMwk3urWgQDZfyWr5Jm9LsQ==", + "version": "5.86.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.86.0.tgz", + "integrity": "sha512-Y6ibQm6BXbw6w1p3a5LrPn8Ae64M0dx7hGmnhrm9P+XAkCCKXOwZN0J5Z1wK/0RdNHtR9o+sWHDXd4veNI60tQ==", "license": "MIT", "funding": { "type": "github", @@ -1652,9 +1652,9 @@ } }, "node_modules/@tanstack/query-devtools": { - "version": "5.84.0", - "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.84.0.tgz", - "integrity": "sha512-fbF3n+z1rqhvd9EoGp5knHkv3p5B2Zml1yNRjh7sNXklngYI5RVIWUrUjZ1RIcEoscarUb0+bOvIs5x9dwzOXQ==", + "version": "5.86.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.86.0.tgz", + "integrity": "sha512-/JDw9BP80eambEK/EsDMGAcsL2VFT+8F5KCOwierjPU7QP8Wt1GT32yJpn3qOinBM8/zS3Jy36+F0GiyJp411A==", "license": "MIT", "funding": { "type": "github", @@ -1662,12 +1662,12 @@ } }, "node_modules/@tanstack/query-persist-client-core": { - "version": "5.85.9", - "resolved": "https://registry.npmjs.org/@tanstack/query-persist-client-core/-/query-persist-client-core-5.85.9.tgz", - "integrity": "sha512-er7HfMjn6TQanWG5nudjRNZbo7ahf7IIdWN5kU7L2qRZ2kcw89TQZAZ74GIQsumOXZD7sUcHG2dylveFZNxlZA==", + "version": "5.86.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-persist-client-core/-/query-persist-client-core-5.86.0.tgz", + "integrity": "sha512-EHHfmqkqHd1Rak2xv4ZT3SwZuSAZ09D6WzuqA8DIXsB/Ir3H9HB/3O1jJe2/LhmgIYSf6k8jYiblK14dvqhd0w==", "license": "MIT", "dependencies": { - "@tanstack/query-core": "5.85.9" + "@tanstack/query-core": "5.86.0" }, "funding": { "type": "github", @@ -1675,12 +1675,12 @@ } }, "node_modules/@tanstack/react-query": { - "version": "5.85.9", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.85.9.tgz", - "integrity": "sha512-2T5zgSpcOZXGkH/UObIbIkGmUPQqZqn7esVQFXLOze622h4spgWf5jmvrqAo9dnI13/hyMcNsF1jsoDcb59nJQ==", + "version": "5.86.0", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.86.0.tgz", + "integrity": "sha512-jgS/v0oSJkGHucv9zxOS8rL7mjATh1XO3K4eqAV4WMpAly8okcBrGi1YxRZN5S4B59F54x9JFjWrK5vMAvJYqA==", "license": "MIT", "dependencies": { - "@tanstack/query-core": "5.85.9" + "@tanstack/query-core": "5.86.0" }, "funding": { "type": "github", @@ -1691,36 +1691,36 @@ } }, "node_modules/@tanstack/react-query-devtools": { - "version": "5.85.9", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.85.9.tgz", - "integrity": "sha512-BAdhgwpzxkC1vdyCfiPbbC7FU/t/x6q2d9ZyhON/WykVUdznD69nlppuWpSIlIGipdRG7sF6tRZ6x3GtSq0EUQ==", + "version": "5.86.0", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.86.0.tgz", + "integrity": "sha512-+50IcXI+54qHx3IDccbTala4tkToKxa0WKqP4XWlTnP1mQNfHO3dJj8wwnzpG50os69kpSbnU8C98Q/i8b6lyA==", "license": "MIT", "dependencies": { - "@tanstack/query-devtools": "5.84.0" + "@tanstack/query-devtools": "5.86.0" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "@tanstack/react-query": "^5.85.9", + "@tanstack/react-query": "^5.86.0", "react": "^18 || ^19" } }, "node_modules/@tanstack/react-query-persist-client": { - "version": "5.85.9", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-persist-client/-/react-query-persist-client-5.85.9.tgz", - "integrity": "sha512-h75Xyt/XDtk1oRmli5znQRXclT/iZpseTK7ScqEjaiZmPSREgg2mJb1blo2SB1swSidDNsCtnENLNH43PP0/9w==", + "version": "5.86.0", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-persist-client/-/react-query-persist-client-5.86.0.tgz", + "integrity": "sha512-XoRmykJk1KiEjaEG4BiCOcNVg6bPGVkNFckRwN4vigNKDhrDhAG35cZbqIjflCJWz2CzpjdFwkrdoum4y4pG2g==", "license": "MIT", "dependencies": { - "@tanstack/query-persist-client-core": "5.85.9" + "@tanstack/query-persist-client-core": "5.86.0" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "@tanstack/react-query": "^5.85.9", + "@tanstack/react-query": "^5.86.0", "react": "^18 || ^19" } }, @@ -1859,9 +1859,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.0.tgz", - "integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==", + "version": "24.3.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.1.tgz", + "integrity": "sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 95fcf79..15cd128 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ "@mantine/form": "^8.2.8", "@mantine/hooks": "^8.2.8", "@mantine/notifications": "^8.2.8", - "@tanstack/react-query": "^5.85.9", - "@tanstack/react-query-devtools": "^5.85.9", - "@tanstack/react-query-persist-client": "^5.85.9", + "@tanstack/react-query": "^5.86.0", + "@tanstack/react-query-devtools": "^5.86.0", + "@tanstack/react-query-persist-client": "^5.86.0", "idb-keyval": "^6.2.2", "jotai": "^2.13.1", "react": "^19.1.1", @@ -28,7 +28,7 @@ "recharts": "^3.1.2" }, "devDependencies": { - "@types/node": "^24.3.0", + "@types/node": "^24.3.1", "@types/react": "^19.1.12", "@types/react-dom": "^19.1.9", "@vitejs/plugin-react": "^5.0.2", diff --git a/src/pages/homepage/Homepage.tsx b/src/pages/homepage/Homepage.tsx index bd58b7d..d4f6efa 100644 --- a/src/pages/homepage/Homepage.tsx +++ b/src/pages/homepage/Homepage.tsx @@ -1,4 +1,4 @@ -import { Grid, Stack } from '@mantine/core'; +import { Box, Grid, Stack } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; import CurrentWeather from 'components/WeatherModal/CurrentWeather'; import { useCommonHooks, useOSMAPI, useQueryAPI, useWeatherAPI } from 'hooks'; @@ -219,6 +219,7 @@ export function Homepage() { weatherModalOpened={weatherModalOpened} closeWeatherModal={closeWeatherModal} openWeatherModal={openWeatherModal} + position='top' />
) : ( - <> + - + @@ -243,8 +244,9 @@ export function Homepage() { weatherModalOpened={weatherModalOpened} closeWeatherModal={closeWeatherModal} openWeatherModal={openWeatherModal} + position='center' /> - + )} diff --git a/src/pages/homepage/components/Search/Search.tsx b/src/pages/homepage/components/Search/Search.tsx index 133bd68..1e241df 100644 --- a/src/pages/homepage/components/Search/Search.tsx +++ b/src/pages/homepage/components/Search/Search.tsx @@ -8,7 +8,7 @@ import { Text, } from '@mantine/core'; import { useDisclosure, useElementSize } from '@mantine/hooks'; -import { HelpModal, WeatherModal } from 'components'; +import { AppItem, HelpModal, WeatherModal } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import * as fa6 from 'react-icons/fa6'; @@ -31,12 +31,14 @@ export default function Search({ weatherModalOpened, closeWeatherModal, openWeatherModal, + position, }: { current: CurrentWeather; extendedForecast: ExtendedForecast[]; weatherModalOpened: boolean; closeWeatherModal: () => void; openWeatherModal: () => void; + position: string; }) { const { ref, height } = useElementSize(); const allIcons: any = { ...fa6, ...vsc, ...si }; @@ -55,6 +57,7 @@ export default function Search({ endpoint: 'api/providers/default', }); const [applications, setApplications] = useState([]); + const [filteredApplications, setFilteredApplications] = useState([]); const [bookmarks, setBookmarks] = useState([]); const searchEndpoint = 'api/searchHistory'; const { data: historyData, isFetched: historyDataIsFetched } = useQueryAPI({ @@ -296,7 +299,7 @@ export default function Search({ }; }); } - return [ + const historyOptions = [ ...options .filter((option: any) => { return splittedSearch.every((searchWord) => @@ -308,16 +311,23 @@ export default function Search({ ); }) .slice(0, 10 * historyMult), - { - label: 'Load more history...', - value: 'load', - id: 0, - dateTimeStamp: '', - prefix: '', - provider: '', - searchTerm: '', - }, ]; + + if (historyOptions.length >= 10 * historyMult) { + return [ + ...historyOptions, + { + label: 'Load more history...', + value: 'load', + id: 0, + dateTimeStamp: '', + prefix: '', + provider: '', + searchTerm: '', + }, + ]; + } + return historyOptions; }; useEffect(() => { @@ -332,6 +342,16 @@ export default function Search({ } }, [applicationData, isApplicationDataFetching]); + useEffect(() => { + if (applications) { + setFilteredApplications( + applications.filter((app: Application) => + app.name.toLowerCase().includes(searchValue.toLowerCase()), + ), + ); + } + }, [applications, searchValue]); + useEffect(() => { if (bookmarkData && bookmarksIsFetched) { setBookmarks( @@ -384,25 +404,25 @@ export default function Search({ setDefaultProviderLabel(defaultProviderData[0]?.name ?? 'Google Search'); } }, [defaultProviderData, defaultProviderDataIsFetched]); + return ( <> - {dropdownOpened && } + {dropdownOpened && }