Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 29 additions & 35 deletions frontend/src/pages/_admin/default/BannerList.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, { useCallback, useState, useEffect } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { useSelector } from 'react-redux'

import { Grid, Box, Typography } from '@mui/material'

import Divider from 'components/generic/Divider'
import { Grid2 as Grid, Box, Typography } from '@mui/material'

import { useTranslation } from 'react-i18next'
import { IconButton } from '@mui/material'
Expand All @@ -12,9 +10,10 @@ import EditIcon from '@mui/icons-material/Edit'

import BannerService from 'services/banner'
import * as AuthSelectors from 'reducers/auth/selectors'
import { useNavigate } from 'react-router-dom'

export default ({ data = [] }) => {
const dispatch = useDispatch()
const navigate = useNavigate()
const { t } = useTranslation()
const idToken = useSelector(AuthSelectors.getIdToken)
const [banner, setBanner] = useState(data)
Expand Down Expand Up @@ -43,36 +42,31 @@ export default ({ data = [] }) => {
</Typography>
<Grid container spacing={3}>
{banner.map(company => (
<div key={company.slug}>
<Box p={2}>
<IconButton
edge="end"
aria-label="delete"
onClick={() => handleRemove(company.slug)}
>
<DeleteIcon />
</IconButton>
<IconButton
edge="end"
aria-label="edit"
onClick={() =>
dispatch(
push(`admin/banner/${company.slug}`),
)
}
>
<EditIcon />
</IconButton>
<span>{company.name}</span>
<span>{company.icon}</span>
{company.buttons.map(i => (
<>
<span>{i.text}</span> <span>{i.push}</span>
</>
))}
</Box>
<Divider variant="middle" />
</div>
<Box p={2} key={company.slug}>
<IconButton
edge="end"
aria-label="delete"
onClick={() => handleRemove(company.slug)}
>
<DeleteIcon />
</IconButton>
<IconButton
edge="end"
aria-label="edit"
onClick={() =>
navigate(`admin/banner/${company.slug}`)
}
>
<EditIcon />
</IconButton>
<span>{company.name}</span>
<span>{company.icon}</span>
{company.buttons.map(i => (
<>
<span>{i.text}</span> <span>{i.push}</span>
</>
))}
</Box>
))}
</Grid>
</Box>
Expand Down
28 changes: 13 additions & 15 deletions frontend/src/pages/_admin/default/EventPriority.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useCallback, useState, useEffect } from 'react'
import { useSelector } from 'react-redux'

import { Grid, Box, Typography } from '@mui/material'
import Divider from 'components/generic/Divider'
import { Grid2 as Grid, Box, Typography, IconButton } from '@mui/material'
import AddCircle from '@mui/icons-material/AddCircle'
import RemoveCircleIcon from '@mui/icons-material/RemoveCircle'

import { useTranslation } from 'react-i18next'

Expand Down Expand Up @@ -37,20 +38,17 @@ export default ({ data = [] }) => {
<Typography variant="h6" gutterBottom>
{t('event_priority_')}
</Typography>
<Grid container spacing={3}>
<Grid container spacing={3} sx={{ p: 2 }}>
{events.map(event => (
<Grid item key={event.slug}>
<Box p={2}>
{event.slug}
<button onClick={() => handleClick(event, 1)}>
+
</button>
{event.frontPagePriority}
<button onClick={() => handleClick(event, -1)}>
-
</button>
</Box>
<Divider variant="middle" />
<Grid key={event.slug}>
{event.slug}
<IconButton onClick={() => handleClick(event, 1)}>
<AddCircle />
</IconButton>
{event.frontPagePriority}
<IconButton onClick={() => handleClick(event, -1)}>
<RemoveCircleIcon />
</IconButton>
</Grid>
))}
</Grid>
Expand Down
7 changes: 2 additions & 5 deletions frontend/src/pages/_admin/default/HackerpackList.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useCallback, useState, useEffect } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { useSelector } from 'react-redux'

import { Grid, Box, Typography } from '@mui/material'
import { Grid2 as Grid, Box, Typography } from '@mui/material'
import CompanySection from 'components/hackerpack/CompanySection'
import Divider from 'components/generic/Divider'

import { useTranslation } from 'react-i18next'
import { IconButton } from '@mui/material'
Expand All @@ -16,7 +15,6 @@ import { useNavigate } from 'react-router-dom'

export default ({ data = [] }) => {
const navigate = useNavigate()
const dispatch = useDispatch()
const { t } = useTranslation()
const idToken = useSelector(AuthSelectors.getIdToken)
const [hackerpack, setHackerpack] = useState(data)
Expand Down Expand Up @@ -72,7 +70,6 @@ export default ({ data = [] }) => {
link={company.link}
/>
</Box>
<Divider variant="middle" />
</>
))}
</Grid>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/_admin/default/NewBannerForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useCallback, useEffect } from 'react'

import { useSelector, useDispatch } from 'react-redux'
import { Grid, Box, Typography } from '@mui/material'
import { Grid2 as Grid, Box, Typography } from '@mui/material'

import TextInput from 'components/inputs/TextInput'
import Button from 'components/generic/Button'
Expand Down Expand Up @@ -71,12 +71,12 @@ export default () => {
Create new frontpage banner
</Typography>
<Grid container spacing={2} direction="row" alignItems="flex-end">
<Grid item xs={12}>
<Grid size={12}>
<Typography variant="caption" color="error">
{error}
</Typography>
</Grid>
<Grid item xs={12} sm={9}>
<Grid size={{ xs: 12, sm: 9 }}>
<TextInput
label="Banner name"
placeholder="Banner name"
Expand All @@ -85,7 +85,7 @@ export default () => {
disabled={loading}
/>
</Grid>
<Grid item xs={12} sm={3}>
<Grid size={{ xs: 12, sm: 3 }}>
<Button
disabled={hasError}
onClick={handleCreate}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/_admin/default/NewHackerpackForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useCallback, useEffect } from 'react'

import { useSelector, useDispatch } from 'react-redux'
import { Grid, Box, Typography } from '@mui/material'
import { Grid2 as Grid, Box, Typography } from '@mui/material'

import TextInput from 'components/inputs/TextInput'
import Button from 'components/generic/Button'
Expand Down Expand Up @@ -70,12 +70,12 @@ export default () => {
{t('Create_new_hackerpack_')}
</Typography>
<Grid container spacing={2} direction="row" alignItems="flex-end">
<Grid item xs={12}>
<Grid size={12}>
<Typography variant="caption" color="error">
{error}
</Typography>
</Grid>
<Grid item xs={12} sm={9}>
<Grid size={{ xs: 12, sm: 9 }}>
<TextInput
label={t('Hackerpack_name_')}
placeholder={t('Enter_hackerpack_name_')}
Expand All @@ -84,7 +84,7 @@ export default () => {
disabled={loading}
/>
</Grid>
<Grid item xs={12} sm={3}>
<Grid size={{ xs: 12, sm: 3 }}>
<Button
disabled={hasError}
onClick={handleCreate}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/_admin/default/NewOrganizationForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useCallback, useEffect } from 'react'

import { useSelector, useDispatch } from 'react-redux'
import { Grid, Box, Typography } from '@mui/material'
import { Grid2 as Grid, Box, Typography } from '@mui/material'

import TextInput from 'components/inputs/TextInput'
import Button from 'components/generic/Button'
Expand Down Expand Up @@ -70,12 +70,12 @@ export default () => {
{t('Create_new_organization_')}
</Typography>
<Grid container spacing={2} direction="row" alignItems="flex-end">
<Grid item xs={12}>
<Grid size={12}>
<Typography variant="caption" color="error">
{error}
</Typography>
</Grid>
<Grid item xs={12} sm={9}>
<Grid size={{ xs: 12, sm: 9 }}>
<TextInput
label={t('Organization_name_')}
placeholder={t('Enter_organization_name_')}
Expand All @@ -84,7 +84,7 @@ export default () => {
disabled={loading}
/>
</Grid>
<Grid item xs={12} sm={3}>
<Grid size={{ xs: 12, sm: 3 }}>
<Button
disabled={hasError}
onClick={handleCreate}
Expand Down
46 changes: 13 additions & 33 deletions frontend/src/pages/_admin/default/OrganizationList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useState, useEffect } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { useSelector } from 'react-redux'

import { Grid, Box, Typography } from '@mui/material'
import { Grid2 as Grid, Box, Typography } from '@mui/material'

import Button from 'components/generic/Button'

Expand All @@ -11,28 +11,15 @@ import GradientBox from 'components/generic/GradientBox'
import { IconButton } from '@mui/material'
import DeleteIcon from '@mui/icons-material/Delete'
import EditIcon from '@mui/icons-material/Edit'
import Divider from 'components/generic/Divider'

import { useTranslation } from 'react-i18next'

import OrganizationService from 'services/organization'
import * as AuthSelectors from 'reducers/auth/selectors'

// const useStyles = makeStyles(theme => ({
// outboundLink: {
// '& a': {
// textDecoration: 'none !important',
// },
// },
// companyLogo: {
// width: '200px',
// height: '50px;',
// },
// }))
import { useNavigate } from 'react-router-dom'

export default ({ data = [] }) => {
const dispatch = useDispatch()
// const classes = useStyles()
const navigate = useNavigate()
const { t } = useTranslation()
const idToken = useSelector(AuthSelectors.getIdToken)
const [organization, setOrganization] = useState(data)
Expand Down Expand Up @@ -65,29 +52,26 @@ export default ({ data = [] }) => {
<Grid container spacing={3}>
{organization.map(org => (
<>
<Grid item xs={12} md={12} xl={12}>
<Grid size={12}>
<GradientBox color="theme_white" p={3}>
<Grid container justifyContent="center">
<Grid item xs={3}>
<Grid size={3}>
<img
alt={org.name}
src={org.icon}
// className={classes.companyLogo}
height={'50px'}
width={'200px'}
/>
</Grid>
<Grid item xs={3}>
<Grid size={3}>
<Typography variant="h5">
{org.name}
</Typography>
</Grid>
<Grid item xs={3}>
<Grid size={3}>
<Typography>{org.about}</Typography>
</Grid>
<Grid
item
xs={3}
// className={classes.outboundLink}
>
<Grid size={3}>
<OutboundLink
eventLabel="myLabel"
to={org.link}
Expand All @@ -105,10 +89,8 @@ export default ({ data = [] }) => {
edge="end"
aria-label="edit"
onClick={() =>
dispatch(
push(
`admin/organization/${org.slug}`,
),
navigate(
`admin/organization/${org.slug}`,
)
}
>
Expand All @@ -127,8 +109,6 @@ export default ({ data = [] }) => {
</Grid>
</GradientBox>
</Grid>

<Divider variant="middle" />
</>
))}
</Grid>
Expand Down
Loading