Remove commented out code and unused import in Landing.jsx, refactor CreateThingModal.jsx for improved readability
This commit is contained in:
parent
5e54da8271
commit
883a907350
2 changed files with 46 additions and 57 deletions
|
@ -5,7 +5,6 @@ import { useEffect, useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import FeaturesSection from './FeaturesSection'
|
import FeaturesSection from './FeaturesSection'
|
||||||
import HomeHero from './HomeHero'
|
import HomeHero from './HomeHero'
|
||||||
import PricingSection from './PricingSection'
|
|
||||||
const Landing = () => {
|
const Landing = () => {
|
||||||
const Navigate = useNavigate()
|
const Navigate = useNavigate()
|
||||||
const getCurrentUser = () => {
|
const getCurrentUser = () => {
|
||||||
|
@ -24,7 +23,7 @@ const Landing = () => {
|
||||||
<Container className='flex h-full items-center justify-center'>
|
<Container className='flex h-full items-center justify-center'>
|
||||||
<HomeHero />
|
<HomeHero />
|
||||||
<FeaturesSection />
|
<FeaturesSection />
|
||||||
<PricingSection />
|
{/* <PricingSection /> */}
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {
|
||||||
Button,
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormHelperText,
|
FormHelperText,
|
||||||
FormLabel,
|
|
||||||
Input,
|
Input,
|
||||||
Modal,
|
Modal,
|
||||||
ModalDialog,
|
ModalDialog,
|
||||||
|
@ -67,76 +66,67 @@ function CreateThingModal({ isOpen, onClose, onSave, currentThing }) {
|
||||||
{currentThing?.id ? 'Edit' : 'Create'} Thing
|
{currentThing?.id ? 'Edit' : 'Create'} Thing
|
||||||
</Typography>
|
</Typography>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>
|
<Typography>Name</Typography>
|
||||||
Name
|
<Textarea
|
||||||
<Textarea
|
placeholder='Thing name'
|
||||||
placeholder='Thing name'
|
value={name}
|
||||||
value={name}
|
onChange={e => setName(e.target.value)}
|
||||||
onChange={e => setName(e.target.value)}
|
sx={{ minWidth: 300 }}
|
||||||
sx={{ minWidth: 300 }}
|
/>
|
||||||
/>
|
|
||||||
</FormLabel>
|
|
||||||
<FormHelperText color='danger'>{errors.name}</FormHelperText>
|
<FormHelperText color='danger'>{errors.name}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>
|
<Typography>Type</Typography>
|
||||||
Type
|
<Select value={type} sx={{ minWidth: 300 }}>
|
||||||
<Select value={type} sx={{ minWidth: 300 }}>
|
{['text', 'number', 'boolean'].map(type => (
|
||||||
{['text', 'number', 'boolean'].map(type => (
|
<Option value={type} key={type} onClick={() => setType(type)}>
|
||||||
<Option value={type} key={type} onClick={() => setType(type)}>
|
{type.charAt(0).toUpperCase() + type.slice(1)}
|
||||||
{type.charAt(0).toUpperCase() + type.slice(1)}
|
</Option>
|
||||||
</Option>
|
))}
|
||||||
))}
|
</Select>
|
||||||
</Select>
|
|
||||||
</FormLabel>
|
|
||||||
<FormHelperText color='danger'>{errors.type}</FormHelperText>
|
<FormHelperText color='danger'>{errors.type}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
{type === 'text' && (
|
{type === 'text' && (
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>
|
<Typography>Value</Typography>
|
||||||
Value
|
<Input
|
||||||
<Input
|
placeholder='Thing value'
|
||||||
placeholder='Thing value'
|
value={state || ''}
|
||||||
value={state || ''}
|
onChange={e => setState(e.target.value)}
|
||||||
onChange={e => setState(e.target.value)}
|
sx={{ minWidth: 300 }}
|
||||||
sx={{ minWidth: 300 }}
|
/>
|
||||||
/>
|
|
||||||
</FormLabel>
|
|
||||||
<FormHelperText color='danger'>{errors.state}</FormHelperText>
|
<FormHelperText color='danger'>{errors.state}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
{type === 'number' && (
|
{type === 'number' && (
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>
|
<Typography>Value</Typography>
|
||||||
Value
|
<Input
|
||||||
<Input
|
placeholder='Thing value'
|
||||||
placeholder='Thing value'
|
type='number'
|
||||||
type='number'
|
value={state || ''}
|
||||||
value={state || ''}
|
onChange={e => {
|
||||||
onChange={e => {
|
setState(e.target.value)
|
||||||
setState(e.target.value)
|
}}
|
||||||
}}
|
sx={{ minWidth: 300 }}
|
||||||
sx={{ minWidth: 300 }}
|
/>
|
||||||
/>
|
|
||||||
</FormLabel>
|
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
{type === 'boolean' && (
|
{type === 'boolean' && (
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>
|
<Typography>Value</Typography>
|
||||||
Value
|
<Select sx={{ minWidth: 300 }} value={state}>
|
||||||
<Select sx={{ minWidth: 300 }} value={state}>
|
{['true', 'false'].map(value => (
|
||||||
{['true', 'false'].map(value => (
|
<Option
|
||||||
<Option
|
value={value}
|
||||||
value={value}
|
key={value}
|
||||||
key={value}
|
onClick={() => setState(value)}
|
||||||
onClick={() => setState(value)}
|
>
|
||||||
>
|
{value.charAt(0).toUpperCase() + value.slice(1)}
|
||||||
{value.charAt(0).toUpperCase() + value.slice(1)}
|
</Option>
|
||||||
</Option>
|
))}
|
||||||
))}
|
</Select>
|
||||||
</Select>
|
|
||||||
</FormLabel>
|
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue