diff --git a/ui/.yarnclean b/ui/.yarnclean new file mode 100644 index 0000000..b591611 --- /dev/null +++ b/ui/.yarnclean @@ -0,0 +1,45 @@ +# test directories +__tests__ +test +tests +powered-test + +# asset directories +docs +doc +website +images +assets + +# examples +example +examples + +# code coverage directories +coverage +.nyc_output + +# build scripts +Makefile +Gulpfile.js +Gruntfile.js + +# configs +appveyor.yml +circle.yml +codeship-services.yml +codeship-steps.yml +wercker.yml +.tern-project +.gitattributes +.editorconfig +.*ignore +.eslintrc +.jshintrc +.flowconfig +.documentup.json +.yarn-metadata.json +.travis.yml + +# misc +*.md diff --git a/ui/package.json b/ui/package.json index 5a87da3..42ffe56 100644 --- a/ui/package.json +++ b/ui/package.json @@ -13,7 +13,6 @@ "@types/react-dom": "^18.0.2", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-redux": "^8.0.1", "react-scripts": "5.0.1", "react-use-websocket": "^4.3.1", "sass": "^1.58.3", diff --git a/ui/src/App.test.tsx b/ui/src/App.test.tsx index 659cc13..46610f2 100644 --- a/ui/src/App.test.tsx +++ b/ui/src/App.test.tsx @@ -1,15 +1,11 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { Provider } from 'react-redux'; -import { store } from './app/store'; import App from './App'; test('renders learn react link', () => { - const { getByText } = render( - - - - ); + const { getByText } = render( + + ); - expect(getByText(/learn/i)).toBeInTheDocument(); + expect(getByText(/recupera stato/i)).toBeInTheDocument(); }); diff --git a/ui/src/App.tsx b/ui/src/App.tsx index b1f25f2..e3cff10 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { RadioToggler } from './features/radio/Radio'; -import { LogViewer } from './features/radio/LogViewer'; +import { RadioToggler } from './Radio'; +import { LogViewer } from './LogViewer'; import './App.css'; function App() { diff --git a/ui/src/features/radio/LogViewer.module.scss b/ui/src/LogViewer.module.scss similarity index 100% rename from ui/src/features/radio/LogViewer.module.scss rename to ui/src/LogViewer.module.scss diff --git a/ui/src/features/radio/LogViewer.tsx b/ui/src/LogViewer.tsx similarity index 73% rename from ui/src/features/radio/LogViewer.tsx rename to ui/src/LogViewer.tsx index 36c6138..ebc4d2c 100644 --- a/ui/src/features/radio/LogViewer.tsx +++ b/ui/src/LogViewer.tsx @@ -1,21 +1,25 @@ import React, { useState } from 'react'; -import { useAppSelector, useAppDispatch } from '../../app/hooks'; -import { selectLogsLoading, selectLogs, requestLogsThunk } from './radioSlice'; +import { requestLogs } from './radioAPI'; import styles from './LogViewer.module.scss'; export function LogViewer() { - const loading = useAppSelector(selectLogsLoading); - const logs = useAppSelector(selectLogs); + const [loading, setLoading] = useState(false); + const [logs, setLogs] = useState(undefined); const [hidden, setHidden] = useState(true); - const dispatch = useAppDispatch(); + const onRequestLogsButtonClick = async () => { + setLoading(true); + const logs = await requestLogs(); + setLogs(logs); + setLoading(false); + }; return (