fix(client): spacing and alignment follow the reading direction

Arabic runs the app right to left, but margins, paddings, insets, text
alignment, borders and corner radii were written for the left side, so
icons sat against the wrong edge of their labels, indents and badges
pointed the wrong way and amount columns aligned left. They now use the
logical forms (ms-, ps-, start-, text-start, marginInlineStart,
insetInlineEnd and their CSS equivalents), which are the very same sides
in a left to right language. Geometry stays physical on purpose: maps,
positions measured from the pointer or a bounding box, time axes,
sliders, transforms and print output.

Amounts drawn as several spans keep their order in a right to left row,
the time picker keeps hours before minutes, and two switches whose thumb
slid out of its track in Arabic now move the right way.

lint:rtl counts what is still physical per file against a baseline that
may only shrink (1512 uses in 370 files before, 319 in 113 now), and CI
runs it, so new code reaches for the logical forms.
This commit is contained in:
Maurice
2026-10-07 22:33:58 +00:00
parent de128cc4ae
commit ba70ad28b8
315 changed files with 1300 additions and 1004 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ export function ContextMenu({ menu, onClose }: ContextMenuProps) {
display: 'flex', alignItems: 'center', gap: 8, width: '100%',
padding: '7px 10px', borderRadius: 7, border: 'none',
background: 'none', cursor: item.disabled ? 'default' : 'pointer', fontFamily: 'inherit',
fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontWeight: 500, textAlign: 'left',
fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontWeight: 500, textAlign: 'start',
color: item.danger ? '#ef4444' : 'var(--text-primary)', opacity: item.disabled ? 0.45 : 1,
transition: 'background 0.1s',
}}
@@ -197,7 +197,7 @@ export default function CustomSelect({
border: '1px solid var(--border-primary)',
background: 'var(--bg-input)', color: 'var(--text-primary)',
fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 500, fontFamily: 'inherit',
cursor: disabled ? 'default' : 'pointer', outline: 'none', textAlign: 'left',
cursor: disabled ? 'default' : 'pointer', outline: 'none', textAlign: 'start',
transition: 'border-color 0.15s', overflow: 'hidden', minWidth: 0,
opacity: disabled ? 0.5 : 1,
}}
@@ -307,7 +307,7 @@ export default function CustomSelect({
padding: '7px 10px', borderRadius: 6,
border: 'none', background: isSelected ? 'var(--bg-hover)' : 'transparent',
color: 'var(--text-primary)', fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontFamily: 'inherit',
cursor: 'pointer', textAlign: 'left', transition: 'background 0.1s',
cursor: 'pointer', textAlign: 'start', transition: 'background 0.1s',
}}
onMouseEnter={e => e.currentTarget.style.background = 'var(--bg-hover)'}
onMouseLeave={e => e.currentTarget.style.background = isSelected ? 'var(--bg-hover)' : 'transparent'}
@@ -142,7 +142,7 @@ export default function CustomTimePicker({ value, onChange, placeholder = '00:00
disabled={disabled}
style={{
flex: 1, border: 'none', outline: 'none', background: 'transparent',
padding: '8px 10px 8px 14px', fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontFamily: 'inherit',
paddingBlock: 8, paddingInlineEnd: 10, paddingInlineStart: 14, fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontFamily: 'inherit',
color: value ? 'var(--text-primary)' : 'var(--text-faint)',
minWidth: 0,
}}
@@ -163,7 +163,8 @@ export default function CustomTimePicker({ value, onChange, placeholder = '00:00
</div>
{open && createPortal(
<div ref={dropRef} style={{
// dir=ltr so hours, minutes and AM/PM read the same way round in an RTL locale.
<div ref={dropRef} dir="ltr" style={{
position: 'fixed',
...(anchored
? anchored.flipped
@@ -225,7 +226,7 @@ export default function CustomTimePicker({ value, onChange, placeholder = '00:00
{/* AM/PM Toggle */}
{is12h && hour !== null && (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2, marginLeft: 4 }}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2, marginInlineStart: 4 }}>
<button type="button" onClick={() => { if (hour < 12) update(hour + 12, minute ?? 0); else update(hour - 12, minute ?? 0) }} style={btnStyle}
onMouseEnter={e => e.currentTarget.style.color = 'var(--text-primary)'}
onMouseLeave={e => e.currentTarget.style.color = 'var(--text-faint)'}>
@@ -249,7 +250,7 @@ export default function CustomTimePicker({ value, onChange, placeholder = '00:00
{/* Clear */}
{value && (
<button type="button" onClick={() => { onChange(''); setOpen(false) }}
style={{ ...btnStyle, marginLeft: 4, fontSize: 'calc(11px * var(--fs-scale-caption, 1))', color: 'var(--text-faint)', padding: '4px 6px' }}
style={{ ...btnStyle, marginInlineStart: 4, fontSize: 'calc(11px * var(--fs-scale-caption, 1))', color: 'var(--text-faint)', padding: '4px 6px' }}
onMouseEnter={e => e.currentTarget.style.color = '#ef4444'}
onMouseLeave={e => e.currentTarget.style.color = 'var(--text-faint)'}>
✕
+2 -2
View File
@@ -228,7 +228,7 @@ export function DialogHeader(p: DialogHeaderProps) {
title = (
<Tooltip label={p.titleTooltip ?? ''}>
<button id={titleId} type="button" onClick={p.onTitleClick}
className="block max-w-full truncate text-left font-bold tracking-[-0.01em] text-content hover:underline hover:decoration-edge" style={titleStyle}>
className="block max-w-full truncate text-start font-bold tracking-[-0.01em] text-content hover:underline hover:decoration-edge" style={titleStyle}>
{p.title}
</button>
</Tooltip>
@@ -272,7 +272,7 @@ export function DialogSection({ label, action, className, children }: { label: R
<section className={className}>
<div className="mb-2 flex items-center gap-2">
<div className={EYEBROW} style={fs(9.5)}>{label}</div>
{action && <span className="ml-auto">{action}</span>}
{action && <span className="ms-auto">{action}</span>}
</div>
{children}
</section>
@@ -121,7 +121,7 @@ export function NavigationMenu({ targets, anchor, onClose, title }: NavigationMe
padding: '8px 10px', borderRadius: 8, border: 'none',
background: 'none', cursor: 'pointer', fontFamily: 'inherit',
fontSize: 'calc(12.5px * var(--fs-scale-body, 1))', fontWeight: 500,
textAlign: 'left', color: 'var(--text-primary)',
textAlign: 'start', color: 'var(--text-primary)',
transition: 'background 0.12s',
}}
onMouseEnter={e => { e.currentTarget.style.background = 'var(--bg-hover)' }}
@@ -127,7 +127,7 @@ export default function PlaceAvatarUpload({ place, category, size = 52, onUpload
onClick={handleRemove}
aria-label={t('places.removeImage')}
style={{
position: 'absolute', top: -3, right: -3, width: 18, height: 18, borderRadius: '50%',
position: 'absolute', top: -3, insetInlineEnd: -3, width: 18, height: 18, borderRadius: '50%',
background: '#ef4444', color: '#fff', border: '2px solid var(--bg-elevated, #fff)',
display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', padding: 0, zIndex: 1,
}}
@@ -187,7 +187,7 @@ function ImageChooser({ anchor, images, onUpload, onPick, onClose }: {
className="trek-popover-enter fixed z-[var(--z-toast)] flex w-[264px] flex-col gap-2 rounded-[14px] border border-edge-secondary bg-surface-card p-2 shadow-popover"
style={{ top: pos.top, left: pos.left }}>
<button type="button" onClick={onUpload}
className="flex items-center gap-2 rounded-[10px] px-2.5 py-2 text-left text-body font-semibold text-content hover:bg-surface-hover">
className="flex items-center gap-2 rounded-[10px] px-2.5 py-2 text-start text-body font-semibold text-content hover:bg-surface-hover">
<Upload size={14} strokeWidth={2.2} className="text-content-muted" />
{t('places.uploadFromDevice')}
</button>
@@ -149,7 +149,7 @@ export default function PublicLanguagePicker({ locale, open, onOpenChange, varia
padding: '7px 12px',
border: 'none',
background: 'none',
textAlign: 'left',
textAlign: 'start',
cursor: 'pointer',
fontSize: 'calc(12px * var(--fs-scale-body, 1))',
fontWeight: lang.value === current ? 600 : 400,
+2 -2
View File
@@ -111,13 +111,13 @@ export default function PlaceRating({ ratings, ratingAvg, onRate, size = 16, com
{/* Who voted — avatar strip. */}
{!compact && ratings.length > 0 && (
<span style={{ display: 'inline-flex', marginLeft: 'auto' }}>
<span style={{ display: 'inline-flex', marginInlineStart: 'auto' }}>
{ratings.slice(0, 6).map((r, i) => (
<span key={r.user_id} className="bg-surface-tertiary text-content-muted" style={{
width: 18, height: 18, borderRadius: '50%', overflow: 'hidden', flexShrink: 0,
display: 'flex', alignItems: 'center', justifyContent: 'center',
fontSize: 'calc(8px * var(--fs-scale-caption, 1))', fontWeight: 700,
marginLeft: i ? -5 : 0, border: '1.5px solid var(--bg-elevated, #fff)',
marginInlineStart: i ? -5 : 0, border: '1.5px solid var(--bg-elevated, #fff)',
}}>
{r.avatar ? <img src={avatarSrc(r.avatar)!} alt={r.username || ''} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> : r.username?.[0]?.toUpperCase()}
</span>
+1 -1
View File
@@ -191,7 +191,7 @@ export function PillSelect<T extends string>({ value, options, onChange, label,
{shown?.icon}
<span>{shown?.label}</span>
{shown?.hint && <span className="font-medium text-content-muted">{shown.hint}</span>}
<ChevronDown size={12} strokeWidth={2.2} className={`-mr-0.5 flex-none text-content-faint transition-transform ${open ? 'rotate-180' : ''}`} />
<ChevronDown size={12} strokeWidth={2.2} className={`-me-0.5 flex-none text-content-faint transition-transform ${open ? 'rotate-180' : ''}`} />
</button>
{open && box && createPortal(
<div ref={menuRef} id={listId} role="group" aria-label={label} onKeyDown={onListKey}