diff --git a/src/pages/homepage/components/SettingsButton/SettingsButton.tsx b/src/pages/homepage/components/SettingsButton/SettingsButton.tsx index 6f93144..8a20633 100644 --- a/src/pages/homepage/components/SettingsButton/SettingsButton.tsx +++ b/src/pages/homepage/components/SettingsButton/SettingsButton.tsx @@ -20,7 +20,7 @@ function SettingsButton() { const { mutateAsync } = useMutationAPI(); const [categories, setCategories] = useState([{ value: 'All', label: 'All' }]); - const [selectedClient] = useState(wolClientData?.[0]); + const [selectedClient, setSelectedClient] = useState(wolClientData?.[0]); const navigate = useNavigate(); const { theme, @@ -62,7 +62,6 @@ function SettingsButton() { setWolClients(wolClientData); } }, [wolClientData, wolClientDataIsFetched]); - return ( diff --git a/src/pages/homepage/components/SettingsButton/WakeOnLanCard.tsx b/src/pages/homepage/components/SettingsButton/WakeOnLanCard.tsx index 440e19d..ceddc34 100644 --- a/src/pages/homepage/components/SettingsButton/WakeOnLanCard.tsx +++ b/src/pages/homepage/components/SettingsButton/WakeOnLanCard.tsx @@ -6,10 +6,12 @@ import type { WolClient } from 'types'; function WakeOnLan({ wolClients, selectedClient, + setSelectedClient, handleWakeRequest, }: { wolClients: WolClient[]; selectedClient: WolClient | null; + setSelectedClient: any; handleWakeRequest: () => void; }) { return ( @@ -37,6 +39,12 @@ function WakeOnLan({ labelProps={{ display: 'none' }} placeholder='Pick a host...' defaultValue={wolClients?.[0]?.hostname} + onChange={(_, option: any) => { + setSelectedClient({ + hostname: option?.hostname, + macAddress: option?.macAddress, + }); + }} data={ wolClients ?.map((wolClient: WolClient) => {