Files
TREK/client/src/mobile/components/MLinkField.tsx
T
Maurice 6e362de3da fix(mobile): collections start their first list from the dock, settings sheets aligned
Collections: the empty screen's own New list button is gone; the dock's +
starts the first list while there is none and adds places once there is one.

Trip settings: counts sit in a badge next to the section title instead of
reading as part of it (ACCESS 1), and every round button of the sheet,
invite and add guest as well as the member and guest actions, is one 42 px
circle; the icon-only buttons were wider than tall.

Journey settings: the public link is the same field as the trip's share and
invite links, through one shared MLinkField; the shared map's extras hang
under the map row with a guide line and smaller labels; removing the link is
a full-size button.
2026-11-06 16:01:28 +01:00

46 lines
1.6 KiB
TypeScript

import { Check, Copy, Share as ShareIcon } from 'lucide-react';
import { canShareLink, shareLink } from '../../native/shareLink';
/** The round icon buttons next to the link: copy and share, the same size. */
const ACTION = 'flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full bg-m-act text-m-actfg';
/**
* A link to hand on, read-only, with copy and (where the system has a share
* sheet) share next to it: the trip's share and invite links and a journey's
* public link all look the same.
*/
export default function MLinkField({
url,
copied,
onCopy,
copyLabel,
copiedLabel,
shareLabel,
}: {
url: string;
copied: boolean;
onCopy: () => void;
copyLabel: string;
copiedLabel: string;
shareLabel: string;
}) {
return (
<div className="flex items-center gap-2 rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] py-1 pe-1 ps-[14px]">
<input
readOnly
value={url}
aria-label={url}
className="min-w-0 flex-1 border-none bg-transparent font-geist text-[length:calc(11px*var(--fs-scale-caption,1))] text-m-muted outline-none"
/>
<button type="button" aria-label={copied ? copiedLabel : copyLabel} onClick={onCopy} className={ACTION}>
{copied ? <Check size={15} strokeWidth={2.4} /> : <Copy size={15} strokeWidth={2.2} />}
</button>
{canShareLink() && (
<button type="button" aria-label={shareLabel} onClick={() => void shareLink(url)} className={ACTION}>
<ShareIcon size={15} strokeWidth={2.2} />
</button>
)}
</div>
);
}