diff --git a/src/management/edition/form.tsx b/src/management/edition/form.tsx index e3fdb7b..8996d2e 100644 --- a/src/management/edition/form.tsx +++ b/src/management/edition/form.tsx @@ -27,7 +27,7 @@ import { Autocomplete } from "@material-ui/lab"; import { useAsync } from "@/hooks"; import api from "@/management/api"; import { Async } from "@/components/async"; -import { AccountCheck, ShieldCheck, TrashCan } from "mdi-material-ui"; +import { AccountCheck, ArrowDown, ArrowUp, ShieldCheck, TrashCan } from "mdi-material-ui"; import { Actions } from "@/components"; import { Add } from "@material-ui/icons"; @@ -53,9 +53,8 @@ function toggleValueInArray(array: T[], value: T, compar : array.filter(other => !comparator(other, value)); } -export const ProgramField = ({ remove, push, form, name, ...props }: FieldArrayRenderProps) => { +export const ProgramField = ({ remove, swap, push, form, name, ...props }: FieldArrayRenderProps) => { const value = getIn(form.values, name) as InternshipProgramEntry[]; - const setValue = (value: InternshipProgramEntry[]) => form.setFieldValue(name, value, false); const { t } = useTranslation("management"); @@ -64,13 +63,17 @@ export const ProgramField = ({ remove, push, form, name, ...props }: FieldArrayR - remove(index) }> - - + { index < value.length - 1 && swap(index, index + 1) }> } + { index > 0 && swap(index, index - 1) }> } + remove(index) }> } /> - { JSON.stringify(entry) } + ) } diff --git a/src/management/edition/settings.tsx b/src/management/edition/settings.tsx index bb7dc1f..353eec4 100644 --- a/src/management/edition/settings.tsx +++ b/src/management/edition/settings.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from "react"; import { Page } from "@/pages/base"; import { Management } from "@/management/main"; -import { Container, Dialog, Typography } from "@material-ui/core"; +import { Container, Divider, Typography, Button } from "@material-ui/core"; import { Async } from "@/components/async"; import { useTranslation } from "react-i18next"; import { useRouteMatch } from "react-router-dom"; @@ -11,13 +11,16 @@ import api from "@/management/api"; import { Form, Formik } from "formik"; import { useSpacing } from "@/styles"; import { EditionForm } from "@/management/edition/form"; +import { Actions } from "@/components"; +import { Save } from "@material-ui/icons"; +import { Cancel } from "mdi-material-ui"; const title = "edition.settings.title"; export function EditionSettings() { const { t } = useTranslation("management"); const { params } = useRouteMatch(); - const spacing = useSpacing(); + const spacing = useSpacing(2); const edition = useAsync(useCallback(() => api.edition.details(params.edition), [params.edition])) @@ -36,6 +39,11 @@ export function EditionSettings() {
+ + + + +
}