@@ -36,22 +45,45 @@ export default function RepositorySummaryBase(
{name}
-
- {start}
+
+ {owner["username"]}
- {details}
+
+ Start: {start}
+
+
+ End: {end}
+
{canDelete ?
-
+
: null}
{canEdit ?
-
+
: null}
{canArchive ?
-
+
: null}
diff --git a/code/frontend/src/components/interactive/RepositorySummaryBase.module.css b/code/frontend/src/components/interactive/RepositorySummaryBase.module.css
index 7f5a9c0..2f21b39 100644
--- a/code/frontend/src/components/interactive/RepositorySummaryBase.module.css
+++ b/code/frontend/src/components/interactive/RepositorySummaryBase.module.css
@@ -50,7 +50,7 @@
align-self: flex-end;
}
-.StartDate {
+.Author {
grid-area: d;
font-size: small;
@@ -59,10 +59,23 @@
.Middle {
flex-grow: 1;
-
height: 60px;
background-color: var(--bg-light);
+
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ align-items: stretch;
+
+}
+
+.StartDate {
+
+}
+
+.EndDate {
+
}
.Right {
diff --git a/code/frontend/src/hooks/useData.js b/code/frontend/src/hooks/useData.js
index 1ca1b46..304c6fa 100644
--- a/code/frontend/src/hooks/useData.js
+++ b/code/frontend/src/hooks/useData.js
@@ -20,16 +20,19 @@ export default function useData(fetchData, method, path, body, init) {
*/
const load = useCallback(
async () => {
- console.debug(`Trying to ${method} ${path}...`)
-
+ console.debug(`Loading ${method} ${path}...`)
setLoading(true)
+ console.debug(`Fetching ${method} ${path}...`)
try {
const _data = await fetchData(method, path, body, init)
+ console.debug(`Displaying data of ${method} ${path}: `, _data)
setData(_data)
} catch(e) {
+ console.debug(`Displaying error of ${method} ${path}: `, e)
setError(e)
} finally {
+ console.debug(`Stopping loading of ${method} ${path}...`)
setLoading(false)
}
},
diff --git a/code/frontend/src/routes/PageEdit.js b/code/frontend/src/routes/PageEdit.js
new file mode 100644
index 0000000..25d4659
--- /dev/null
+++ b/code/frontend/src/routes/PageEdit.js
@@ -0,0 +1,38 @@
+import React, { useContext } from "react"
+import Style from "./PageDashboard.module.css"
+import classNames from "classnames"
+import BoxHeader from "../components/base/BoxHeader"
+import RepositoryEditor from "../components/providers/RepositoryEditor"
+import useDataImmediately from "../hooks/useDataImmediately"
+import ContextUser from "../contexts/ContextUser"
+import BoxAlert from "../components/base/BoxAlert"
+import RepositorySummaryBase from "../components/interactive/RepositorySummaryBase"
+import { faSearch } from "@fortawesome/free-solid-svg-icons"
+import Loading from "../components/base/Loading"
+import BoxFull from "../components/base/BoxFull"
+
+
+export default function PageEdit({ id, className, ...props }) {
+ const {fetchDataAuth} = useContext(ContextUser)
+ const {data, error} = useDataImmediately(fetchDataAuth, "GET", `/api/v1/repositories/${id}`)
+
+ let contents;
+ if(error) {
+ contents =
{error.toString()}
+ }
+ else if(data) {
+ contents =
+ }
+ else {
+ contents =
+ }
+
+ return (
+
+
+ Edit repository
+
+ {contents}
+
+ )
+}
diff --git a/code/frontend/src/utils/goToOnSuccess.js b/code/frontend/src/utils/goToOnSuccess.js
new file mode 100644
index 0000000..d11eac7
--- /dev/null
+++ b/code/frontend/src/utils/goToOnSuccess.js
@@ -0,0 +1,23 @@
+/**
+ * Decorator which adds a redirect on success to an event handler.
+ *
+ * @param func - The function to decorate.
+ * @param history - The history to push the destination to.
+ * @param destination - The path of the destination.
+ * @returns {(function(): void)|*}
+ */
+export default function goToOnSuccess(func, history, destination) {
+ return ([...args]) => {
+ let success = false
+ try {
+ func(...args)
+ success = true
+ }
+ catch(e) {
+ success = false
+ }
+ if(success) {
+ history.push(destination)
+ }
+ }
+}