mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 18:54:17 +00:00
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:
@@ -194,7 +194,7 @@ export default function AccountTab(): React.ReactElement {
|
||||
<button type="button"
|
||||
onClick={() => avatarInputRef.current?.click()}
|
||||
aria-label={t('settings.uploadAvatar')}
|
||||
className="absolute -bottom-1 -right-1 grid h-7 w-7 place-items-center rounded-full border-2 border-[color:var(--bg-card)] bg-[color:var(--text-primary)] text-[color:var(--bg-card)] shadow-sm transition-transform hover:scale-110"
|
||||
className="absolute -bottom-1 -end-1 grid h-7 w-7 place-items-center rounded-full border-2 border-[color:var(--bg-card)] bg-[color:var(--text-primary)] text-[color:var(--bg-card)] shadow-sm transition-transform hover:scale-110"
|
||||
>
|
||||
<Camera size={13} strokeWidth={2.2} />
|
||||
</button>
|
||||
@@ -204,7 +204,7 @@ export default function AccountTab(): React.ReactElement {
|
||||
<button type="button"
|
||||
onClick={handleAvatarRemove}
|
||||
aria-label={t('settings.removeAvatar')}
|
||||
className="absolute -right-1 -top-1 grid h-6 w-6 place-items-center rounded-full border-2 border-[color:var(--bg-card)] bg-danger text-white shadow-sm transition-transform hover:scale-110" // theme-lint-disable: white glyph on the danger fill, as ConfirmDialog draws it
|
||||
className="absolute -end-1 -top-1 grid h-6 w-6 place-items-center rounded-full border-2 border-[color:var(--bg-card)] bg-danger text-white shadow-sm transition-transform hover:scale-110" // theme-lint-disable: white glyph on the danger fill, as ConfirmDialog draws it
|
||||
>
|
||||
<Trash2 size={11} strokeWidth={2.2} />
|
||||
</button>
|
||||
|
||||
@@ -321,7 +321,7 @@ export default function ApiKeysSection(): React.ReactElement {
|
||||
<div className="flex items-stretch overflow-hidden rounded-[12px] border border-edge-faint bg-surface-secondary">
|
||||
<code className="min-w-0 flex-1 select-all break-all px-3.5 py-3 font-geist text-content" style={fs(12.5, 'body')}>{created}</code>
|
||||
<button type="button" onClick={() => handleCopy(created, 'key')} title={t('settings.apiKeys.copy')}
|
||||
className="flex flex-none items-center gap-1.5 border-l border-edge-faint bg-surface-card px-3.5 font-medium text-content-secondary transition-colors hover:text-content"
|
||||
className="flex flex-none items-center gap-1.5 border-s border-edge-faint bg-surface-card px-3.5 font-medium text-content-secondary transition-colors hover:text-content"
|
||||
style={fs(12.5, 'body')}>
|
||||
{copied === 'key' ? <Check size={14} className="text-success" /> : <Copy size={14} />}
|
||||
{copied === 'key' ? t('common.copied') : t('settings.apiKeys.copy')}
|
||||
@@ -346,7 +346,7 @@ export default function ApiKeysSection(): React.ReactElement {
|
||||
</span>
|
||||
<button type="button"
|
||||
onClick={() => setNewScopes(allSelected ? new Set() : new Set(PUBLIC_API_SCOPES))}
|
||||
className="ml-auto flex-none rounded-full px-2 py-0.5 font-semibold text-content-muted transition-colors hover:bg-surface-tertiary hover:text-content"
|
||||
className="ms-auto flex-none rounded-full px-2 py-0.5 font-semibold text-content-muted transition-colors hover:bg-surface-tertiary hover:text-content"
|
||||
style={fs(11.5, 'body')}>
|
||||
{allSelected ? t('common.deselectAll') : t('common.selectAll')}
|
||||
</button>
|
||||
@@ -439,7 +439,7 @@ function ScopeOption({ icon: Icon, label, checked, onToggle }: {
|
||||
}): React.ReactElement {
|
||||
return (
|
||||
<button type="button" role="checkbox" aria-checked={checked} onClick={onToggle}
|
||||
className={`flex w-full min-w-0 items-center gap-2.5 rounded-[10px] border px-3 py-2.5 text-left transition-colors ${
|
||||
className={`flex w-full min-w-0 items-center gap-2.5 rounded-[10px] border px-3 py-2.5 text-start transition-colors ${
|
||||
checked ? 'border-[color:var(--text-primary)] bg-surface-card shadow-sm' : 'border-edge-faint bg-surface-secondary hover:bg-surface-card'
|
||||
}`}>
|
||||
<span aria-hidden
|
||||
|
||||
@@ -65,7 +65,7 @@ const MOBILE_GROUPS: { id: string; fallback: string; keys: MobileWidgetKey[] }[]
|
||||
]
|
||||
|
||||
/** A tile of the scheme grid: a colour dot and a name, raised and outlined while chosen. */
|
||||
const SWATCH = 'flex min-w-0 items-center gap-2 rounded-[12px] border bg-surface-card px-3 py-2.5 text-left font-medium text-content transition-colors'
|
||||
const SWATCH = 'flex min-w-0 items-center gap-2 rounded-[12px] border bg-surface-card px-3 py-2.5 text-start font-medium text-content transition-colors'
|
||||
const swatchLook = (active: boolean) => active
|
||||
? 'border-[color:var(--text-primary)] shadow-sm'
|
||||
: 'border-edge hover:border-content-faint'
|
||||
@@ -414,7 +414,7 @@ function WidgetGroup({ caption, children }: { caption: string; children: ReactNo
|
||||
/** A colour input with its name, in the box look of the fields. */
|
||||
function ColorField({ label, value, onChange }: { label: string; value: string; onChange: (v: string) => void }) {
|
||||
return (
|
||||
<label className="inline-flex items-center gap-2 rounded-[10px] border border-edge bg-surface-input py-1 pl-3 pr-1 font-medium text-content-secondary" style={fs(12.5, 'body')}>
|
||||
<label className="inline-flex items-center gap-2 rounded-[10px] border border-edge bg-surface-input py-1 ps-3 pe-1 font-medium text-content-secondary" style={fs(12.5, 'body')}>
|
||||
{label}
|
||||
<input type="color" value={value} onChange={(e) => onChange(e.target.value)}
|
||||
className="h-7 w-9 cursor-pointer rounded-[7px] border-0 bg-transparent p-0" />
|
||||
|
||||
@@ -116,7 +116,7 @@ export default function DawarichConnectionSection(): React.ReactElement {
|
||||
type="button"
|
||||
onClick={S.disconnect}
|
||||
disabled={S.saving}
|
||||
className={`${SETTINGS_BUTTON_DANGER} ml-auto`}
|
||||
className={`${SETTINGS_BUTTON_DANGER} ms-auto`}
|
||||
>
|
||||
<Unplug size={14} strokeWidth={2.2} /> {t('dawarich.disconnect')}
|
||||
</button>
|
||||
|
||||
@@ -148,7 +148,7 @@ export default function DisplaySettingsTab(): React.ReactElement {
|
||||
type="button"
|
||||
onClick={() => setLangOpen(v => !v)}
|
||||
aria-expanded={langOpen}
|
||||
className="flex w-full items-center justify-between gap-2 rounded-[10px] border border-edge bg-surface-input px-3 py-2 text-left font-medium text-content"
|
||||
className="flex w-full items-center justify-between gap-2 rounded-[10px] border border-edge bg-surface-input px-3 py-2 text-start font-medium text-content"
|
||||
style={fs(13, 'body')}
|
||||
>
|
||||
<span className="min-w-0 truncate">{currentLanguage?.label}</span>
|
||||
|
||||
@@ -397,7 +397,7 @@ function ConfigBlock({ open, onToggle, json, hint, copied, onCopy, t }: {
|
||||
return (
|
||||
<div className="overflow-hidden rounded-[12px] border border-edge-faint bg-surface-card">
|
||||
<button type="button" onClick={onToggle} aria-expanded={open}
|
||||
className="flex w-full items-center gap-2 px-3.5 py-2.5 text-left hover:bg-surface-secondary">
|
||||
className="flex w-full items-center gap-2 px-3.5 py-2.5 text-start hover:bg-surface-secondary">
|
||||
<ChevronRight size={15} strokeWidth={2.2} className={`flex-none text-content-faint transition-transform ${open ? 'rotate-90' : ''}`} />
|
||||
<span className="flex-1 font-medium text-content" style={fs(13, 'body')}>{t('settings.mcp.clientConfig')}</span>
|
||||
</button>
|
||||
|
||||
@@ -90,7 +90,7 @@ function StyleDropdown({ value, provider, onChange }: { value: string; provider:
|
||||
type="button"
|
||||
onClick={() => setOpen(v => !v)}
|
||||
aria-expanded={open}
|
||||
className="flex w-full items-center justify-between gap-2 rounded-[10px] border border-edge bg-surface-input px-3 py-2 text-left hover:border-content-faint focus:outline-none focus:ring-2 focus:ring-[color:var(--text-primary)]"
|
||||
className="flex w-full items-center justify-between gap-2 rounded-[10px] border border-edge bg-surface-input px-3 py-2 text-start hover:border-content-faint focus:outline-none focus:ring-2 focus:ring-[color:var(--text-primary)]"
|
||||
style={fs(13, 'body')}
|
||||
>
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
@@ -114,7 +114,7 @@ function StyleDropdown({ value, provider, onChange }: { value: string; provider:
|
||||
key={preset.url}
|
||||
type="button"
|
||||
onClick={() => { onChange(preset.url); setOpen(false) }}
|
||||
className={`flex w-full items-center justify-between gap-2 rounded-[9px] px-2.5 py-2 text-left hover:bg-surface-tertiary ${isActive ? 'bg-surface-tertiary' : ''}`}
|
||||
className={`flex w-full items-center justify-between gap-2 rounded-[9px] px-2.5 py-2 text-start hover:bg-surface-tertiary ${isActive ? 'bg-surface-tertiary' : ''}`}
|
||||
style={fs(12.5, 'body')}
|
||||
>
|
||||
<span className="flex min-w-0 flex-wrap items-center gap-1.5">
|
||||
@@ -145,7 +145,7 @@ function ProviderTile({ active, onClick, icon: Icon, name, subtitle, badge }: {
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
aria-pressed={active}
|
||||
className={`flex min-w-0 items-start gap-3 rounded-[12px] border bg-surface-card p-3 text-left transition-colors ${active ? 'border-[color:var(--text-primary)] shadow-sm' : 'border-edge hover:border-content-faint'}`}
|
||||
className={`flex min-w-0 items-start gap-3 rounded-[12px] border bg-surface-card p-3 text-start transition-colors ${active ? 'border-[color:var(--text-primary)] shadow-sm' : 'border-edge hover:border-content-faint'}`}
|
||||
>
|
||||
<span className={`grid h-8 w-8 flex-none place-items-center rounded-[10px] ${active ? 'bg-accent text-accent-text' : 'bg-surface-tertiary text-content-secondary'}`}>
|
||||
<Icon size={15} strokeWidth={2} />
|
||||
|
||||
@@ -241,7 +241,7 @@ export default function NotificationsTab(): React.ReactElement {
|
||||
if (relevantChannels.length === 0) return null
|
||||
return (
|
||||
<div key={eventType} className="grid items-center gap-1 px-3.5 py-3" style={{ gridTemplateColumns: columns }}>
|
||||
<span className="min-w-0 pr-2 font-medium text-content" style={fs(13, 'body')}>
|
||||
<span className="min-w-0 pe-2 font-medium text-content" style={fs(13, 'body')}>
|
||||
{t(EVENT_LABEL_KEYS[eventType]) || eventType}
|
||||
</span>
|
||||
{visibleChannels.map(ch => {
|
||||
|
||||
@@ -26,7 +26,7 @@ function codeTone(code: string): string {
|
||||
return 'bg-warning-soft text-warning'
|
||||
}
|
||||
|
||||
const TH = 'whitespace-nowrap px-3 py-2.5 text-left font-geist font-bold uppercase tracking-[.08em] text-content-faint'
|
||||
const TH = 'whitespace-nowrap px-3 py-2.5 text-start font-geist font-bold uppercase tracking-[.08em] text-content-faint'
|
||||
const TD = 'px-3 py-3 align-middle'
|
||||
|
||||
/**
|
||||
@@ -80,17 +80,17 @@ export default function PluginActivityPanel() {
|
||||
<table className="w-full border-collapse" style={fs(12.5, 'body')}>
|
||||
<thead>
|
||||
<tr className="border-b border-edge-faint bg-surface-secondary" style={fs(10)}>
|
||||
<th className={`${TH} pl-3.5`}>{t('settings.pluginActivity.columns.plugin')}</th>
|
||||
<th className={`${TH} ps-3.5`}>{t('settings.pluginActivity.columns.plugin')}</th>
|
||||
<th className={TH}>{t('settings.pluginActivity.columns.action')}</th>
|
||||
<th className={TH}>{t('settings.pluginActivity.columns.resource')}</th>
|
||||
<th className={TH}>{t('settings.pluginActivity.columns.when')}</th>
|
||||
<th className={`${TH} pr-3.5 text-right`}>{t('settings.pluginActivity.columns.status')}</th>
|
||||
<th className={`${TH} pe-3.5 text-end`}>{t('settings.pluginActivity.columns.status')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-edge-faint">
|
||||
{rows.map((r, i) => (
|
||||
<tr key={i}>
|
||||
<td className={`${TD} max-w-[200px] pl-3.5`}>
|
||||
<td className={`${TD} max-w-[200px] ps-3.5`}>
|
||||
<span className="block truncate font-medium text-content">{r.plugin_name || r.plugin_id}</span>
|
||||
</td>
|
||||
<td className={TD}>
|
||||
@@ -100,7 +100,7 @@ export default function PluginActivityPanel() {
|
||||
<span className="block truncate font-mono text-content-muted" style={fs(11.5)} title={r.resource || undefined}>{r.resource || '—'}</span>
|
||||
</td>
|
||||
<td className={`${TD} whitespace-nowrap font-geist tabular-nums text-content-muted`}>{fmtWhen(r.ts)}</td>
|
||||
<td className={`${TD} pr-3.5 text-right`}>
|
||||
<td className={`${TD} pe-3.5 text-end`}>
|
||||
<span className={`inline-block whitespace-nowrap rounded-full px-2 py-[2px] font-geist font-semibold ${codeTone(r.code)}`} style={fs(11)}>
|
||||
{r.code}
|
||||
</span>
|
||||
|
||||
@@ -255,7 +255,7 @@ function PluginSettingsForm({ id, name, icon }: { id: string; name: string; icon
|
||||
</button>
|
||||
{a.hint && <span className="min-w-0 flex-1 text-content-faint" style={fs(11.5)}>{a.hint}</span>}
|
||||
{res && (
|
||||
<span className={`ml-auto font-medium ${res.ok ? 'text-success' : 'text-danger'}`} style={fs(12, 'body')}>
|
||||
<span className={`ms-auto font-medium ${res.ok ? 'text-success' : 'text-danger'}`} style={fs(12, 'body')}>
|
||||
{res.message || (res.ok ? t('common.success') : t('common.error'))}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -20,7 +20,7 @@ export function SettingsHeader({ icon: Icon, title, subtitle, actions }: {
|
||||
actions?: ReactNode
|
||||
}) {
|
||||
return (
|
||||
<div className="mb-5 flex flex-wrap items-center gap-3 rounded-[18px] bg-surface-tertiary py-3 pl-3 pr-3">
|
||||
<div className="mb-5 flex flex-wrap items-center gap-3 rounded-[18px] bg-surface-tertiary py-3 px-3">
|
||||
<span className="grid h-10 w-10 flex-none place-items-center rounded-[12px] bg-surface-card text-content-secondary shadow-sm">
|
||||
<Icon size={18} strokeWidth={1.9} />
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user