Manual proportions visual fixes (#1449)

Co-authored-by: lucas lelievre <[email protected]>
This commit is contained in:
Polymoriaandlucas lelievre authored and GitHub committed 2025-06-15 11:54:29 +02:00
1 parent 241179a924
commit 4ae5fb7215
1 file changed
+54 -38
@@ -17,16 +17,19 @@ import { Tooltip } from '@/components/commons/Tooltip';
function IncrementButton({
children,
onClick,
bgDark,
}: {
children: ReactNode;
onClick?: MouseEventHandler<HTMLDivElement>;
bgDark: boolean;
}) {
return (
<div
onClick={onClick}
className={classNames(
'p-3 rounded-lg xs:w-10 xs:h-10 flex flex-col justify-center items-center cursor-pointer',
'bg-background-40 hover:bg-opacity-50 active:bg-accent-background-30'
'hover:bg-opacity-50 active:bg-accent-background-30',
{ 'bg-background-60': bgDark, 'bg-background-40': !bgDark }
)}
>
<Typography variant="vr-accessible" bold>
@@ -128,43 +131,51 @@ function ProportionItem({
'duration-300'
)}
>
<Tooltip
content={
<Localized id={`${part.label}-desc`}>
<Typography
variant="standard"
whitespace="whitespace-pre-wrap"
></Typography>
</Localized>
}
preferedDirection="bottom"
mode="corner"
>
<div className="flex flex-grow" onClick={toggleOpen}>
<Typography variant="section-title" bold>
{l10n.getString(part.label)}
</Typography>
</div>
</Tooltip>
<div className="flex flex-grow" onClick={toggleOpen}>
<Typography variant="section-title" bold>
{l10n.getString(part.label)}
</Typography>
<Tooltip
content={
<Localized id={`${part.label}-desc`}>
<Typography
variant="standard"
whitespace="whitespace-pre-wrap"
></Typography>
</Localized>
}
preferedDirection="bottom"
mode="corner"
>
<div className="hover:opacity-100 opacity-65 ml-1 scale-[0.65] border-2 border-solid text-xs w-5 h-5 flex justify-center items-center rounded-full cursor-help">
i
</div>
</Tooltip>
</div>
<div className="flex gap-4 items-center mobile:justify-center mobile:w-full">
<div
className={classNames(
'flex items-center gap-2 my-2 opacity-10',
part.type === 'group-part'
? 'group-hover/child-buttons:opacity-100'
: 'group-hover/buttons:opacity-100'
)}
className={classNames('flex items-center gap-2 my-2 opacity-100')}
>
{!precise && (
<IncrementButton onClick={() => boneIncrement(-5)}>
<IncrementButton
bgDark={part.type !== 'group-part'}
onClick={() => boneIncrement(-5)}
>
{configFormat.format(-5)}
</IncrementButton>
)}
<IncrementButton onClick={() => boneIncrement(-1)}>
<IncrementButton
bgDark={part.type !== 'group-part'}
onClick={() => boneIncrement(-1)}
>
{configFormat.format(-1)}
</IncrementButton>
{precise && (
<IncrementButton onClick={() => boneIncrement(-0.5)}>
<IncrementButton
bgDark={part.type !== 'group-part'}
onClick={() => boneIncrement(-0.5)}
>
{configFormat.format(-0.5)}
</IncrementButton>
)}
@@ -181,23 +192,27 @@ function ProportionItem({
)}
</div>
<div
className={classNames(
'flex items-center gap-2 my-2 opacity-10',
part.type === 'group-part'
? 'group-hover/child-buttons:opacity-100'
: 'group-hover/buttons:opacity-100'
)}
className={classNames('flex items-center gap-2 my-2 opacity-100')}
>
{precise && (
<IncrementButton onClick={() => boneIncrement(+0.5)}>
<IncrementButton
bgDark={part.type !== 'group-part'}
onClick={() => boneIncrement(+0.5)}
>
{configFormat.format(+0.5)}
</IncrementButton>
)}
<IncrementButton onClick={() => boneIncrement(+1)}>
<IncrementButton
bgDark={part.type !== 'group-part'}
onClick={() => boneIncrement(+1)}
>
{configFormat.format(+1)}
</IncrementButton>
{!precise && (
<IncrementButton onClick={() => boneIncrement(+5)}>
<IncrementButton
bgDark={part.type !== 'group-part'}
onClick={() => boneIncrement(+5)}
>
{configFormat.format(+5)}
</IncrementButton>
)}
@@ -208,7 +223,8 @@ function ProportionItem({
<div
className={classNames(
'flex items-center fill-background-20',
part.type === 'bone' && 'opacity-20'
part.type === 'bone' && 'opacity-50 cursor-not-allowed',
part.type !== 'bone' && 'hover:scale-110'
)}
onClick={toggleOpen}
>