M: Minor UI fixes

This commit is contained in:
Ivan 2025-06-19 17:50:02 +03:00
parent dd8d4fe622
commit 22d8e0fadd
16 changed files with 42 additions and 70 deletions

View File

@ -38,8 +38,8 @@ export function MiniButton({
tabIndex={tabIndex ?? -1} tabIndex={tabIndex ?? -1}
className={cn( className={cn(
'rounded-lg', 'rounded-lg',
'cc-controls cc-animate-background', 'text-muted-foreground cc-animate-color',
'cursor-pointer disabled:cursor-auto', 'cursor-pointer disabled:cursor-auto disabled:opacity-75',
(!tabIndex || tabIndex === -1) && 'outline-hidden', (!tabIndex || tabIndex === -1) && 'outline-hidden',
!noHover && 'cc-hover-pulse', !noHover && 'cc-hover-pulse',
!noPadding && 'px-1 py-1', !noPadding && 'px-1 py-1',

View File

@ -30,9 +30,9 @@ export function SelectorButton({
className={cn( className={cn(
'px-1 flex flex-start items-center gap-1', 'px-1 flex flex-start items-center gap-1',
'text-sm font-controls select-none', 'text-sm font-controls select-none',
'text-btn cc-controls', 'disabled:cursor-auto cursor-pointer outline-hidden',
'disabled:cursor-auto cursor-pointer', 'text-muted-foreground cc-hover-text cc-animate-color disabled:opacity-75',
'cc-hover-text cc-animate-color', !text && 'cc-hover-pulse',
className className
)} )}
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined} data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}

View File

@ -21,9 +21,9 @@ export function PaginationTools<TData>({
paginationOptions paginationOptions
}: PaginationToolsProps<TData>) { }: PaginationToolsProps<TData>) {
const buttonClass = const buttonClass =
'cc-hover-text cc-controls cc-animate-color focus-outline rounded-md not-[:disabled]:cursor-pointer'; 'cc-hover-text cc-animate-color focus-outline rounded-md disabled:opacity-75 not-[:disabled]:cursor-pointer';
return ( return (
<div className='flex justify-end items-center my-2 text-sm cc-controls select-none'> <div className='flex justify-end items-center my-2 text-muted-foreground text-sm select-none'>
<span className='mr-3'> <span className='mr-3'>
{`${table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1} {`${table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1}
- -

View File

@ -36,7 +36,7 @@ export function DropdownButton({
className={cn( className={cn(
'px-3 py-1 inline-flex items-center gap-2', 'px-3 py-1 inline-flex items-center gap-2',
'text-left text-sm text-ellipsis whitespace-nowrap', 'text-left text-sm text-ellipsis whitespace-nowrap',
'disabled:cc-controls disabled:opacity-75', 'disabled:text-muted-foreground disabled:opacity-75',
'focus-outline cc-animate-background', 'focus-outline cc-animate-background',
!!onClick ? 'cc-hover-bg cursor-pointer disabled:cursor-auto' : 'bg-secondary text-secondary-foreground', !!onClick ? 'cc-hover-bg cursor-pointer disabled:cursor-auto' : 'bg-secondary text-secondary-foreground',
className className

View File

@ -1,8 +1,8 @@
import clsx from 'clsx';
import { type Styling, type Titled } from '@/components/props'; import { type Styling, type Titled } from '@/components/props';
import { globalIDs } from '@/utils/constants'; import { globalIDs } from '@/utils/constants';
import { cn } from '../utils';
interface IndicatorProps extends Titled, Styling { interface IndicatorProps extends Titled, Styling {
/** Icon to display. */ /** Icon to display. */
icon: React.ReactNode; icon: React.ReactNode;
@ -17,8 +17,8 @@ interface IndicatorProps extends Titled, Styling {
export function Indicator({ icon, title, titleHtml, hideTitle, noPadding, className, ...restProps }: IndicatorProps) { export function Indicator({ icon, title, titleHtml, hideTitle, noPadding, className, ...restProps }: IndicatorProps) {
return ( return (
<div <div
className={clsx( className={cn(
'cc-controls', // 'text-muted-foreground', //
'outline-hidden', 'outline-hidden',
!noPadding && 'px-1 py-1', !noPadding && 'px-1 py-1',
className className

View File

@ -92,7 +92,7 @@ export function SelectLocation({ value, dense, prefix, onClick, className, style
{item.filesInside ? ( {item.filesInside ? (
<IconFolder size='1rem' className='text-foreground' /> <IconFolder size='1rem' className='text-foreground' />
) : ( ) : (
<IconFolderEmpty size='1rem' className='cc-controls' /> <IconFolderEmpty size='1rem' className='text-foreground-muted' />
)} )}
</div> </div>
)} )}

View File

@ -156,15 +156,8 @@ export function ToolbarSearch({ className, total, filtered }: ToolbarSearchProps
(head ? describeLocationHead(head) : 'Выберите каталог') + '<br/><kbd>Ctrl + клик</kbd> - Проводник' (head ? describeLocationHead(head) : 'Выберите каталог') + '<br/><kbd>Ctrl + клик</kbd> - Проводник'
} }
hideTitle={headMenu.isOpen} hideTitle={headMenu.isOpen}
icon={ icon={head ? <IconLocationHead value={head} size='1.25rem' /> : <IconFolderSearch size='1.25rem' />}
head ? (
<IconLocationHead value={head} size='1.25rem' />
) : (
<IconFolderSearch size='1.25rem' className='cc-controls' />
)
}
onClick={handleFolderClick} onClick={handleFolderClick}
text={head ?? '//'}
/> />
<Dropdown isOpen={headMenu.isOpen} stretchLeft> <Dropdown isOpen={headMenu.isOpen} stretchLeft>
@ -200,7 +193,7 @@ export function ToolbarSearch({ className, total, filtered }: ToolbarSearchProps
placeholder='Путь' placeholder='Путь'
noIcon noIcon
noBorder noBorder
className='w-18 sm:w-20 grow' className='w-18 sm:w-20 grow ml-1'
query={path} query={path}
onChangeQuery={setPath} onChangeQuery={setPath}
/> />

View File

@ -135,7 +135,7 @@ export function OssFlow() {
}); });
} }
} else { } else {
if (node.data.operation?.result) { if (node.data.operation) {
navigateOperationSchema(node.data.operation.id); navigateOperationSchema(node.data.operation.id);
} }
} }

View File

@ -21,7 +21,7 @@ export function WordformButton({ text, example, grams, onSelectGrams, isSelected
'p-1', 'p-1',
'border rounded-none', 'border rounded-none',
'cursor-pointer', 'cursor-pointer',
'cc-controls hover:bg-accent hover:text-foreground cc-animate-color', 'text-muted-foreground hover:bg-accent hover:text-foreground cc-animate-color',
isSelected && 'cc-selected' isSelected && 'cc-selected'
)} )}
{...restProps} {...restProps}

View File

@ -20,8 +20,9 @@ interface MGraphNodeInternal {
export function MGraphNode(node: MGraphNodeInternal) { export function MGraphNode(node: MGraphNodeInternal) {
const tooltipText = const tooltipText =
(node.data.annotations.length === 0 ? '' : `Конституенты: ${node.data.annotations.join(' ')}<br/>`) + `Ступень ${node.data.text}` +
node.data.text; '<br/>' +
(node.data.annotations.length === 0 ? '' : `Конституенты: ${node.data.annotations.join(' ')}`);
return ( return (
<> <>

View File

@ -34,7 +34,7 @@ export function RSLocalButton({
'w-7 sm:w-8 h-5 sm:h-6', 'w-7 sm:w-8 h-5 sm:h-6',
'cursor-pointer disabled:cursor-default', 'cursor-pointer disabled:cursor-default',
'rounded-md', 'rounded-md',
'cc-hover-text cc-controls cc-animate-color', 'cc-hover-text cc-hover-pulse text-muted-foreground cc-animate-color',
'font-math', 'font-math',
className className
)} )}

View File

@ -22,7 +22,7 @@ export function RSTokenButton({ token, disabled, onInsert }: RSTokenButtonProps)
'h-5 sm:h-6', 'h-5 sm:h-6',
'px-1 rounded-md', 'px-1 rounded-md',
'outline-hidden', 'outline-hidden',
'cc-hover-text cc-controls cc-animate-color', 'cc-hover-text cc-hover-pulse text-muted-foreground cc-animate-color',
'font-math', 'font-math',
'cursor-pointer disabled:cursor-default', 'cursor-pointer disabled:cursor-default',
label.length > 3 ? 'w-14.5 md:w-18' : 'w-7.25 md:w-9' label.length > 3 ? 'w-14.5 md:w-18' : 'w-7.25 md:w-9'

View File

@ -41,7 +41,7 @@ export function ConstituentsSearch({ dense }: ConstituentsSearchProps) {
<MiniButton <MiniButton
titleHtml={`Наследованные: <b>${includeInherited ? 'отображать' : 'скрывать'}</b>`} titleHtml={`Наследованные: <b>${includeInherited ? 'отображать' : 'скрывать'}</b>`}
aria-label={`Отображение наследованных: ${includeInherited ? 'отображать' : 'скрывать'}`} aria-label={`Отображение наследованных: ${includeInherited ? 'отображать' : 'скрывать'}`}
icon={<IconChild size='1rem' className={includeInherited ? 'icon-primary' : 'cc-controls'} />} icon={<IconChild size='1rem' className={includeInherited ? 'icon-primary' : undefined} />}
className='h-fit self-center' className='h-fit self-center'
onClick={toggleInherited} onClick={toggleInherited}
/> />

View File

@ -92,6 +92,23 @@
--duration-fade: 300ms; --duration-fade: 300ms;
--duration-move: 500ms; --duration-move: 500ms;
/* Custom animations */
--animate-pulse-scale: pulse-scale 1s infinite;
@keyframes pulse-scale {
0% {
transform: scale(1);
}
70% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
/* ========= shadcn theme ============ */ /* ========= shadcn theme ============ */
/* --radius-sm: calc(var(--radius) - 4px); /* --radius-sm: calc(var(--radius) - 4px);
@ -123,19 +140,4 @@
--color-border: var(--clr-prim-400); --color-border: var(--clr-prim-400);
--color-input: var(--color-card); --color-input: var(--color-card);
--color-ring: var(--color-primary); --color-ring: var(--color-primary);
/* --color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--color-sidebar: var(--color-background);
--color-sidebar-foreground: var(--color-foreground);
--color-sidebar-primary: var(--color-primary);
--color-sidebar-primary-foreground: var(--color-primary-foreground);
--color-sidebar-accent: var(--color-accent);
--color-sidebar-accent-foreground: var(--color-accent-foreground);
--color-sidebar-border: var(--color-border);
--color-sidebar-ring: var(--color-ring); */
} }

View File

@ -33,20 +33,6 @@
} }
} }
@keyframes pulse-scale {
0% {
transform: scale(1);
}
70% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
@utility cc-hover-text { @utility cc-hover-text {
&:hover:not(:disabled) { &:hover:not(:disabled) {
color: var(--color-foreground); color: var(--color-foreground);
@ -80,16 +66,6 @@
} }
} }
@utility cc-controls {
color: var(--color-muted-foreground);
background-color: transparent;
&:disabled {
color: var(--color-muted-foreground);
opacity: 0.75;
}
}
@utility cc-remove { @utility cc-remove {
color: var(--color-muted-foreground); color: var(--color-muted-foreground);

View File

@ -99,9 +99,9 @@ export function toggleTristateFlag(prev: boolean | null): boolean | null {
/** /**
* Toggle tristate color: gray - green - red . * Toggle tristate color: gray - green - red .
*/ */
export function tripleToggleColor(value: boolean | null): string { export function tripleToggleColor(value: boolean | null): string | undefined {
if (value === null) { if (value === null) {
return 'cc-controls'; return undefined;
} }
return value ? 'text-constructive' : 'text-destructive'; return value ? 'text-constructive' : 'text-destructive';
} }