mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-09 09:05:17 -05:00
`options` slice was huge and managed a mix of generation parameters and general app settings. It has been split up: - Generation parameters are now in `generationSlice`. - Postprocessing parameters are now in `postprocessingSlice` - UI related things are now in `uiSlice` There is probably more to be done, like `gallerySlice` perhaps should only manage internal gallery state, and not if the gallery is displayed. Full-slice selectors have been made for each slice. Other organisational tweaks.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { ChangeEvent } from 'react';
|
|
import React from 'react';
|
|
import { HEIGHTS } from 'app/constants';
|
|
import { RootState } from 'app/store';
|
|
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
|
|
import IAISelect from 'common/components/IAISelect';
|
|
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
|
|
import { setHeight } from 'features/parameters/store/generationSlice';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export default function MainHeight() {
|
|
const height = useAppSelector((state: RootState) => state.generation.height);
|
|
const activeTabName = useAppSelector(activeTabNameSelector);
|
|
const dispatch = useAppDispatch();
|
|
const { t } = useTranslation();
|
|
|
|
const handleChangeHeight = (e: ChangeEvent<HTMLSelectElement>) =>
|
|
dispatch(setHeight(Number(e.target.value)));
|
|
|
|
return (
|
|
<IAISelect
|
|
isDisabled={activeTabName === 'unifiedCanvas'}
|
|
label={t('parameters:height')}
|
|
value={height}
|
|
flexGrow={1}
|
|
onChange={handleChangeHeight}
|
|
validValues={HEIGHTS}
|
|
styleClass="main-settings-block"
|
|
/>
|
|
);
|
|
}
|