Minor UI fixes

This commit is contained in:
IRBorisov 2024-04-03 19:31:26 +03:00
parent b33dceebf8
commit abd88ccdbf
2 changed files with 13 additions and 13 deletions

View File

@ -2,7 +2,7 @@
import { useCallback, useMemo, useState } from 'react'; import { useCallback, useMemo, useState } from 'react';
import { BiChevronLeft, BiChevronRight, BiFirstPage, BiLastPage, BiX } from 'react-icons/bi'; import { BiChevronLeft, BiChevronRight, BiFirstPage, BiLastPage, BiX } from 'react-icons/bi';
import { LuLocate, LuLocateOff, LuPower, LuPowerOff, LuReplace } from 'react-icons/lu'; import { LuFlag, LuFlagOff, LuPower, LuPowerOff, LuReplace } from 'react-icons/lu';
import ConstituentaBadge from '@/components/info/ConstituentaBadge'; import ConstituentaBadge from '@/components/info/ConstituentaBadge';
import ConstituentaSelector from '@/components/select/ConstituentaSelector'; import ConstituentaSelector from '@/components/select/ConstituentaSelector';
@ -132,14 +132,11 @@ function SubstitutionsPicker({
columnHelper.accessor(item => describeConstituenta(item.rightCst), { columnHelper.accessor(item => describeConstituenta(item.rightCst), {
id: 'right_text', id: 'right_text',
header: 'Описание', header: 'Описание',
size: 1000, minSize: 1000,
cell: props => <div className='text-xs text-ellipsis text-pretty'>{props.getValue()}</div> cell: props => <div className='text-xs text-ellipsis text-pretty'>{props.getValue()}</div>
}), }),
columnHelper.display({ columnHelper.display({
id: 'actions', id: 'actions',
size: 50,
minSize: 50,
maxSize: 50,
cell: props => ( cell: props => (
<MiniButton <MiniButton
noHover noHover
@ -159,7 +156,7 @@ function SubstitutionsPicker({
<div className='flex-grow basis-1/2'> <div className='flex-grow basis-1/2'>
<div className='flex items-center justify-between'> <div className='flex items-center justify-between'>
<Label text={schema1 !== schema2 ? schema1?.alias ?? 'Схема 1' : ''} /> <Label text={schema1 !== schema2 ? schema1?.alias ?? 'Схема 1' : ''} />
<div> <div className='cc-icons'>
<MiniButton <MiniButton
title='Сохранить конституенту' title='Сохранить конституенту'
noHover noHover
@ -178,9 +175,9 @@ function SubstitutionsPicker({
onClick={toggleTerm} onClick={toggleTerm}
icon={ icon={
takeLeftTerm ? ( takeLeftTerm ? (
<LuLocate size='1rem' className='clr-text-green' /> <LuFlag size='1rem' className='clr-text-green' />
) : ( ) : (
<LuLocateOff size='1rem' className='clr-text-red' /> <LuFlagOff size='1rem' className='clr-text-red' />
) )
} }
/> />
@ -198,14 +195,14 @@ function SubstitutionsPicker({
title='Добавить в таблицу отождествлений' title='Добавить в таблицу отождествлений'
className='mb-[0.375rem] grow-0' className='mb-[0.375rem] grow-0'
icon={<LuReplace size='1.5rem' className='icon-primary' />} icon={<LuReplace size='1.5rem' className='icon-primary' />}
disabled={!leftCst || !rightCst} disabled={!leftCst || !rightCst || leftCst === rightCst}
onClick={addSubstitution} onClick={addSubstitution}
/> />
<div className='flex-grow basis-1/2'> <div className='flex-grow basis-1/2'>
<div className='flex items-center justify-between'> <div className='flex items-center justify-between'>
<Label text={schema1 !== schema2 ? schema2?.alias ?? 'Схема 2' : ''} /> <Label text={schema1 !== schema2 ? schema2?.alias ?? 'Схема 2' : ''} />
<div> <div className='cc-icons'>
<MiniButton <MiniButton
title='Сохранить конституенту' title='Сохранить конституенту'
noHover noHover
@ -224,9 +221,9 @@ function SubstitutionsPicker({
onClick={toggleTerm} onClick={toggleTerm}
icon={ icon={
!takeLeftTerm ? ( !takeLeftTerm ? (
<LuLocate size='1rem' className='clr-text-green' /> <LuFlag size='1rem' className='clr-text-green' />
) : ( ) : (
<LuLocateOff size='1rem' className='clr-text-red' /> <LuFlagOff size='1rem' className='clr-text-red' />
) )
} }
/> />

View File

@ -3,11 +3,13 @@
import clsx from 'clsx'; import clsx from 'clsx';
import { useLayoutEffect, useState } from 'react'; import { useLayoutEffect, useState } from 'react';
import BadgeHelp from '@/components/man/BadgeHelp';
import Modal, { ModalProps } from '@/components/ui/Modal'; import Modal, { ModalProps } from '@/components/ui/Modal';
import SelectSingle from '@/components/ui/SelectSingle'; import SelectSingle from '@/components/ui/SelectSingle';
import TextInput from '@/components/ui/TextInput'; import TextInput from '@/components/ui/TextInput';
import { useRSForm } from '@/context/RSFormContext'; import { useRSForm } from '@/context/RSFormContext';
import usePartialUpdate from '@/hooks/usePartialUpdate'; import usePartialUpdate from '@/hooks/usePartialUpdate';
import { HelpTopic } from '@/models/miscellaneous';
import { CstType, ICstRenameData } from '@/models/rsform'; import { CstType, ICstRenameData } from '@/models/rsform';
import { generateAlias, validateNewAlias } from '@/models/rsformAPI'; import { generateAlias, validateNewAlias } from '@/models/rsformAPI';
import { labelCstType } from '@/utils/labels'; import { labelCstType } from '@/utils/labels';
@ -45,7 +47,7 @@ function DlgRenameCst({ hideWindow, initial, onRename }: DlgRenameCstProps) {
hideWindow={hideWindow} hideWindow={hideWindow}
canSubmit={validated} canSubmit={validated}
onSubmit={handleSubmit} onSubmit={handleSubmit}
className={clsx('w-[30rem]', 'py-6 px-6 flex gap-6 justify-center items-center')} className={clsx('w-[30rem]', 'py-6 px-6 flex gap-3 justify-center items-center')}
> >
<SelectSingle <SelectSingle
id='dlg_cst_type' id='dlg_cst_type'
@ -58,6 +60,7 @@ function DlgRenameCst({ hideWindow, initial, onRename }: DlgRenameCstProps) {
}} }}
onChange={data => updateData({ cst_type: data?.value ?? CstType.BASE })} onChange={data => updateData({ cst_type: data?.value ?? CstType.BASE })}
/> />
<BadgeHelp topic={HelpTopic.CST_ATTRIBUTES} offset={16} className='max-w-[40rem] max-h-[calc(100vh-2rem)]' />
<TextInput <TextInput
id='dlg_cst_alias' id='dlg_cst_alias'
dense dense