import React from 'react' import { Box, Button, FormControl, FormControlLabel, MenuItem, Radio, RadioGroup, Select, Slider, Typography, Theme, } from '@material-ui/core' import { makeStyles } from '@material-ui/core/styles' import { CSSProperties } from '@material-ui/core/styles/withStyles' import { ChangeEvent, useState } from 'react' import { formatting } from './formatting' import { styles } from './styles' export interface ModerationPanelArgs { handleClose: () => any theme: Theme } const useStyles = makeStyles({ itemLabel: { gridColumn: '1 / 2', textAlign: 'right', marginTop: '3px', } as CSSProperties, itemContent: { gridColumn: '2 / 5', }, radio: { padding: '0 8px', }, container: { gridTemplateColumns: 'repeat(4, 1fr)', }, slider: { gridColumn: '2 / 5', width: '90%', }, caption: { lineHeight: '1', }, }) const useSharedStyles = makeStyles(styles) export const ModerationPanel = ({ handleClose, theme }: ModerationPanelArgs) => { const [moderationScope, setModerationScope] = useState('global') const handleModerationScopeChange = (e: React.ChangeEvent) => { setModerationScope(e.target.value) } const [moderationAction, setModerationAction] = useState('send-to-review') const handleModerationActionChange = (e: React.ChangeEvent) => { setModerationAction(e.target.value) } const [rankChangePercent, setRankChangePercent] = useState(0) const handleRankChangePercentChange = (_: ChangeEvent, newValue: number | number[]) => { if (typeof newValue === 'number') { setRankChangePercent(newValue) } } const classes = useStyles() const sharedClasses = useSharedStyles(theme) return ( Scope: {moderationScope == 'global' ? 'Apply to results from all queries' : `Apply to results from current query: ${window.location.pathname}`} Action: } label="Send to Review" value="send-to-review" /> } label="Shadowban" value="shadowban" /> } value="change-rank" label={`Change Rank: ${formatting.difference(rankChangePercent)}%`} /> ) }