Skip to content
Merged
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
59 changes: 8 additions & 51 deletions web/src/pages/ProfileEdit/ExtendedProfileForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { faChevronLeft } from '@fortawesome/free-solid-svg-icons/faChevronLeft';
import { faChevronRight } from '@fortawesome/free-solid-svg-icons/faChevronRight';
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
import { faTrashCan } from '@fortawesome/free-solid-svg-icons/faTrashCan';
import { ProfileMainInformation } from './ProfileMainInformation.jsx';
import { getProfilePhases, removePhaseAt, updatePhaseAt } from './profilePhases.js';

export function ExtendedProfileForm(props) {
Expand Down Expand Up @@ -70,57 +71,13 @@ export function ExtendedProfileForm(props) {
}}
>
<div className='grid grid-cols-1 gap-4 lg:grid-cols-10'>
<Card sm={10} title='Profile Information'>
<div className='form-control'>
<label htmlFor='label' className='mb-2 block text-sm font-medium'>
Title
</label>
<input
id='label'
name='label'
className='input input-bordered w-full'
value={data?.label}
onChange={e => onFieldChange('label', e.target.value)}
aria-label='Enter a name for this profile'
required
/>
</div>
<div className='form-control'>
<label htmlFor='description' className='mb-2 block text-sm font-medium'>
Description
</label>
<input
id='description'
name='description'
className='input input-bordered w-full'
value={data?.description}
onChange={e => onFieldChange('description', e.target.value)}
aria-label='Optional description for this profile'
/>
</div>
<div className='form-control'>
<label htmlFor='temperature' className='mb-2 block text-sm font-medium'>
Temperature
</label>
<div className='input-group'>
<label htmlFor='temperature' className='input w-full'>
<input
id='temperature'
name='temperature'
type='number'
className='grow'
value={data?.temperature}
onChange={e => onFieldChange('temperature', e.target.value)}
aria-label='Temperature in degrees Celsius'
min='0'
max='150'
step='0.1'
/>
<span aria-label='degrees Celsius'>°C</span>
</label>
</div>
</div>
</Card>
<ProfileMainInformation
data={data}
onChangeLabel={e => onFieldChange('label', e.target.value)}
onChangeDescription={e => onFieldChange('description', e.target.value)}
onChangeTemperature={e => onFieldChange('temperature', e.target.value)}
onChangeUtility={e => onFieldChange('utility', !!e.target.checked)}
/>
<Card sm={10}>
<ExtendedProfileChart
data={{ ...data, phases }}
Expand Down
72 changes: 72 additions & 0 deletions web/src/pages/ProfileEdit/ProfileMainInformation.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import Card from '../../components/Card.jsx';

export function ProfileMainInformation(props) {
console.log(props.data);
return (
<Card sm={10} title='Profile Information'>
<div className='form-control'>
<label htmlFor='label' className='mb-2 block text-sm font-medium'>
Title
</label>
<input
id='label'
name='label'
className='input input-bordered w-full'
value={props.data?.label}
onChange={props.onChangeLabel}
aria-label='Enter a name for this profile'
required
/>
</div>
<div className='form-control'>
<label htmlFor='description' className='mb-2 block text-sm font-medium'>
Description
</label>
<textarea
id='description'
name='description'
rows={2}
className='textarea textarea-bordered w-full text-wrap'
value={props.data?.description}
onChange={props.onChangeDescription}
aria-label='Optional description for this profile'
/>
</div>
<div className='form-control'>
<label htmlFor='temperature' className='mb-2 block text-sm font-medium'>
Temperature
</label>
<div className='input-group'>
<label htmlFor='temperature' className='input w-full'>
<input
id='temperature'
name='temperature'
type='number'
className='grow'
value={props.data?.temperature}
onChange={props.onChangeTemperature}
aria-label='Temperature in degrees Celsius'
min='0'
max='150'
step='0.1'
/>
<span aria-label='degrees Celsius'>°C</span>
</label>
</div>
</div>
<div className='form-control'>
<label htmlFor='utility' className='mb-2 block text-sm font-medium' aria-label='Utility profile toggle'>
Utility profile
</label>
<input
id='utility'
name='utility'
type='checkbox'
className='toggle toggle-primary'
checked={!!props.data?.utility}
onChange={props.onChangeUtility}
/>
</div>
</Card>
);
}
59 changes: 8 additions & 51 deletions web/src/pages/ProfileEdit/StandardProfileForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
import { faTrashCan } from '@fortawesome/free-solid-svg-icons/faTrashCan';
import { Tooltip } from '../../components/Tooltip.jsx';
import { ProfileMainInformation } from './ProfileMainInformation.jsx';
import { getProfilePhases, removePhaseAt, updatePhaseAt } from './profilePhases.js';

export function StandardProfileForm(props) {
Expand Down Expand Up @@ -58,57 +59,13 @@ export function StandardProfileForm(props) {
}}
>
<div className='grid grid-cols-1 gap-4 lg:grid-cols-10'>
<Card sm={10} title='Profile Information'>
<div className='form-control'>
<label htmlFor='label' className='mb-2 block text-sm font-medium'>
Title
</label>
<input
id='label'
name='label'
className='input input-bordered w-full'
value={data?.label}
onChange={e => onFieldChange('label', e.target.value)}
aria-label='Enter a name for this profile'
required
/>
</div>
<div className='form-control'>
<label htmlFor='description' className='mb-2 block text-sm font-medium'>
Description
</label>
<input
id='description'
name='description'
className='input input-bordered w-full'
value={data?.description}
onChange={e => onFieldChange('description', e.target.value)}
aria-label='Optional description for this profile'
/>
</div>
<div className='form-control'>
<label htmlFor='temperature' className='mb-2 block text-sm font-medium'>
Temperature
</label>
<div className='input-group'>
<label htmlFor='temperature' className='input w-full'>
<input
id='temperature'
name='temperature'
type='number'
className='grow'
value={data?.temperature}
onChange={e => onFieldChange('temperature', e.target.value)}
aria-label='Temperature in degrees Celsius'
min='0'
max='150'
step='0.1'
/>
<span aria-label='degrees Celsius'>°C</span>
</label>
</div>
</div>
</Card>
<ProfileMainInformation
data={data}
onChangeLabel={e => onFieldChange('label', e.target.value)}
onChangeDescription={e => onFieldChange('description', e.target.value)}
onChangeTemperature={e => onFieldChange('temperature', e.target.value)}
onChangeUtility={e => onFieldChange('utility', !!e.target.checked)}
/>

<Card sm={10} title='Brew Phases'>
<div className='space-y-4' role='group' aria-label='Brew phases configuration'>
Expand Down
Loading