Skip to content

Commit

Permalink
[ADD] Re-scan button
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarrc committed Dec 12, 2022
1 parent af055b6 commit c979ea8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/hooks/useMidi.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ const MidiProvider = ({ children }) => {
playNote,
controlChange,
pitchBend,
stopAll
stopAll,
parseDevices
}}>
{ children }
</MidiContext.Provider>
Expand Down
8 changes: 7 additions & 1 deletion src/views/modals/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ import { useLayout } from "../../hooks/useLayout";
import { useMidi } from "../../hooks/useMidi";

const Settings = () => {
const { devices, setDevices, channels, setChannels } = useMidi();
const { devices, setDevices, channels, setChannels, parseDevices } = useMidi();
const { handleModal } = useLayout();

const close = (e) => {
e.preventDefault();
handleModal();
}

const rescan = (e) => {
e.preventDefault();
parseDevices();
}

return (
<div className="card w-full max-w-lg bg-neutral shadow-xl overflow-visible">
<div className="card-body">
Expand Down Expand Up @@ -60,6 +65,7 @@ const Settings = () => {
/>
</div>
<div className="card-actions justify-end gap-2 mt-4">
<button onClick={ rescan } className="btn btn-sm btn-primary btn-link no-underline">Re-scan</button>
<button onClick={ close } className="btn btn-sm btn-primary btn-outline">Close</button>
</div>
</form>
Expand Down

0 comments on commit c979ea8

Please sign in to comment.