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