mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-29 20:58:57 +03:00
Show post preview inside Boosted/Liked by modal
And show the menu in more places
This commit is contained in:
parent
6816a4b64a
commit
9c8aff6d32
4 changed files with 53 additions and 19 deletions
|
@ -1,4 +1,24 @@
|
||||||
#generic-accounts-container {
|
#generic-accounts-container {
|
||||||
|
.post-preview {
|
||||||
|
--max-height: 120px;
|
||||||
|
max-height: var(--max-height);
|
||||||
|
overflow: hidden;
|
||||||
|
margin-block: 8px;
|
||||||
|
border: 1px solid var(--outline-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
.status {
|
||||||
|
font-size: calc(var(--text-size) * 0.9);
|
||||||
|
mask-image: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
black calc(var(--max-height) / 2),
|
||||||
|
transparent calc(var(--max-height) - 8px)
|
||||||
|
);
|
||||||
|
filter: saturate(0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.accounts-list {
|
.accounts-list {
|
||||||
--list-gap: 16px;
|
--list-gap: 16px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
|
@ -12,10 +12,12 @@ import useLocationChange from '../utils/useLocationChange';
|
||||||
import AccountBlock from './account-block';
|
import AccountBlock from './account-block';
|
||||||
import Icon from './icon';
|
import Icon from './icon';
|
||||||
import Loader from './loader';
|
import Loader from './loader';
|
||||||
|
import Status from './status';
|
||||||
|
|
||||||
export default function GenericAccounts({
|
export default function GenericAccounts({
|
||||||
instance,
|
instance,
|
||||||
excludeRelationshipAttrs = [],
|
excludeRelationshipAttrs = [],
|
||||||
|
postID,
|
||||||
onClose = () => {},
|
onClose = () => {},
|
||||||
}) {
|
}) {
|
||||||
const { masto, instance: currentInstance } = api();
|
const { masto, instance: currentInstance } = api();
|
||||||
|
@ -129,6 +131,8 @@ export default function GenericAccounts({
|
||||||
}
|
}
|
||||||
}, [snapStates.reloadGenericAccounts.counter]);
|
}, [snapStates.reloadGenericAccounts.counter]);
|
||||||
|
|
||||||
|
const post = states.statuses[postID];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="generic-accounts-container" class="sheet" tabindex="-1">
|
<div id="generic-accounts-container" class="sheet" tabindex="-1">
|
||||||
<button type="button" class="sheet-close" onClick={onClose}>
|
<button type="button" class="sheet-close" onClick={onClose}>
|
||||||
|
@ -138,6 +142,11 @@ export default function GenericAccounts({
|
||||||
<h2>{heading || 'Accounts'}</h2>
|
<h2>{heading || 'Accounts'}</h2>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
{post && (
|
||||||
|
<div class="post-preview">
|
||||||
|
<Status status={post} size="s" readOnly />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{accounts.length > 0 ? (
|
{accounts.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
<ul class="accounts-list">
|
<ul class="accounts-list">
|
||||||
|
|
|
@ -179,6 +179,7 @@ export default function Modals() {
|
||||||
excludeRelationshipAttrs={
|
excludeRelationshipAttrs={
|
||||||
snapStates.showGenericAccounts.excludeRelationshipAttrs
|
snapStates.showGenericAccounts.excludeRelationshipAttrs
|
||||||
}
|
}
|
||||||
|
postID={snapStates.showGenericAccounts.postID}
|
||||||
onClose={() => (states.showGenericAccounts = false)}
|
onClose={() => (states.showGenericAccounts = false)}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -724,25 +724,6 @@ function Status({
|
||||||
const isPinnable = ['public', 'unlisted', 'private'].includes(visibility);
|
const isPinnable = ['public', 'unlisted', 'private'].includes(visibility);
|
||||||
const StatusMenuItems = (
|
const StatusMenuItems = (
|
||||||
<>
|
<>
|
||||||
{isSizeLarge && (
|
|
||||||
<>
|
|
||||||
<MenuItem
|
|
||||||
onClick={() => {
|
|
||||||
states.showGenericAccounts = {
|
|
||||||
heading: 'Boosted/Liked by…',
|
|
||||||
fetchAccounts: fetchBoostedLikedByAccounts,
|
|
||||||
instance,
|
|
||||||
showReactions: true,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon icon="react" />
|
|
||||||
<span>
|
|
||||||
Boosted/Liked by<span class="more-insignificant">…</span>
|
|
||||||
</span>
|
|
||||||
</MenuItem>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{!isSizeLarge && sameInstance && (
|
{!isSizeLarge && sameInstance && (
|
||||||
<>
|
<>
|
||||||
<div class="menu-control-group-horizontal status-menu">
|
<div class="menu-control-group-horizontal status-menu">
|
||||||
|
@ -840,6 +821,29 @@ function Status({
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{!isSizeLarge && sameInstance && (isSizeLarge || showActionsBar) && (
|
||||||
|
<MenuDivider />
|
||||||
|
)}
|
||||||
|
{(isSizeLarge || showActionsBar) && (
|
||||||
|
<>
|
||||||
|
<MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
states.showGenericAccounts = {
|
||||||
|
heading: 'Boosted/Liked by…',
|
||||||
|
fetchAccounts: fetchBoostedLikedByAccounts,
|
||||||
|
instance,
|
||||||
|
showReactions: true,
|
||||||
|
postID: sKey,
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="react" />
|
||||||
|
<span>
|
||||||
|
Boosted/Liked by<span class="more-insignificant">…</span>
|
||||||
|
</span>
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{(enableTranslate || !language || differentLanguage) && <MenuDivider />}
|
{(enableTranslate || !language || differentLanguage) && <MenuDivider />}
|
||||||
{enableTranslate ? (
|
{enableTranslate ? (
|
||||||
<div class={supportsTTS ? 'menu-horizontal' : ''}>
|
<div class={supportsTTS ? 'menu-horizontal' : ''}>
|
||||||
|
|
Loading…
Reference in a new issue