Show Share initials, a readable link, and a copy confirmation.
Filled avatars used white ink on yellow, the link field was a dimmed disabled input, and Copy failed silently when the clipboard API was denied.
This commit is contained in:
1 parent
3a264ac2df
commit
0fe2624002
11 files changed
+132
-14
No files matched your search
@@ -245,9 +245,25 @@ const ShareContainer = memo<ShareProps>((props) => {
|
||||
|
||||
const handleCopyLink = useCallback(async () => {
|
||||
if (!settings) return;
|
||||
const text = settings.shareUrl;
|
||||
try {
|
||||
await navigator.clipboard.writeText(settings.shareUrl);
|
||||
await navigator.clipboard.writeText(text);
|
||||
setLinkCopied(true);
|
||||
return;
|
||||
} catch {
|
||||
// Some browsers deny clipboard without a secure context; fall back.
|
||||
}
|
||||
try {
|
||||
const field = document.createElement("textarea");
|
||||
field.value = text;
|
||||
field.setAttribute("readonly", "");
|
||||
field.style.position = "fixed";
|
||||
field.style.left = "-9999px";
|
||||
document.body.appendChild(field);
|
||||
field.select();
|
||||
const copied = document.execCommand("copy");
|
||||
field.remove();
|
||||
setLinkCopied(copied);
|
||||
} catch {
|
||||
setLinkCopied(false);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ export const ShareView = memo(function ShareView({
|
||||
buttonType="outline"
|
||||
palette="default"
|
||||
size="small"
|
||||
disabled={inviteBusy || inviteValue.trim().length === 0}
|
||||
disabled={inviteBusy}
|
||||
onClick={onInvite}
|
||||
>
|
||||
{copy.invite}
|
||||
@@ -252,7 +252,7 @@ export const ShareView = memo(function ShareView({
|
||||
showHelpIcon={false}
|
||||
label={copy.anyoneWithLink}
|
||||
value={shareUrlDisplay}
|
||||
disabled
|
||||
readOnly
|
||||
textHint={copy.linkHint}
|
||||
/>
|
||||
<Button
|
||||
@@ -303,7 +303,10 @@ export const ShareView = memo(function ShareView({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{linkCopied ? (
|
||||
</div>
|
||||
|
||||
{linkCopied ? (
|
||||
<div className="shrink-0 px-6 pb-2">
|
||||
<Alert
|
||||
type="toast"
|
||||
status="positive"
|
||||
@@ -314,8 +317,8 @@ export const ShareView = memo(function ShareView({
|
||||
hasTrailingIcon={false}
|
||||
className="w-full"
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="flex shrink-0 items-center justify-between border-t border-solid border-[var(--color-border-default-secondary)] bg-[var(--color-surface-default-primary)] px-6 py-4">
|
||||
<Button
|
||||
|
||||
Reference in new issue
Block a user