From 3e5d39132ad0826fb4aafd46e89ddf84eb58b9aa Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi <256895@studenti.unimore.it> Date: Sun, 25 Apr 2021 17:22:52 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20Sorry!=20I=20couldn't=20make=20a?= =?UTF-8?q?n=20atomic=20commit!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/frontend/src/App.js | 23 ++++-- .../src/components/BoxFullScrollable.js | 2 - code/frontend/src/components/Input.module.css | 2 +- .../src/components/InputWithIcon.module.css | 2 +- code/frontend/src/components/Label.js | 6 +- code/frontend/src/components/LoggedInUser.js | 25 +++++++ .../src/components/LoggedInUser.module.css | 3 + code/frontend/src/components/Logo.js | 2 +- ...orySummary.js => RepositorySummaryBase.js} | 20 +++++- .../frontend/src/components/Select.module.css | 2 +- code/frontend/src/components/Sidebar.js | 24 +++++-- code/frontend/src/contexts/ContextLogin.js | 19 +++++ .../src/hooks/useLocalStorageState.js | 52 ++++++++++++++ code/frontend/src/hooks/useSavedLogin.js | 69 ++++++++++++++++++ code/frontend/src/hooks/useSavedTheme.js | 49 +------------ code/frontend/src/index.css | 4 +- code/frontend/src/routes/PageAlerts.js | 4 +- .../routes/{PageHome.js => PageDashboard.js} | 16 ++--- ...me.module.css => PageDashboard.module.css} | 0 code/frontend/src/routes/PageLogin.js | 71 +++++++++++++++++++ code/frontend/src/routes/PageLogin.module.css | 9 +++ code/frontend/src/routes/PageRepositories.js | 4 +- code/frontend/src/routes/PageRoot.js | 14 ++++ code/frontend/src/routes/PageSettings.js | 35 ++++++--- 24 files changed, 367 insertions(+), 90 deletions(-) create mode 100644 code/frontend/src/components/LoggedInUser.js create mode 100644 code/frontend/src/components/LoggedInUser.module.css rename code/frontend/src/components/{RepositorySummary.js => RepositorySummaryBase.js} (60%) create mode 100644 code/frontend/src/contexts/ContextLogin.js create mode 100644 code/frontend/src/hooks/useLocalStorageState.js create mode 100644 code/frontend/src/hooks/useSavedLogin.js rename code/frontend/src/routes/{PageHome.js => PageDashboard.js} (79%) rename code/frontend/src/routes/{PageHome.module.css => PageDashboard.module.css} (100%) create mode 100644 code/frontend/src/routes/PageLogin.js create mode 100644 code/frontend/src/routes/PageLogin.module.css create mode 100644 code/frontend/src/routes/PageRoot.js diff --git a/code/frontend/src/App.js b/code/frontend/src/App.js index 6bd51ac..97c3789 100644 --- a/code/frontend/src/App.js +++ b/code/frontend/src/App.js @@ -4,12 +4,16 @@ import Layout from "./components/Layout" import ContextTheme from "./contexts/ContextTheme" import { BrowserRouter } from "react-router-dom" import { Route, Switch } from "react-router" -import PageHome from "./routes/PageHome" +import PageDashboard from "./routes/PageDashboard" import PageRepositories from "./routes/PageRepositories" import PageAlerts from "./routes/PageAlerts" import PageSettings from "./routes/PageSettings" import PageSandbox from "./routes/PageSandbox" import useSavedTheme from "./hooks/useSavedTheme" +import PageLogin from "./routes/PageLogin" +import useSavedLogin from "./hooks/useSavedLogin" +import ContextLogin from "./contexts/ContextLogin" +import PageRoot from "./routes/PageRoot" /** @@ -19,15 +23,20 @@ import useSavedTheme from "./hooks/useSavedTheme" * @constructor */ export default function App() { - const [theme, setAndSaveTheme] = useSavedTheme(); + const theme = useSavedTheme(); + const login = useSavedLogin(); return ( - + +
+ + + @@ -40,14 +49,18 @@ export default function App() { - - + + + + +
+
) } diff --git a/code/frontend/src/components/BoxFullScrollable.js b/code/frontend/src/components/BoxFullScrollable.js index 0db871d..bfd714f 100644 --- a/code/frontend/src/components/BoxFullScrollable.js +++ b/code/frontend/src/components/BoxFullScrollable.js @@ -7,8 +7,6 @@ import BoxFull from "./BoxFull" /** * A {@link BoxFull} whose body does not grow automatically but instead supports scrolling. * - * @todo Is there a way to allow the box body to grow automatically...? - * * @param children - The contents of the box body. * @param childrenClassName - Additional class(es) added to the inner `
` acting as the body. * @param props - Additional props to pass to the box. diff --git a/code/frontend/src/components/Input.module.css b/code/frontend/src/components/Input.module.css index 3c3a12d..28bb69d 100644 --- a/code/frontend/src/components/Input.module.css +++ b/code/frontend/src/components/Input.module.css @@ -15,7 +15,7 @@ } .Input:focus { - outline: 0; /* TODO: Questo è sconsigliato dalle linee guida sull'accessibilità! */ + outline: 0; color: var(--fg-field-on); background-color: var(--bg-field-on); diff --git a/code/frontend/src/components/InputWithIcon.module.css b/code/frontend/src/components/InputWithIcon.module.css index 07db25f..0c916ac 100644 --- a/code/frontend/src/components/InputWithIcon.module.css +++ b/code/frontend/src/components/InputWithIcon.module.css @@ -31,7 +31,7 @@ background-color: var(--bg-field-off); border-width: 0; - outline: 0; /* TODO: Questo è sconsigliato dalle linee guida sull'accessibilità! */ + outline: 0; /* Repeat properties overridden by */ font-family: var(--font-regular); diff --git a/code/frontend/src/components/Label.js b/code/frontend/src/components/Label.js index c8dca39..669baa6 100644 --- a/code/frontend/src/components/Label.js +++ b/code/frontend/src/components/Label.js @@ -8,14 +8,14 @@ import Style from "./Label.module.css" * * @param children - The labelled element. * @param text - Text to be displayed in the label. - * @param for_ - The `[id]` of the labelled element. + * @param htmlFor - The `[id]` of the labelled element. * @returns {JSX.Element} * @constructor */ -export default function Label({ children, text, for_ }) { +export default function Label({ children, text, htmlFor }) { return ( -