From 809d86758cca2f98226d83b3eeca01eceeacd8e6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi <256895@studenti.unimore.it> Date: Tue, 11 May 2021 16:37:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Reformat=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/frontend/src/PageSwitcher.js | 2 +- code/frontend/src/components/base/Button.js | 2 +- .../src/components/base/ButtonSidebar.js | 2 +- .../src/components/base/ButtonSmallX.js | 2 +- .../src/components/base/InputWithIcon.js | 4 +- code/frontend/src/components/base/Loading.js | 2 +- code/frontend/src/components/base/Radio.js | 1 + code/frontend/src/components/base/TextArea.js | 5 +- .../components/base/formparts/FormLabel.js | 2 +- .../interactive/BoxConditionDatetime.js | 8 +-- .../interactive/BoxConditionHashtag.js | 4 +- .../components/interactive/BoxConditionMap.js | 25 ++++---- .../interactive/BoxConditionUser.js | 4 +- .../components/interactive/BoxConditions.js | 2 +- .../src/components/interactive/BoxLoggedIn.js | 8 ++- .../src/components/interactive/BoxLogin.js | 12 ++-- .../interactive/BoxRepositoriesActive.js | 4 +- .../interactive/BoxRepositoriesArchived.js | 4 +- .../interactive/BoxRepositoryCreate.js | 49 ++++++++------- .../components/interactive/BoxSetServer.js | 2 +- .../components/interactive/ConditionBadge.js | 14 +++-- .../components/interactive/CurrentServer.js | 4 +- .../components/interactive/Layout.module.css | 3 +- .../components/interactive/LoggedInUser.js | 2 +- .../src/components/interactive/Logo.js | 6 +- .../interactive/RepositorySummaryBase.js | 60 +++++++++---------- .../RepositorySummaryBase.module.css | 3 +- .../src/components/interactive/SelectTheme.js | 4 +- .../src/components/interactive/Sidebar.js | 6 +- .../src/components/providers/GlobalServer.js | 2 +- .../src/components/providers/GlobalTheme.js | 2 +- .../src/components/providers/GlobalUser.js | 4 +- .../components/providers/RepositoryEditor.js | 54 +++++++++-------- .../providers/RepositoryEditor.module.css | 3 +- .../src/contexts/ContextRepositoryEditor.js | 2 +- code/frontend/src/contexts/ContextServer.js | 2 +- code/frontend/src/contexts/ContextTheme.js | 4 +- code/frontend/src/contexts/ContextUser.js | 2 +- code/frontend/src/hooks/useArrayState.js | 14 ++--- code/frontend/src/hooks/useData.js | 14 +++-- code/frontend/src/hooks/useDataImmediately.js | 10 ++-- .../src/hooks/useLocalStorageState.js | 6 +- .../frontend/src/routes/PageAlerts.module.css | 3 +- .../src/routes/PageDashboard.module.css | 3 +- code/frontend/src/routes/PageEdit.js | 9 +-- code/frontend/src/routes/PageRepositories.js | 6 +- .../src/routes/PageRepositories.module.css | 3 +- code/frontend/src/routes/PageRoot.js | 2 +- .../src/utils/convertToLocalISODate.js | 6 +- code/frontend/src/utils/make_icon.js | 4 +- 50 files changed, 207 insertions(+), 194 deletions(-) diff --git a/code/frontend/src/PageSwitcher.js b/code/frontend/src/PageSwitcher.js index 309da02..bb070b0 100644 --- a/code/frontend/src/PageSwitcher.js +++ b/code/frontend/src/PageSwitcher.js @@ -1,4 +1,4 @@ -import React from "react" +import React from "react" import { Route, Switch } from "react-router" import PageLogin from "./routes/PageLogin" import PageRepositories from "./routes/PageRepositories" diff --git a/code/frontend/src/components/base/Button.js b/code/frontend/src/components/base/Button.js index 1e4079e..1c0dc3f 100644 --- a/code/frontend/src/components/base/Button.js +++ b/code/frontend/src/components/base/Button.js @@ -1,4 +1,4 @@ -import React from "react" +import React from "react" import Style from "./Button.module.css" import classNames from "classnames" import make_icon from "../../utils/make_icon" diff --git a/code/frontend/src/components/base/ButtonSidebar.js b/code/frontend/src/components/base/ButtonSidebar.js index 1f65a37..d0d3ef8 100644 --- a/code/frontend/src/components/base/ButtonSidebar.js +++ b/code/frontend/src/components/base/ButtonSidebar.js @@ -22,7 +22,7 @@ export default function ButtonSidebar({ icon, children, to, className, ...props path: to, strict: true, exact: true, - }); + }) if(match) { className = classNames(Style.Active, className) diff --git a/code/frontend/src/components/base/ButtonSmallX.js b/code/frontend/src/components/base/ButtonSmallX.js index ab55e25..7208596 100644 --- a/code/frontend/src/components/base/ButtonSmallX.js +++ b/code/frontend/src/components/base/ButtonSmallX.js @@ -1,7 +1,7 @@ import React from "react" import Style from "./ButtonSmallX.module.css" import classNames from "classnames" -import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { faTimes } from "@fortawesome/free-solid-svg-icons" diff --git a/code/frontend/src/components/base/InputWithIcon.js b/code/frontend/src/components/base/InputWithIcon.js index da72870..bc84e3b 100644 --- a/code/frontend/src/components/base/InputWithIcon.js +++ b/code/frontend/src/components/base/InputWithIcon.js @@ -1,4 +1,4 @@ -import React, {useState} from "react" +import React, { useState } from "react" import Style from "./InputWithIcon.module.css" import classNames from "classnames" import make_icon from "../../utils/make_icon" @@ -17,7 +17,7 @@ import make_icon from "../../utils/make_icon" * @constructor */ export default function InputWithIcon({ icon, className, ...props }) { - const [isFocused, setFocused] = useState(false); + const [isFocused, setFocused] = useState(false) return (
diff --git a/code/frontend/src/components/base/Loading.js b/code/frontend/src/components/base/Loading.js index 02ad294..6307996 100644 --- a/code/frontend/src/components/base/Loading.js +++ b/code/frontend/src/components/base/Loading.js @@ -1,6 +1,6 @@ import React from "react" import { faSpinner } from "@fortawesome/free-solid-svg-icons" -import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" /** diff --git a/code/frontend/src/components/base/Radio.js b/code/frontend/src/components/base/Radio.js index 3cc3058..e861487 100644 --- a/code/frontend/src/components/base/Radio.js +++ b/code/frontend/src/components/base/Radio.js @@ -2,6 +2,7 @@ import React from "react" import Style from "./Radio.module.css" import classNames from "classnames" + /** * A radio button. * diff --git a/code/frontend/src/components/base/TextArea.js b/code/frontend/src/components/base/TextArea.js index 75508be..1e19601 100644 --- a/code/frontend/src/components/base/TextArea.js +++ b/code/frontend/src/components/base/TextArea.js @@ -15,7 +15,10 @@ import classNames from "classnames" */ export default function TextArea({ resize, children, className, ...props }) { return ( - ) diff --git a/code/frontend/src/components/base/formparts/FormLabel.js b/code/frontend/src/components/base/formparts/FormLabel.js index febdcca..6efd9ca 100644 --- a/code/frontend/src/components/base/formparts/FormLabel.js +++ b/code/frontend/src/components/base/formparts/FormLabel.js @@ -16,7 +16,7 @@ import Style from "./FormLabel.module.css" export default function FormLabel({ children, text, htmlFor }) { return ( -
diff --git a/code/frontend/src/components/interactive/BoxLogin.js b/code/frontend/src/components/interactive/BoxLogin.js index 18e6286..13a6802 100644 --- a/code/frontend/src/components/interactive/BoxLogin.js +++ b/code/frontend/src/components/interactive/BoxLogin.js @@ -22,12 +22,12 @@ export default function BoxLogin({ ...props }) { const [password, setPassword] = useState("password") const [working, setWorking] = useState(false) const [error, setError] = useState(null) - const {login} = useContext(ContextUser) + const { login } = useContext(ContextUser) const history = useHistory() const doLogin = async () => { if(working) { - return; + return } setWorking(true) @@ -67,10 +67,10 @@ export default function BoxLogin({ ...props }) { /> {error ? - - {error.toString()} - - : null} + + {error.toString()} + + : null} 0) { contents = repositories.map(repo => ( 0) { contents = repositories.map(repo => ( - {e.preventDefault(); save()}}> + { + e.preventDefault() + save() + }} + > {error ? - - {error.toString()} - - : null} + + {error.toString()} + + : null} {id ? - - : - + + : + } diff --git a/code/frontend/src/components/interactive/BoxSetServer.js b/code/frontend/src/components/interactive/BoxSetServer.js index ada5c92..70006c3 100644 --- a/code/frontend/src/components/interactive/BoxSetServer.js +++ b/code/frontend/src/components/interactive/BoxSetServer.js @@ -15,7 +15,7 @@ import ContextServer from "../../contexts/ContextServer" * @constructor */ export default function BoxSetServer({ ...props }) { - const {server, setServer} = useContext(ContextServer); + const { server, setServer } = useContext(ContextServer) return ( diff --git a/code/frontend/src/components/interactive/ConditionBadge.js b/code/frontend/src/components/interactive/ConditionBadge.js index 896b705..fd1b3bc 100644 --- a/code/frontend/src/components/interactive/ConditionBadge.js +++ b/code/frontend/src/components/interactive/ConditionBadge.js @@ -1,7 +1,7 @@ import React, { useContext } from "react" import Style from "./ConditionBadge.module.css" import classNames from "classnames" -import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import ButtonSmallX from "../base/ButtonSmallX" import { faAt, faClock, faGlobe, faHashtag, faMapPin } from "@fortawesome/free-solid-svg-icons" import ContextRepositoryEditor from "../../contexts/ContextRepositoryEditor" @@ -36,7 +36,7 @@ export default function ConditionBadge({ ...condition }) { const { id, type, content } = condition const color = CONDITION_COLORS[type] const icon = CONDITION_ICONS[type] - const {removeRawCondition} = useContext(ContextRepositoryEditor) + const { removeRawCondition } = useContext(ContextRepositoryEditor) let displayedContent = content if(type === 3) { @@ -65,10 +65,12 @@ export default function ConditionBadge({ ...condition }) { {displayedContent}
- { - console.debug(`Removing Condition: `, condition) - removeRawCondition(condition) - }}/> + { + console.debug(`Removing Condition: `, condition) + removeRawCondition(condition) + }} + />
) diff --git a/code/frontend/src/components/interactive/CurrentServer.js b/code/frontend/src/components/interactive/CurrentServer.js index 7508657..7c80c2b 100644 --- a/code/frontend/src/components/interactive/CurrentServer.js +++ b/code/frontend/src/components/interactive/CurrentServer.js @@ -1,5 +1,5 @@ import React, { useContext } from "react" -import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { faGlobe } from "@fortawesome/free-solid-svg-icons" import ContextServer from "../../contexts/ContextServer" @@ -12,7 +12,7 @@ import ContextServer from "../../contexts/ContextServer" * @constructor */ export default function CurrentServer({ ...props }) { - const {server} = useContext(ContextServer); + const { server } = useContext(ContextServer) return ( diff --git a/code/frontend/src/components/interactive/Layout.module.css b/code/frontend/src/components/interactive/Layout.module.css index 6a19007..7f15bf0 100644 --- a/code/frontend/src/components/interactive/Layout.module.css +++ b/code/frontend/src/components/interactive/Layout.module.css @@ -8,8 +8,7 @@ display: grid; grid-template-areas: - "a b" - ; + "a b"; grid-template-columns: 250px 1fr; grid-gap: 10px; diff --git a/code/frontend/src/components/interactive/LoggedInUser.js b/code/frontend/src/components/interactive/LoggedInUser.js index 504dddb..cd6ae02 100644 --- a/code/frontend/src/components/interactive/LoggedInUser.js +++ b/code/frontend/src/components/interactive/LoggedInUser.js @@ -12,7 +12,7 @@ import ContextUser from "../../contexts/ContextUser" * @constructor */ export default function LoggedInUser({ ...props }) { - const {user} = useContext(ContextUser); + const { user } = useContext(ContextUser) if(!user) { return ( diff --git a/code/frontend/src/components/interactive/Logo.js b/code/frontend/src/components/interactive/Logo.js index be5e774..cff1d65 100644 --- a/code/frontend/src/components/interactive/Logo.js +++ b/code/frontend/src/components/interactive/Logo.js @@ -1,4 +1,4 @@ -import React, {useContext} from "react" +import React, { useContext } from "react" import Style from "./Logo.module.css" import LogoDark from "../../media/LogoDark.png" import LogoLight from "../../media/LogoLight.png" @@ -19,9 +19,9 @@ import classNames from "classnames" export default function Logo({ className, ...props }) { // I have no idea why IntelliJ is complaining about this line // It's perfectly fine! - const {theme} = useContext(ContextTheme) + const { theme } = useContext(ContextTheme) - let logo; + let logo if(theme === "ThemeDark") { logo = LogoDark } diff --git a/code/frontend/src/components/interactive/RepositorySummaryBase.js b/code/frontend/src/components/interactive/RepositorySummaryBase.js index dbba1f0..1eb66dd 100644 --- a/code/frontend/src/components/interactive/RepositorySummaryBase.js +++ b/code/frontend/src/components/interactive/RepositorySummaryBase.js @@ -1,7 +1,7 @@ import React, { useContext } from "react" import Style from "./RepositorySummaryBase.module.css" import classNames from "classnames" -import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import Button from "../base/Button" import { faArchive, faPencilAlt, faTrash } from "@fortawesome/free-solid-svg-icons" import { useHistory } from "react-router" @@ -29,13 +29,13 @@ import ContextUser from "../../contexts/ContextUser" * @constructor */ export default function RepositorySummaryBase( - { id, refresh, owner, icon, name, start, end, is_active, canDelete, canEdit, canArchive, className, ...props } + { id, refresh, owner, icon, name, start, end, is_active, canDelete, canEdit, canArchive, className, ...props }, ) { - const {fetchDataAuth} = useContext(ContextUser) + const { fetchDataAuth } = useContext(ContextUser) const history = useHistory() - const {fetchNow: archiveThis} = useData(fetchDataAuth, "PATCH", `/api/v1/repositories/${id}`, {"close": true}) - const {fetchNow: unarchiveThis} = useData(fetchDataAuth, "PATCH", `/api/v1/repositories/${id}`, {"open": true}) - const {fetchNow: deletThis} = useData(fetchDataAuth, "DELETE", `/api/v1/repositories/${id}`) + const { fetchNow: archiveThis } = useData(fetchDataAuth, "PATCH", `/api/v1/repositories/${id}`, { "close": true }) + const { fetchNow: unarchiveThis } = useData(fetchDataAuth, "PATCH", `/api/v1/repositories/${id}`, { "open": true }) + const { fetchNow: deletThis } = useData(fetchDataAuth, "DELETE", `/api/v1/repositories/${id}`) const onEditClick = event => { history.push(`/repositories/${id}/edit`) @@ -79,32 +79,32 @@ export default function RepositorySummaryBase(
{canDelete ? - - : null} + + : null} {canEdit ? - - : null} + + : null} {canArchive ? - - : null} + + : null}
) diff --git a/code/frontend/src/components/interactive/RepositorySummaryBase.module.css b/code/frontend/src/components/interactive/RepositorySummaryBase.module.css index 2f21b39..481c0aa 100644 --- a/code/frontend/src/components/interactive/RepositorySummaryBase.module.css +++ b/code/frontend/src/components/interactive/RepositorySummaryBase.module.css @@ -17,8 +17,7 @@ "a b" "a c" "a d" - "a e" - ; + "a e"; grid-template-columns: auto 1fr; grid-template-rows: 5px 1fr 1fr 5px; diff --git a/code/frontend/src/components/interactive/SelectTheme.js b/code/frontend/src/components/interactive/SelectTheme.js index 60a7cc0..647c5ea 100644 --- a/code/frontend/src/components/interactive/SelectTheme.js +++ b/code/frontend/src/components/interactive/SelectTheme.js @@ -1,4 +1,4 @@ -import React, {useContext} from "react" +import React, { useContext } from "react" import Select from "../base/Select" import ContextTheme from "../../contexts/ContextTheme" @@ -12,7 +12,7 @@ import ContextTheme from "../../contexts/ContextTheme" * @constructor */ export default function SelectTheme({ ...props }) { - const {theme, setTheme} = useContext(ContextTheme); + const { theme, setTheme } = useContext(ContextTheme) return (