chore(web): add prettier and format

This commit is contained in:
Luke
2022-08-27 15:58:36 +02:00
parent cc76d23419
commit 4a5251b60b
44 changed files with 2933 additions and 1984 deletions

View File

@@ -1,6 +1,6 @@
import { Box, Checkbox } from "@chakra-ui/react";
import { useEffect } from "react";
import { ICheckbox } from "../../../interfaces/dialog";
import { Box, Checkbox } from '@chakra-ui/react';
import { useEffect } from 'react';
import { ICheckbox } from '../../../interfaces/dialog';
interface Props {
row: ICheckbox;
@@ -10,7 +10,7 @@ interface Props {
const CheckboxField: React.FC<Props> = (props) => {
useEffect(() => {
if(props.row.checked) props.handleChange(props.row.checked, props.index);
if (props.row.checked) props.handleChange(props.row.checked, props.index);
}, []);
return (

View File

@@ -1,14 +1,7 @@
import {
Box,
InputGroup,
InputLeftElement,
InputRightElement,
Text,
Input,
} from "@chakra-ui/react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useEffect } from "react";
import { IInput } from "../../../interfaces/dialog";
import { Box, InputGroup, InputLeftElement, InputRightElement, Text, Input } from '@chakra-ui/react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useEffect } from 'react';
import { IInput } from '../../../interfaces/dialog';
interface Props {
row: IInput;
@@ -20,7 +13,7 @@ interface Props {
const InputField: React.FC<Props> = (props) => {
useEffect(() => {
if(props.row.default) props.handleChange(props.row.default, props.index);
if (props.row.default) props.handleChange(props.row.default, props.index);
}, []);
return (
@@ -29,20 +22,13 @@ const InputField: React.FC<Props> = (props) => {
<Text>{props.row.label}</Text>
<InputGroup>
{props.row.icon && (
<InputLeftElement
pointerEvents="none"
children={<FontAwesomeIcon icon={props.row.icon} />}
/>
<InputLeftElement pointerEvents="none" children={<FontAwesomeIcon icon={props.row.icon} />} />
)}
<Input
onChange={(e: React.ChangeEvent<HTMLInputElement>) => props.handleChange(e.target.value, props.index)}
placeholder={props.row.placeholder}
defaultValue={props.row.default}
type={
!props.row.password || props.passwordStates[props.index]
? "text"
: "password"
}
type={!props.row.password || props.passwordStates[props.index] ? 'text' : 'password'}
/>
{props.row.password && (
<InputRightElement
@@ -51,7 +37,7 @@ const InputField: React.FC<Props> = (props) => {
children={
<FontAwesomeIcon
fixedWidth
icon={props.passwordStates[props.index] ? "eye" : "eye-slash"}
icon={props.passwordStates[props.index] ? 'eye' : 'eye-slash'}
fontSize="1em"
style={{ paddingRight: 8 }}
/>

View File

@@ -6,9 +6,9 @@ import {
NumberInputStepper,
NumberIncrementStepper,
NumberDecrementStepper,
} from "@chakra-ui/react";
import { useEffect } from "react";
import { INumber } from "../../../interfaces/dialog";
} from '@chakra-ui/react';
import { useEffect } from 'react';
import { INumber } from '../../../interfaces/dialog';
interface Props {
row: INumber;

View File

@@ -1,6 +1,6 @@
import { Box, Select } from "@chakra-ui/react";
import { useEffect } from "react";
import { ISelect } from "../../../interfaces/dialog";
import { Box, Select } from '@chakra-ui/react';
import { useEffect } from 'react';
import { ISelect } from '../../../interfaces/dialog';
interface Props {
row: ISelect;
@@ -10,9 +10,9 @@ interface Props {
const SelectField: React.FC<Props> = (props) => {
useEffect(() => {
if(props.row.default) {
if (props.row.default) {
props.row.options?.map((option) => {
if(props.row.default === option.value) {
if (props.row.default === option.value) {
props.handleChange(option.value, props.index);
}
});
@@ -24,12 +24,14 @@ const SelectField: React.FC<Props> = (props) => {
<Box mb={3} key={`select-${props.index}`}>
<Select
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => props.handleChange(e.target.value, props.index)}
defaultValue={props.row.default || ""}
defaultValue={props.row.default || ''}
>
{/* Hacky workaround for selectable placeholder issue */}
{!props.row.default && (<option value="" hidden disabled>
{props.row.label}
</option>)}
{!props.row.default && (
<option value="" hidden disabled>
{props.row.label}
</option>
)}
{props.row.options?.map((option, index) => (
<option key={`option-${index}`} value={option.value}>
{option.label || option.value}

View File

@@ -1,6 +1,6 @@
import { Box, Text, Slider, SliderTrack, SliderFilledTrack, SliderThumb, HStack, Tooltip } from "@chakra-ui/react";
import { useEffect, useState } from "react";
import { ISlider } from "../../../interfaces/dialog";
import { Box, Text, Slider, SliderTrack, SliderFilledTrack, SliderThumb, HStack, Tooltip } from '@chakra-ui/react';
import { useEffect, useState } from 'react';
import { ISlider } from '../../../interfaces/dialog';
interface Props {
row: ISlider;
@@ -10,7 +10,7 @@ interface Props {
const SliderField: React.FC<Props> = (props) => {
useEffect(() => {
if(props.row.default) props.handleChange(props.row.default, props.index);
if (props.row.default) props.handleChange(props.row.default, props.index);
}, []);
const [sliderValue, setSliderValue] = useState(props.row.default || props.row.min || 0);
@@ -30,12 +30,7 @@ const SliderField: React.FC<Props> = (props) => {
<SliderTrack>
<SliderFilledTrack />
</SliderTrack>
<Tooltip
hasArrow
label={sliderValue}
placement="bottom"
gutter={10}
>
<Tooltip hasArrow label={sliderValue} placement="bottom" gutter={10}>
<SliderThumb />
</Tooltip>
</Slider>