mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +00:00
ae3dfa2eb7
- The phone's admin sections follow the desktop sidebar: the same groups (Users, Configuration, Maintenance) in its dropdown, Security and Services instead of one Settings section, and live flights and booking mails beside the addons they configure. An old ?tab=settings link still opens Security. - Passkey login and the 2FA rule sit with the other ways in; the passkey card keeps the domain, and a managed install no longer shows the danger zone. - MAdminSelect replaces every native select on the admin screens: TREK's own field or row pill that opens the picker sheet (permissions, backup schedule, invite trip, plugin settings). - Explanations wait behind an info mark (MHintLabel), as on the desktop: admin rows and fields, the settings rows' new `hint`, addon and provider rows. - Permissions are one line each with the level as a pill; addon rows lose the type badge their heading already names; settings buttons no longer wrap. - "Require 2FA" in every language; admin.tabs.settings is unused and gone.
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { Info } from 'lucide-react';
|
|
import { useState, type ReactNode } from 'react';
|
|
|
|
interface MHintLabelProps {
|
|
label: ReactNode;
|
|
/** The explanation. It waits behind the mark until tapped; a screen reader reads it after the label all the same. */
|
|
hint?: ReactNode;
|
|
labelClassName?: string;
|
|
}
|
|
|
|
/**
|
|
* A setting's label with its explanation behind a small mark, the phone's form
|
|
* of the desktop HintMark: the row stays one line, a tap on the mark opens the
|
|
* sentence under the label and a second tap folds it again.
|
|
*/
|
|
export default function MHintLabel({
|
|
label,
|
|
hint,
|
|
labelClassName = 'text-[length:calc(13px*var(--fs-scale-body,1))] font-bold text-m-ink',
|
|
}: MHintLabelProps) {
|
|
const [open, setOpen] = useState(false);
|
|
return (
|
|
<div className="min-w-0">
|
|
{/* The mark rides at the end of the label's last line, also when a long label wraps. */}
|
|
<div className={labelClassName}>
|
|
{label}
|
|
{hint && (
|
|
// Touch only: the sentence below is in the page for a screen reader already.
|
|
<button
|
|
type="button"
|
|
aria-hidden
|
|
tabIndex={-1}
|
|
data-testid="m-hint-mark"
|
|
onClick={() => setOpen((value) => !value)}
|
|
className={`-my-[6px] ms-[2px] inline-flex h-[24px] w-[24px] items-center justify-center rounded-full align-middle ${
|
|
open ? 'text-m-ink' : 'text-m-faint'
|
|
}`}
|
|
>
|
|
<Info size={13} strokeWidth={2.1} />
|
|
</button>
|
|
)}
|
|
</div>
|
|
{hint && (
|
|
<div
|
|
className={
|
|
open
|
|
? 'mt-[3px] font-geist text-[length:calc(10px*var(--fs-scale-caption,1))] leading-relaxed text-m-muted'
|
|
: 'sr-only'
|
|
}
|
|
>
|
|
{hint}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|