ui(admin): uncomment delete buttons

This commit is contained in:
Matthew Penner 2021-06-06 14:08:39 -06:00
parent 01c03b6b77
commit 556885f682
3 changed files with 23 additions and 13 deletions

View file

@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { useRouteMatch } from 'react-router-dom'; import { useRouteMatch } from 'react-router-dom';
import { action, Action, Actions, createContextStore, useStoreActions } from 'easy-peasy'; import { action, Action, Actions, createContextStore, useStoreActions } from 'easy-peasy';
@ -15,6 +16,7 @@ import Field from '@/components/elements/Field';
import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
import { Form, Formik, FormikHelpers } from 'formik'; import { Form, Formik, FormikHelpers } from 'formik';
import updateLocation from '@/api/admin/locations/updateLocation'; import updateLocation from '@/api/admin/locations/updateLocation';
import LocationDeleteButton from '@/components/admin/locations/LocationDeleteButton';
interface ctx { interface ctx {
location: Location | undefined; location: Location | undefined;
@ -35,7 +37,7 @@ interface Values {
} }
const EditInformationContainer = () => { const EditInformationContainer = () => {
// const history = useHistory(); const history = useHistory();
const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes); const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
@ -99,10 +101,10 @@ const EditInformationContainer = () => {
<div css={tw`w-full flex flex-row items-center mt-6`}> <div css={tw`w-full flex flex-row items-center mt-6`}>
<div css={tw`flex`}> <div css={tw`flex`}>
{/* <LocationDeleteButton */} <LocationDeleteButton
{/* locationId={location.id} */} locationId={location.id}
{/* onDeleted={() => history.push('/admin/locations')} */} onDeleted={() => history.push('/admin/locations')}
{/* /> */} />
</div> </div>
<div css={tw`flex ml-auto`}> <div css={tw`flex ml-auto`}>

View file

@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { useRouteMatch } from 'react-router-dom'; import { useRouteMatch } from 'react-router-dom';
import { action, Action, Actions, createContextStore, useStoreActions } from 'easy-peasy'; import { action, Action, Actions, createContextStore, useStoreActions } from 'easy-peasy';
@ -16,6 +17,7 @@ import Field from '@/components/elements/Field';
import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
import { Field as FormikField, Form, Formik, FormikHelpers } from 'formik'; import { Field as FormikField, Form, Formik, FormikHelpers } from 'formik';
import Label from '@/components/elements/Label'; import Label from '@/components/elements/Label';
import MountDeleteButton from '@/components/admin/mounts/MountDeleteButton';
interface ctx { interface ctx {
mount: Mount | undefined; mount: Mount | undefined;
@ -40,6 +42,8 @@ interface Values {
} }
const EditInformationContainer = () => { const EditInformationContainer = () => {
const history = useHistory();
const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes); const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
const mount = Context.useStoreState(state => state.mount); const mount = Context.useStoreState(state => state.mount);
@ -181,10 +185,10 @@ const EditInformationContainer = () => {
<div css={tw`w-full flex flex-row items-center mt-6`}> <div css={tw`w-full flex flex-row items-center mt-6`}>
<div css={tw`flex`}> <div css={tw`flex`}>
{/* <MountDeleteButton */} <MountDeleteButton
{/* mountId={mount.id} */} mountId={mount.id}
{/* onDeleted={() => history.push('/admin/mounts')} */} onDeleted={() => history.push('/admin/mounts')}
{/* /> */} />
</div> </div>
<div css={tw`flex ml-auto`}> <div css={tw`flex ml-auto`}>

View file

@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router';
import { NavLink, useRouteMatch } from 'react-router-dom'; import { NavLink, useRouteMatch } from 'react-router-dom';
import tw from 'twin.macro'; import tw from 'twin.macro';
import AdminContentBlock from '@/components/admin/AdminContentBlock'; import AdminContentBlock from '@/components/admin/AdminContentBlock';
@ -20,6 +21,7 @@ import AdminTable, { ContentWrapper, NoItems, TableBody, TableHead, TableHeader,
import CopyOnClick from '@/components/elements/CopyOnClick'; import CopyOnClick from '@/components/elements/CopyOnClick';
import Input from '@/components/elements/Input'; import Input from '@/components/elements/Input';
import Label from '@/components/elements/Label'; import Label from '@/components/elements/Label';
import NestDeleteButton from '@/components/admin/nests/NestDeleteButton';
interface ctx { interface ctx {
nest: Nest | undefined; nest: Nest | undefined;
@ -60,6 +62,8 @@ interface Values {
} }
const EditInformationContainer = () => { const EditInformationContainer = () => {
const history = useHistory();
const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes); const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
const nest = Context.useStoreState(state => state.nest); const nest = Context.useStoreState(state => state.nest);
@ -122,10 +126,10 @@ const EditInformationContainer = () => {
<div css={tw`w-full flex flex-row items-center mt-6`}> <div css={tw`w-full flex flex-row items-center mt-6`}>
<div css={tw`flex`}> <div css={tw`flex`}>
{/* <NestDeleteButton */} <NestDeleteButton
{/* nestId={nest.id} */} nestId={nest.id}
{/* onDeleted={() => history.push('/admin/nests')} */} onDeleted={() => history.push('/admin/nests')}
{/* /> */} />
</div> </div>
<div css={tw`flex ml-auto`}> <div css={tw`flex ml-auto`}>