Remove commented out code and unused import in Landing.jsx, refactor CreateThingModal.jsx for improved readability

This commit is contained in:
Mo Tarbin 2024-07-01 23:53:01 -04:00
parent 5e54da8271
commit 883a907350
2 changed files with 46 additions and 57 deletions

View file

@ -5,7 +5,6 @@ import { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import FeaturesSection from './FeaturesSection'
import HomeHero from './HomeHero'
import PricingSection from './PricingSection'
const Landing = () => {
const Navigate = useNavigate()
const getCurrentUser = () => {
@ -24,7 +23,7 @@ const Landing = () => {
<Container className='flex h-full items-center justify-center'>
<HomeHero />
<FeaturesSection />
<PricingSection />
{/* <PricingSection /> */}
</Container>
)
}

View file

@ -3,7 +3,6 @@ import {
Button,
FormControl,
FormHelperText,
FormLabel,
Input,
Modal,
ModalDialog,
@ -67,20 +66,17 @@ function CreateThingModal({ isOpen, onClose, onSave, currentThing }) {
{currentThing?.id ? 'Edit' : 'Create'} Thing
</Typography>
<FormControl>
<FormLabel>
Name
<Typography>Name</Typography>
<Textarea
placeholder='Thing name'
value={name}
onChange={e => setName(e.target.value)}
sx={{ minWidth: 300 }}
/>
</FormLabel>
<FormHelperText color='danger'>{errors.name}</FormHelperText>
</FormControl>
<FormControl>
<FormLabel>
Type
<Typography>Type</Typography>
<Select value={type} sx={{ minWidth: 300 }}>
{['text', 'number', 'boolean'].map(type => (
<Option value={type} key={type} onClick={() => setType(type)}>
@ -88,27 +84,24 @@ function CreateThingModal({ isOpen, onClose, onSave, currentThing }) {
</Option>
))}
</Select>
</FormLabel>
<FormHelperText color='danger'>{errors.type}</FormHelperText>
</FormControl>
{type === 'text' && (
<FormControl>
<FormLabel>
Value
<Typography>Value</Typography>
<Input
placeholder='Thing value'
value={state || ''}
onChange={e => setState(e.target.value)}
sx={{ minWidth: 300 }}
/>
</FormLabel>
<FormHelperText color='danger'>{errors.state}</FormHelperText>
</FormControl>
)}
{type === 'number' && (
<FormControl>
<FormLabel>
Value
<Typography>Value</Typography>
<Input
placeholder='Thing value'
type='number'
@ -118,13 +111,11 @@ function CreateThingModal({ isOpen, onClose, onSave, currentThing }) {
}}
sx={{ minWidth: 300 }}
/>
</FormLabel>
</FormControl>
)}
{type === 'boolean' && (
<FormControl>
<FormLabel>
Value
<Typography>Value</Typography>
<Select sx={{ minWidth: 300 }} value={state}>
{['true', 'false'].map(value => (
<Option
@ -136,7 +127,6 @@ function CreateThingModal({ isOpen, onClose, onSave, currentThing }) {
</Option>
))}
</Select>
</FormLabel>
</FormControl>
)}