From 34dec0d920fde860ac982b1c7b214e5785bddca0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 25 May 2021 04:09:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Cleanup=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nest_frontend/routes/PageLogin.js | 3 +- nest_frontend/routes/PageRepositoriesList.js | 2 +- nest_frontend/routes/PageRepositoryAlerts.js | 7 ++-- .../routes/PageRepositoryAlerts.module.css | 35 ------------------- nest_frontend/routes/PageRepositoryAnalyze.js | 2 +- nest_frontend/routes/PageRepositoryCreate.js | 2 +- nest_frontend/routes/PageRepositoryEdit.js | 8 ++--- nest_frontend/routes/PageSettings.js | 2 +- nest_frontend/routes/PageShare.js | 2 +- nest_frontend/routes/PageUsers.js | 2 +- nest_frontend/utils/renderContents.js | 3 ++ 11 files changed, 15 insertions(+), 53 deletions(-) delete mode 100644 nest_frontend/routes/PageRepositoryAlerts.module.css diff --git a/nest_frontend/routes/PageLogin.js b/nest_frontend/routes/PageLogin.js index e041245..f8786b9 100644 --- a/nest_frontend/routes/PageLogin.js +++ b/nest_frontend/routes/PageLogin.js @@ -11,7 +11,7 @@ import PageWithHeader from "../components/base/layout/PageWithHeader" import BodyFlex from "../components/base/layout/BodyFlex" -export default function PageLogin({ ...props }) { +export default function PageLogin() { const {user} = useContext(ContextUser) const strings = useStrings() @@ -26,7 +26,6 @@ export default function PageLogin({ ...props }) { {strings.welcomeToNest} } - {...props} > diff --git a/nest_frontend/routes/PageRepositoriesList.js b/nest_frontend/routes/PageRepositoriesList.js index 04d68e0..e2ac85a 100644 --- a/nest_frontend/routes/PageRepositoriesList.js +++ b/nest_frontend/routes/PageRepositoriesList.js @@ -11,7 +11,7 @@ import ButtonHeader from "../components/base/ButtonHeader" import BodyHorizontalHalves from "../components/base/layout/BodyHorizontalHalves" -export default function PageRepositoriesList({ children, className, ...props }) { +export default function PageRepositoriesList() { const bv = useBackendViewset("/api/v1/repositories/", "id") const history = useHistory() const { strings } = useContext(ContextLanguage) diff --git a/nest_frontend/routes/PageRepositoryAlerts.js b/nest_frontend/routes/PageRepositoryAlerts.js index e8e2927..114c8cd 100644 --- a/nest_frontend/routes/PageRepositoryAlerts.js +++ b/nest_frontend/routes/PageRepositoryAlerts.js @@ -1,5 +1,4 @@ import React, { useContext } from "react" -import Style from "./PageRepositoryAlerts.module.css" import BoxFull from "../components/base/BoxFull" import ContextLanguage from "../contexts/ContextLanguage" import BoxHeader from "../components/base/BoxHeader" @@ -10,7 +9,7 @@ import ButtonHeader from "../components/base/ButtonHeader" import makeIcon from "../utils/makeIcon" -export default function PageRepositoryAlerts({ children, className, ...props }) { +export default function PageRepositoryAlerts({ ...props }) { const { strings } = useContext(ContextLanguage) const { id } = useParams() const history = useHistory() @@ -18,7 +17,7 @@ export default function PageRepositoryAlerts({ children, className, ...props }) return ( + {makeIcon(faBell)} {strings.alerts} } @@ -32,7 +31,7 @@ export default function PageRepositoryAlerts({ children, className, ...props }) } > - + {strings.notImplemented} diff --git a/nest_frontend/routes/PageRepositoryAlerts.module.css b/nest_frontend/routes/PageRepositoryAlerts.module.css deleted file mode 100644 index a1cd711..0000000 --- a/nest_frontend/routes/PageRepositoryAlerts.module.css +++ /dev/null @@ -1,35 +0,0 @@ -.PageAlerts { - display: grid; - - grid-template-areas: - "a x" - "b b"; - grid-template-columns: 4fr 1fr; - grid-template-rows: auto 1fr; - - grid-gap: 10px; - - width: 100%; - height: 100%; -} - -.Header { - grid-area: a; -} - -.Buttons { - grid-area: x; - - display: flex; - flex-direction: row; - align-items: stretch; -} - -.Buttons > * { - box-shadow: none; - flex-grow: 1; -} - -.YourAlerts { - grid-area: b; -} diff --git a/nest_frontend/routes/PageRepositoryAnalyze.js b/nest_frontend/routes/PageRepositoryAnalyze.js index f71d530..cfa67ed 100644 --- a/nest_frontend/routes/PageRepositoryAnalyze.js +++ b/nest_frontend/routes/PageRepositoryAnalyze.js @@ -3,7 +3,7 @@ import { useParams } from "react-router" import RepositoryViewer from "../components/providers/RepositoryViewer" -export default function PageRepositoryAnalyze({ className, ...props }) { +export default function PageRepositoryAnalyze({...props }) { const { id } = useParams() return ( diff --git a/nest_frontend/routes/PageRepositoryCreate.js b/nest_frontend/routes/PageRepositoryCreate.js index 23b9e91..ea3bf41 100644 --- a/nest_frontend/routes/PageRepositoryCreate.js +++ b/nest_frontend/routes/PageRepositoryCreate.js @@ -7,7 +7,7 @@ import makeIcon from "../utils/makeIcon" import { faPlus } from "@fortawesome/free-solid-svg-icons" -export default function PageRepositoryCreate({ ...props }) { +export default function PageRepositoryCreate() { const { strings } = useContext(ContextLanguage) return ( diff --git a/nest_frontend/routes/PageRepositoryEdit.js b/nest_frontend/routes/PageRepositoryEdit.js index 22444ec..8619f68 100644 --- a/nest_frontend/routes/PageRepositoryEdit.js +++ b/nest_frontend/routes/PageRepositoryEdit.js @@ -11,7 +11,7 @@ import makeIcon from "../utils/makeIcon" import { faPencilAlt } from "@fortawesome/free-solid-svg-icons" -export default function PageRepositoryEdit({ className, ...props }) { +export default function PageRepositoryEdit() { const { strings } = useContext(ContextLanguage) const { id } = useParams() @@ -19,10 +19,7 @@ export default function PageRepositoryEdit({ className, ...props }) { const repositoryRequest = useBackendImmediately(fetchDataAuth, "GET", `/api/v1/repositories/${id}`) const contents = renderContents( repositoryRequest, - data => { - console.debug("Data: ", data) - return - }, + data => ) return ( @@ -32,7 +29,6 @@ export default function PageRepositoryEdit({ className, ...props }) { {makeIcon(faPencilAlt)} {strings.repoEdit} } - {...props} > {contents} diff --git a/nest_frontend/routes/PageSettings.js b/nest_frontend/routes/PageSettings.js index e2ff083..6ee0a4f 100644 --- a/nest_frontend/routes/PageSettings.js +++ b/nest_frontend/routes/PageSettings.js @@ -11,7 +11,7 @@ import makeIcon from "../utils/makeIcon" import BodyFlex from "../components/base/layout/BodyFlex" -export default function PageSettings({ children, className, ...props }) { +export default function PageSettings() { const { strings } = useContext(ContextLanguage) return ( diff --git a/nest_frontend/routes/PageShare.js b/nest_frontend/routes/PageShare.js index a0c2fef..d075052 100644 --- a/nest_frontend/routes/PageShare.js +++ b/nest_frontend/routes/PageShare.js @@ -10,7 +10,7 @@ import BodyHorizontalHalves from "../components/base/layout/BodyHorizontalHalves import AlertError from "../components/interactive/AlertError" -export default function PageShare({ className, ...props }) { +export default function PageShare() { const strings = useStrings() const { user: loggedUser } = useContext(ContextUser) const { id } = useParams() diff --git a/nest_frontend/routes/PageUsers.js b/nest_frontend/routes/PageUsers.js index b6b7d27..c897734 100644 --- a/nest_frontend/routes/PageUsers.js +++ b/nest_frontend/routes/PageUsers.js @@ -11,7 +11,7 @@ import AlertError from "../components/interactive/AlertError" import BodyHorizontalUpperGrow from "../components/base/layout/BodyHorizontalUpperGrow" -export default function PageUsers({ children, className, ...props }) { +export default function PageUsers() { const { strings } = useContext(ContextLanguage) const {createResource, running, resources, destroyResource, error} = useBackendViewset("/api/v1/users/", "email") diff --git a/nest_frontend/utils/renderContents.js b/nest_frontend/utils/renderContents.js index f1ea761..9f8eee5 100644 --- a/nest_frontend/utils/renderContents.js +++ b/nest_frontend/utils/renderContents.js @@ -4,6 +4,9 @@ import Alert from "../components/base/Alert" import Starting from "../components/base/Starting" +/** + * @deprecated + */ export default function renderContents(requestHookResults, renderFunction) { const { data, error, loading } = requestHookResults