From 921351351a3960e4159aab9bd03fa9a6c4849d36 Mon Sep 17 00:00:00 2001 From: lokmeinmatz <matze.kind@web.de> Date: Thu, 15 Jul 2021 15:01:48 +0200 Subject: [PATCH] re-added missing admin views, fixed rebase errors --- src/components/admin/adminHome/AdminHome.tsx | 8 +- .../admin/snacks & co/ImageManager.tsx | 2 +- .../admin/sports/SportartenTable.tsx | 90 ------------------- 3 files changed, 7 insertions(+), 93 deletions(-) diff --git a/src/components/admin/adminHome/AdminHome.tsx b/src/components/admin/adminHome/AdminHome.tsx index e92b166..b39cb08 100644 --- a/src/components/admin/adminHome/AdminHome.tsx +++ b/src/components/admin/adminHome/AdminHome.tsx @@ -107,11 +107,15 @@ const AdminHome: React.FC = () => { <Route path={`${path}/fragen`}> <QuestionView /> </Route> - <Route path={`${path}/synchronisieren`}></Route> + <Route path={`${path}/synchronisieren`}> + <SynchroniseView /> + </Route> <Route path={`${path}/snacks`}> <SnacksView /> </Route> - <Route path={`${path}/reinfolge`}></Route> + <Route path={`${path}/reinfolge`}> + <OrderView /> + </Route> <Route path={`${path}/translation`}> <TranslationView /> </Route> diff --git a/src/components/admin/snacks & co/ImageManager.tsx b/src/components/admin/snacks & co/ImageManager.tsx index ea5af5e..1761cc9 100644 --- a/src/components/admin/snacks & co/ImageManager.tsx +++ b/src/components/admin/snacks & co/ImageManager.tsx @@ -13,7 +13,7 @@ import { ImagesInformationResponse } from '../../../types/ApiTypes' import { createStyles, makeStyles, Theme } from '@material-ui/core' import { Checkbox } from '@material-ui/core' import { useCallback } from 'react' -import { adminFetch } from '../../utils/common' +import { adminFetch } from '../../../utils/common' const useStyles = makeStyles((theme: Theme) => createStyles({ diff --git a/src/components/admin/sports/SportartenTable.tsx b/src/components/admin/sports/SportartenTable.tsx index 1d8e8e8..4d184f3 100644 --- a/src/components/admin/sports/SportartenTable.tsx +++ b/src/components/admin/sports/SportartenTable.tsx @@ -24,96 +24,6 @@ interface SportartenTableProps { updateRef: any } -interface CustomTableRowProps { - index: number - valueRef: React.MutableRefObject<ISports[]> - updateRef: any - sportarten: ISports[] - sportId: string -} - -const CustomTableRow: React.FC<CustomTableRowProps> = ({ - index, - valueRef, - updateRef, - sportarten, - sportId -}) => { - const sport = valueRef.current[index] - - const rowRef = useRef<HTMLTableRowElement>(null) - const [visible, setVisible] = useState(false) - - useEffect(() => { - if (!rowRef.current) return - const iObs = new IntersectionObserver( - (entries) => { - setVisible(entries[0].isIntersecting) - }, - { rootMargin: '200px' } - ) // load rows 200px before screen - - iObs.observe(rowRef.current) - - // disconnect on unmount - return () => { - console.log('disconnect') - iObs.disconnect() - } - }, [rowRef]) - - return ( - <TableRow ref={rowRef}> - <TableCell> {sport.name}</TableCell> - {Object.keys(sport.categoryWeights).map(function (key) { - return ( - <TableCell key={sport.name + '_' + key}> - {visible && ( - <CustomCell - index={index} - categorieId={key} - valueRef={valueRef} - data={sport.categoryWeights[key]} - sportarten={sportarten} - /> - )} - </TableCell> - ) - })} - <TableCell /> - <TableCell> - <a - href={'https://' + sport.url} - target="_blank" - rel="noreferrer" - > - {sport.url} - </a> - </TableCell> - <TableCell> - <IconButton - onClick={() => { - sport.active = !sport.active - updateRef() - }} - > - {sport.active ? <ArrowDownward /> : <ArrowUpward />} - </IconButton> - </TableCell> - <TableCell> - <IconButton - onClick={() => { - valueRef.current.splice(index, 1) - updateRef() - }} - > - <ClearIcon /> - </IconButton> - </TableCell> - </TableRow> - ) -} - export const SportartenTable: React.FC<SportartenTableProps> = ({ sportarten, categories, -- GitLab