MVP-ish pin/unpin post
This commit is contained in:
parent
59d0138ca8
commit
46dfd9aab0
|
@ -66,6 +66,7 @@ export const ICONS = {
|
||||||
user: () => import('@iconify-icons/mingcute/user-4-line'),
|
user: () => import('@iconify-icons/mingcute/user-4-line'),
|
||||||
following: () => import('@iconify-icons/mingcute/walk-line'),
|
following: () => import('@iconify-icons/mingcute/walk-line'),
|
||||||
pin: () => import('@iconify-icons/mingcute/pin-line'),
|
pin: () => import('@iconify-icons/mingcute/pin-line'),
|
||||||
|
unpin: [() => import('@iconify-icons/mingcute/pin-line'), '180deg'],
|
||||||
bus: () => import('@iconify-icons/mingcute/bus-2-line'),
|
bus: () => import('@iconify-icons/mingcute/bus-2-line'),
|
||||||
link: () => import('@iconify-icons/mingcute/link-2-line'),
|
link: () => import('@iconify-icons/mingcute/link-2-line'),
|
||||||
history: () => import('@iconify-icons/mingcute/history-line'),
|
history: () => import('@iconify-icons/mingcute/history-line'),
|
||||||
|
|
|
@ -937,6 +937,40 @@ function Status({
|
||||||
)}
|
)}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
|
{isSelf && /(public|unlisted|private)/i.test(visibility) && (
|
||||||
|
<MenuItem
|
||||||
|
onClick={async () => {
|
||||||
|
try {
|
||||||
|
const newStatus = await masto.v1.statuses
|
||||||
|
.$select(id)
|
||||||
|
[_pinned ? 'unpin' : 'pin']();
|
||||||
|
// saveStatus(newStatus, instance);
|
||||||
|
showToast(
|
||||||
|
_pinned
|
||||||
|
? 'Post unpinned from profile'
|
||||||
|
: 'Post pinned to profile',
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
showToast(
|
||||||
|
_pinned ? 'Unable to unpin post' : 'Unable to pin post',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{_pinned ? (
|
||||||
|
<>
|
||||||
|
<Icon icon="unpin" />
|
||||||
|
<span>Unpin from profile</span>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Icon icon="pin" />
|
||||||
|
<span>Pin to profile</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</MenuItem>
|
||||||
|
)}
|
||||||
{isSelf && (
|
{isSelf && (
|
||||||
<div class="menu-horizontal">
|
<div class="menu-horizontal">
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
|
Loading…
Reference in a new issue