Skip to content
Snippets Groups Projects
Commit 92135135 authored by lokmeinmatz's avatar lokmeinmatz
Browse files

re-added missing admin views, fixed rebase errors

parent 73f9d9c5
No related branches found
No related tags found
No related merge requests found
...@@ -107,11 +107,15 @@ const AdminHome: React.FC = () => { ...@@ -107,11 +107,15 @@ const AdminHome: React.FC = () => {
<Route path={`${path}/fragen`}> <Route path={`${path}/fragen`}>
<QuestionView /> <QuestionView />
</Route> </Route>
<Route path={`${path}/synchronisieren`}></Route> <Route path={`${path}/synchronisieren`}>
<SynchroniseView />
</Route>
<Route path={`${path}/snacks`}> <Route path={`${path}/snacks`}>
<SnacksView /> <SnacksView />
</Route> </Route>
<Route path={`${path}/reinfolge`}></Route> <Route path={`${path}/reinfolge`}>
<OrderView />
</Route>
<Route path={`${path}/translation`}> <Route path={`${path}/translation`}>
<TranslationView /> <TranslationView />
</Route> </Route>
......
...@@ -13,7 +13,7 @@ import { ImagesInformationResponse } from '../../../types/ApiTypes' ...@@ -13,7 +13,7 @@ import { ImagesInformationResponse } from '../../../types/ApiTypes'
import { createStyles, makeStyles, Theme } from '@material-ui/core' import { createStyles, makeStyles, Theme } from '@material-ui/core'
import { Checkbox } from '@material-ui/core' import { Checkbox } from '@material-ui/core'
import { useCallback } from 'react' import { useCallback } from 'react'
import { adminFetch } from '../../utils/common' import { adminFetch } from '../../../utils/common'
const useStyles = makeStyles((theme: Theme) => const useStyles = makeStyles((theme: Theme) =>
createStyles({ createStyles({
......
...@@ -24,96 +24,6 @@ interface SportartenTableProps { ...@@ -24,96 +24,6 @@ interface SportartenTableProps {
updateRef: any 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> = ({ export const SportartenTable: React.FC<SportartenTableProps> = ({
sportarten, sportarten,
categories, categories,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment