Only show share and embed if public or unlisted

Also slight refactor
This commit is contained in:
Lim Chee Aun 2024-03-04 09:56:38 +08:00
parent 8b36cef510
commit 8cab77415e

View file

@ -711,6 +711,8 @@ function Status({
} }
const actionsRef = useRef(); const actionsRef = useRef();
const isPublic = ['public', 'unlisted'].includes(visibility);
const isPinnable = ['public', 'unlisted', 'private'].includes(visibility);
const StatusMenuItems = ( const StatusMenuItems = (
<> <>
{isSizeLarge && ( {isSizeLarge && (
@ -916,7 +918,8 @@ function Status({
<Icon icon="link" /> <Icon icon="link" />
<span>Copy</span> <span>Copy</span>
</MenuItem> </MenuItem>
{navigator?.share && {isPublic &&
navigator?.share &&
navigator?.canShare?.({ navigator?.canShare?.({
url, url,
}) && ( }) && (
@ -937,7 +940,7 @@ function Status({
</MenuItem> </MenuItem>
)} )}
</div> </div>
{isSizeLarge && ( {isPublic && isSizeLarge && (
<MenuItem <MenuItem
onClick={() => { onClick={() => {
setShowEmbed(true); setShowEmbed(true);
@ -980,7 +983,7 @@ function Status({
)} )}
</MenuItem> </MenuItem>
)} )}
{isSelf && /(public|unlisted|private)/i.test(visibility) && ( {isSelf && isPinnable && (
<MenuItem <MenuItem
onClick={async () => { onClick={async () => {
try { try {