1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 22:44:19 +00:00

🧹 Cleanup code

This commit is contained in:
Steffo 2021-05-25 04:09:47 +02:00
parent 6c0248cda6
commit 34dec0d920
Signed by: steffo
GPG key ID: 6965406171929D01
11 changed files with 15 additions and 53 deletions

View file

@ -11,7 +11,7 @@ import PageWithHeader from "../components/base/layout/PageWithHeader"
import BodyFlex from "../components/base/layout/BodyFlex" import BodyFlex from "../components/base/layout/BodyFlex"
export default function PageLogin({ ...props }) { export default function PageLogin() {
const {user} = useContext(ContextUser) const {user} = useContext(ContextUser)
const strings = useStrings() const strings = useStrings()
@ -26,7 +26,6 @@ export default function PageLogin({ ...props }) {
{strings.welcomeToNest} {strings.welcomeToNest}
</BoxHeader> </BoxHeader>
} }
{...props}
> >
<BodyFlex> <BodyFlex>
<BoxSetServer/> <BoxSetServer/>

View file

@ -11,7 +11,7 @@ import ButtonHeader from "../components/base/ButtonHeader"
import BodyHorizontalHalves from "../components/base/layout/BodyHorizontalHalves" 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 bv = useBackendViewset("/api/v1/repositories/", "id")
const history = useHistory() const history = useHistory()
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)

View file

@ -1,5 +1,4 @@
import React, { useContext } from "react" import React, { useContext } from "react"
import Style from "./PageRepositoryAlerts.module.css"
import BoxFull from "../components/base/BoxFull" import BoxFull from "../components/base/BoxFull"
import ContextLanguage from "../contexts/ContextLanguage" import ContextLanguage from "../contexts/ContextLanguage"
import BoxHeader from "../components/base/BoxHeader" import BoxHeader from "../components/base/BoxHeader"
@ -10,7 +9,7 @@ import ButtonHeader from "../components/base/ButtonHeader"
import makeIcon from "../utils/makeIcon" import makeIcon from "../utils/makeIcon"
export default function PageRepositoryAlerts({ children, className, ...props }) { export default function PageRepositoryAlerts({ ...props }) {
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)
const { id } = useParams() const { id } = useParams()
const history = useHistory() const history = useHistory()
@ -18,7 +17,7 @@ export default function PageRepositoryAlerts({ children, className, ...props })
return ( return (
<PageWithHeader <PageWithHeader
header={ header={
<BoxHeader className={Style.Header}> <BoxHeader>
{makeIcon(faBell)} {strings.alerts} {makeIcon(faBell)} {strings.alerts}
</BoxHeader> </BoxHeader>
} }
@ -32,7 +31,7 @@ export default function PageRepositoryAlerts({ children, className, ...props })
</ButtonHeader> </ButtonHeader>
} }
> >
<BoxFull header={strings.alertTitle} className={Style.YourAlerts}> <BoxFull header={strings.alertTitle}>
{strings.notImplemented} {strings.notImplemented}
</BoxFull> </BoxFull>
</PageWithHeader> </PageWithHeader>

View file

@ -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;
}

View file

@ -3,7 +3,7 @@ import { useParams } from "react-router"
import RepositoryViewer from "../components/providers/RepositoryViewer" import RepositoryViewer from "../components/providers/RepositoryViewer"
export default function PageRepositoryAnalyze({ className, ...props }) { export default function PageRepositoryAnalyze({...props }) {
const { id } = useParams() const { id } = useParams()
return ( return (

View file

@ -7,7 +7,7 @@ import makeIcon from "../utils/makeIcon"
import { faPlus } from "@fortawesome/free-solid-svg-icons" import { faPlus } from "@fortawesome/free-solid-svg-icons"
export default function PageRepositoryCreate({ ...props }) { export default function PageRepositoryCreate() {
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)
return ( return (

View file

@ -11,7 +11,7 @@ import makeIcon from "../utils/makeIcon"
import { faPencilAlt } from "@fortawesome/free-solid-svg-icons" import { faPencilAlt } from "@fortawesome/free-solid-svg-icons"
export default function PageRepositoryEdit({ className, ...props }) { export default function PageRepositoryEdit() {
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)
const { id } = useParams() const { id } = useParams()
@ -19,10 +19,7 @@ export default function PageRepositoryEdit({ className, ...props }) {
const repositoryRequest = useBackendImmediately(fetchDataAuth, "GET", `/api/v1/repositories/${id}`) const repositoryRequest = useBackendImmediately(fetchDataAuth, "GET", `/api/v1/repositories/${id}`)
const contents = renderContents( const contents = renderContents(
repositoryRequest, repositoryRequest,
data => { data => <RepositoryEditor {...data}/>
console.debug("Data: ", data)
return <RepositoryEditor {...data}/>
},
) )
return ( return (
@ -32,7 +29,6 @@ export default function PageRepositoryEdit({ className, ...props }) {
{makeIcon(faPencilAlt)} {strings.repoEdit} {makeIcon(faPencilAlt)} {strings.repoEdit}
</BoxHeader> </BoxHeader>
} }
{...props}
> >
{contents} {contents}
</PageWithHeader> </PageWithHeader>

View file

@ -11,7 +11,7 @@ import makeIcon from "../utils/makeIcon"
import BodyFlex from "../components/base/layout/BodyFlex" import BodyFlex from "../components/base/layout/BodyFlex"
export default function PageSettings({ children, className, ...props }) { export default function PageSettings() {
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)
return ( return (

View file

@ -10,7 +10,7 @@ import BodyHorizontalHalves from "../components/base/layout/BodyHorizontalHalves
import AlertError from "../components/interactive/AlertError" import AlertError from "../components/interactive/AlertError"
export default function PageShare({ className, ...props }) { export default function PageShare() {
const strings = useStrings() const strings = useStrings()
const { user: loggedUser } = useContext(ContextUser) const { user: loggedUser } = useContext(ContextUser)
const { id } = useParams() const { id } = useParams()

View file

@ -11,7 +11,7 @@ import AlertError from "../components/interactive/AlertError"
import BodyHorizontalUpperGrow from "../components/base/layout/BodyHorizontalUpperGrow" import BodyHorizontalUpperGrow from "../components/base/layout/BodyHorizontalUpperGrow"
export default function PageUsers({ children, className, ...props }) { export default function PageUsers() {
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)
const {createResource, running, resources, destroyResource, error} = useBackendViewset("/api/v1/users/", "email") const {createResource, running, resources, destroyResource, error} = useBackendViewset("/api/v1/users/", "email")

View file

@ -4,6 +4,9 @@ import Alert from "../components/base/Alert"
import Starting from "../components/base/Starting" import Starting from "../components/base/Starting"
/**
* @deprecated
*/
export default function renderContents(requestHookResults, renderFunction) { export default function renderContents(requestHookResults, renderFunction) {
const { data, error, loading } = requestHookResults const { data, error, loading } = requestHookResults