Fix logged-out quote menu UX, simplify Interaction dialog copy (#36124)
This commit is contained in:
parent
943cdc5b21
commit
38fa0102c1
11 changed files with 51 additions and 142 deletions
|
|
@ -46,7 +46,6 @@ export const FollowButton: React.FC<{
|
|||
openModal({
|
||||
modalType: 'INTERACTION',
|
||||
modalProps: {
|
||||
type: 'follow',
|
||||
accountId: accountId,
|
||||
url: account?.url,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ export const Poll: React.FC<PollProps> = ({ pollId, disabled, status }) => {
|
|||
openModal({
|
||||
modalType: 'INTERACTION',
|
||||
modalProps: {
|
||||
type: 'vote',
|
||||
accountId: status.getIn(['account', 'id']),
|
||||
url: status.get('uri'),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -72,6 +72,18 @@ export const StatusBoostButton: FC<ReblogButtonProps> = ({
|
|||
const statusId = status.get('id') as string;
|
||||
const wasBoosted = !!status.get('reblogged');
|
||||
|
||||
const showLoginPrompt = useCallback(() => {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'INTERACTION',
|
||||
modalProps: {
|
||||
accountId: status.getIn(['account', 'id']),
|
||||
url: status.get('uri'),
|
||||
},
|
||||
}),
|
||||
);
|
||||
}, [dispatch, status]);
|
||||
|
||||
const items = useMemo(() => {
|
||||
const boostItem = boostItemState(statusState);
|
||||
const quoteItem = quoteItemState(statusState);
|
||||
|
|
@ -87,6 +99,8 @@ export const StatusBoostButton: FC<ReblogButtonProps> = ({
|
|||
action: (event) => {
|
||||
if (isLoggedIn) {
|
||||
dispatch(toggleReblog(statusId, event.shiftKey));
|
||||
} else {
|
||||
showLoginPrompt();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
@ -100,34 +114,37 @@ export const StatusBoostButton: FC<ReblogButtonProps> = ({
|
|||
action: () => {
|
||||
if (isLoggedIn) {
|
||||
dispatch(quoteComposeById(statusId));
|
||||
} else {
|
||||
showLoginPrompt();
|
||||
}
|
||||
},
|
||||
},
|
||||
] satisfies [ActionMenuItemWithIcon, ActionMenuItemWithIcon];
|
||||
}, [dispatch, intl, isLoggedIn, statusId, statusState, wasBoosted]);
|
||||
}, [
|
||||
dispatch,
|
||||
intl,
|
||||
isLoggedIn,
|
||||
showLoginPrompt,
|
||||
statusId,
|
||||
statusState,
|
||||
wasBoosted,
|
||||
]);
|
||||
|
||||
const boostIcon = items[0].icon;
|
||||
|
||||
const handleDropdownOpen = useCallback(
|
||||
(event: MouseEvent | KeyboardEvent) => {
|
||||
if (!isLoggedIn) {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'INTERACTION',
|
||||
modalProps: {
|
||||
type: 'reblog',
|
||||
accountId: status.getIn(['account', 'id']),
|
||||
url: status.get('uri'),
|
||||
},
|
||||
}),
|
||||
);
|
||||
} else if (event.shiftKey) {
|
||||
if (event.shiftKey) {
|
||||
if (!isLoggedIn) {
|
||||
showLoginPrompt();
|
||||
return false;
|
||||
}
|
||||
dispatch(toggleReblog(status.get('id'), true));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
[dispatch, isLoggedIn, status],
|
||||
[dispatch, isLoggedIn, showLoginPrompt, status],
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
@ -223,7 +240,6 @@ export const LegacyReblogButton: FC<ReblogButtonProps> = ({
|
|||
openModal({
|
||||
modalType: 'INTERACTION',
|
||||
modalProps: {
|
||||
type: 'reblog',
|
||||
accountId: status.getIn(['account', 'id']),
|
||||
url: status.get('uri'),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ export function boostItemState({
|
|||
}
|
||||
|
||||
export function quoteItemState({
|
||||
isLoggedIn,
|
||||
isMine,
|
||||
isQuoteAutomaticallyAccepted,
|
||||
isQuoteManuallyAccepted,
|
||||
|
|
@ -149,7 +150,8 @@ export function quoteItemState({
|
|||
} else if (isQuoteManuallyAccepted) {
|
||||
iconText.title = messages.request_quote;
|
||||
iconText.meta = messages.quote_manual_review;
|
||||
} else {
|
||||
// We don't show the disabled state when logged out
|
||||
} else if (isLoggedIn) {
|
||||
iconText.disabled = true;
|
||||
iconText.iconComponent = FormatQuoteOff;
|
||||
iconText.meta = isQuoteFollowersOnly
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
if (signedIn) {
|
||||
this.props.onReply(this.props.status);
|
||||
} else {
|
||||
this.props.onInteractionModal('reply', this.props.status);
|
||||
this.props.onInteractionModal(this.props.status);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
if (signedIn) {
|
||||
this.props.onFavourite(this.props.status);
|
||||
} else {
|
||||
this.props.onInteractionModal('favourite', this.props.status);
|
||||
this.props.onInteractionModal(this.props.status);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue