Add icons to all? dropdown menus

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2021-11-04 20:19:04 +01:00
parent e669938793
commit 43fe27eecc
10 changed files with 203 additions and 39 deletions

View file

@ -182,61 +182,141 @@ class Header extends ImmutablePureComponent {
} }
if (account.get('id') === me) { if (account.get('id') === me) {
menu.push({ text: intl.formatMessage(messages.edit_profile), to: '/settings/profile' }); menu.push({
menu.push({ text: intl.formatMessage(messages.preferences), to: '/settings/preferences' }); text: intl.formatMessage(messages.edit_profile),
to: '/settings/profile',
icon: require('@tabler/icons/icons/user.svg'),
});
menu.push({
text: intl.formatMessage(messages.preferences),
to: '/settings/preferences',
icon: require('@tabler/icons/icons/settings.svg'),
});
menu.push(null); menu.push(null);
menu.push({ text: intl.formatMessage(messages.follow_requests), to: '/follow_requests' }); menu.push({
text: intl.formatMessage(messages.follow_requests),
to: '/follow_requests',
icon: require('@tabler/icons/icons/user-plus.svg'),
});
menu.push(null); menu.push(null);
menu.push({ text: intl.formatMessage(messages.mutes), to: '/mutes' }); menu.push({
menu.push({ text: intl.formatMessage(messages.blocks), to: '/blocks' }); text: intl.formatMessage(messages.mutes),
menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' }); to: '/mutes',
icon: require('@tabler/icons/icons/circle-x.svg'),
});
menu.push({
text: intl.formatMessage(messages.blocks),
to: '/blocks',
icon: require('@tabler/icons/icons/ban.svg'),
});
menu.push({
text: intl.formatMessage(messages.domain_blocks),
to: '/domain_blocks',
icon: require('@tabler/icons/icons/ban.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.mention, { name: account.get('username') }), action: this.props.onMention }); menu.push({
text: intl.formatMessage(messages.mention, { name: account.get('username') }),
action: this.props.onMention,
icon: require('feather-icons/dist/icons/at-sign.svg'),
});
if (account.getIn(['pleroma', 'accepts_chat_messages'], false) === true) { if (account.getIn(['pleroma', 'accepts_chat_messages'], false) === true) {
menu.push({ text: intl.formatMessage(messages.chat, { name: account.get('username') }), action: this.props.onChat }); menu.push({
text: intl.formatMessage(messages.chat, { name: account.get('username') }),
action: this.props.onChat,
icon: require('@tabler/icons/icons/messages.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.direct, { name: account.get('username') }), action: this.props.onDirect }); menu.push({
text: intl.formatMessage(messages.direct, { name: account.get('username') }),
action: this.props.onDirect,
icon:require('@tabler/icons/icons/mail.svg'),
});
} }
if (account.getIn(['relationship', 'following'])) { if (account.getIn(['relationship', 'following'])) {
if (account.getIn(['relationship', 'showing_reblogs'])) { if (account.getIn(['relationship', 'showing_reblogs'])) {
menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle }); menu.push({
text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }),
action: this.props.onReblogToggle,
icon: require('@tabler/icons/icons/repeat.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle }); menu.push({
text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }),
action: this.props.onReblogToggle,
icon: require('@tabler/icons/icons/repeat.svg'),
});
} }
if (features.accountSubscriptions) { if (features.accountSubscriptions) {
if (account.getIn(['relationship', 'subscribing'])) { if (account.getIn(['relationship', 'subscribing'])) {
menu.push({ text: intl.formatMessage(messages.unsubscribe, { name: account.get('username') }), action: this.props.onSubscriptionToggle }); menu.push({
text: intl.formatMessage(messages.unsubscribe, { name: account.get('username') }),
action: this.props.onSubscriptionToggle,
icon: require('@tabler/icons/icons/bell.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.subscribe, { name: account.get('username') }), action: this.props.onSubscriptionToggle }); menu.push({
text: intl.formatMessage(messages.subscribe, { name: account.get('username') }),
action: this.props.onSubscriptionToggle,
icon: require('@tabler/icons/icons/bell-off.svg'),
});
} }
} }
if (features.lists) { if (features.lists) {
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList }); menu.push({
text: intl.formatMessage(messages.add_or_remove_from_list),
action: this.props.onAddToList,
icon: require('@tabler/icons/icons/list.svg'),
});
} }
// menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle }); // menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle });
menu.push(null); menu.push(null);
} else if (features.lists && features.unrestrictedLists) { } else if (features.lists && features.unrestrictedLists) {
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList }); menu.push({
text: intl.formatMessage(messages.add_or_remove_from_list),
action: this.props.onAddToList,
icon: require('@tabler/icons/icons/list.svg'),
});
} }
if (account.getIn(['relationship', 'muting'])) { if (account.getIn(['relationship', 'muting'])) {
menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.props.onMute }); menu.push({
text: intl.formatMessage(messages.unmute, { name: account.get('username') }),
action: this.props.onMute,
icon: require('@tabler/icons/icons/circle-x.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.mute, { name: account.get('username') }), action: this.props.onMute }); menu.push({
text: intl.formatMessage(messages.mute, { name: account.get('username') }),
action: this.props.onMute,
icon: require('@tabler/icons/icons/circle-x.svg'),
});
} }
if (account.getIn(['relationship', 'blocking'])) { if (account.getIn(['relationship', 'blocking'])) {
menu.push({ text: intl.formatMessage(messages.unblock, { name: account.get('username') }), action: this.props.onBlock }); menu.push({
text: intl.formatMessage(messages.unblock, { name: account.get('username') }),
action: this.props.onBlock,
icon: require('@tabler/icons/icons/ban.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.block, { name: account.get('username') }), action: this.props.onBlock }); menu.push({
text: intl.formatMessage(messages.block, { name: account.get('username') }),
action: this.props.onBlock,
icon: require('@tabler/icons/icons/ban.svg'),
});
} }
menu.push({ text: intl.formatMessage(messages.report, { name: account.get('username') }), action: this.props.onReport }); menu.push({
text: intl.formatMessage(messages.report, { name: account.get('username') }),
action: this.props.onReport,
icon: require('@tabler/icons/icons/flag.svg'),
});
} }
if (isRemote(account)) { if (isRemote(account)) {
@ -245,9 +325,17 @@ class Header extends ImmutablePureComponent {
menu.push(null); menu.push(null);
if (account.getIn(['relationship', 'domain_blocking'])) { if (account.getIn(['relationship', 'domain_blocking'])) {
menu.push({ text: intl.formatMessage(messages.unblockDomain, { domain }), action: this.props.onUnblockDomain }); menu.push({
text: intl.formatMessage(messages.unblockDomain, { domain }),
action: this.props.onUnblockDomain,
icon: require('@tabler/icons/icons/ban.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.blockDomain, { domain }), action: this.props.onBlockDomain }); menu.push({
text: intl.formatMessage(messages.blockDomain, { domain }),
action: this.props.onBlockDomain,
icon: require('@tabler/icons/icons/ban.svg'),
});
} }
} }
@ -255,31 +343,74 @@ class Header extends ImmutablePureComponent {
menu.push(null); menu.push(null);
if (isAdmin(meAccount)) { if (isAdmin(meAccount)) {
menu.push({ text: intl.formatMessage(messages.admin_account, { name: account.get('username') }), href: `/pleroma/admin/#/users/${account.get('id')}/`, newTab: true }); menu.push({
text: intl.formatMessage(messages.admin_account, { name: account.get('username') }),
href: `/pleroma/admin/#/users/${account.get('id')}/`, newTab: true,
icon: require('icons/gavel.svg'),
});
} }
if (account.get('id') !== me && isLocal(account)) { if (account.get('id') !== me && isLocal(account)) {
if (isAdmin(account)) { if (isAdmin(account)) {
menu.push({ text: intl.formatMessage(messages.demoteToModerator, { name: account.get('username') }), action: this.props.onPromoteToModerator }); menu.push({
menu.push({ text: intl.formatMessage(messages.demoteToUser, { name: account.get('username') }), action: this.props.onDemoteToUser }); text: intl.formatMessage(messages.demoteToModerator, { name: account.get('username') }),
action: this.props.onPromoteToModerator,
icon: require('@tabler/icons/icons/arrow-up-circle.svg'),
});
menu.push({
text: intl.formatMessage(messages.demoteToUser, { name: account.get('username') }),
action: this.props.onDemoteToUser,
icon: require('@tabler/icons/icons/arrow-down-circle.svg'),
});
} else if (isModerator(account)) { } else if (isModerator(account)) {
menu.push({ text: intl.formatMessage(messages.promoteToAdmin, { name: account.get('username') }), action: this.props.onPromoteToAdmin }); menu.push({
menu.push({ text: intl.formatMessage(messages.demoteToUser, { name: account.get('username') }), action: this.props.onDemoteToUser }); text: intl.formatMessage(messages.promoteToAdmin, { name: account.get('username') }),
action: this.props.onPromoteToAdmin,
icon: require('@tabler/icons/icons/arrow-up-circle.svg'),
});
menu.push({
text: intl.formatMessage(messages.demoteToUser, { name: account.get('username') }),
action: this.props.onDemoteToUser,
icon: require('@tabler/icons/icons/arrow-down-circle.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.promoteToAdmin, { name: account.get('username') }), action: this.props.onPromoteToAdmin }); menu.push({
menu.push({ text: intl.formatMessage(messages.promoteToModerator, { name: account.get('username') }), action: this.props.onPromoteToModerator }); text: intl.formatMessage(messages.promoteToAdmin, { name: account.get('username') }),
action: this.props.onPromoteToAdmin,
icon: require('@tabler/icons/icons/arrow-up-circle.svg'),
});
menu.push({
text: intl.formatMessage(messages.promoteToModerator, { name: account.get('username') }),
action: this.props.onPromoteToModerator,
icon: require('@tabler/icons/icons/arrow-up-circle.svg'),
});
} }
} }
if (isVerified(account)) { if (isVerified(account)) {
menu.push({ text: intl.formatMessage(messages.unverifyUser, { name: account.get('username') }), action: this.props.onUnverifyUser }); menu.push({
text: intl.formatMessage(messages.unverifyUser, { name: account.get('username') }),
action: this.props.onUnverifyUser,
icon: require('@tabler/icons/icons/check.svg'),
});
} else { } else {
menu.push({ text: intl.formatMessage(messages.verifyUser, { name: account.get('username') }), action: this.props.onVerifyUser }); menu.push({
text: intl.formatMessage(messages.verifyUser, { name: account.get('username') }),
action: this.props.onVerifyUser,
icon: require('@tabler/icons/icons/check.svg'),
});
} }
if (account.get('id') !== me) { if (account.get('id') !== me) {
menu.push({ text: intl.formatMessage(messages.deactivateUser, { name: account.get('username') }), action: this.props.onDeactivateUser }); menu.push({
menu.push({ text: intl.formatMessage(messages.deleteUser, { name: account.get('username') }), action: this.props.onDeleteUser }); text: intl.formatMessage(messages.deactivateUser, { name: account.get('username') }),
action: this.props.onDeactivateUser,
icon: require('@tabler/icons/icons/user-off.svg'),
});
menu.push({
text: intl.formatMessage(messages.deleteUser, { name: account.get('username') }),
icon: require('@tabler/icons/icons/user-minus.svg'),
});
} }
} }

View file

@ -37,9 +37,11 @@ class Report extends ImmutablePureComponent {
return [{ return [{
text: intl.formatMessage(messages.deactivateUser, { name: report.getIn(['account', 'username']) }), text: intl.formatMessage(messages.deactivateUser, { name: report.getIn(['account', 'username']) }),
action: this.handleDeactivateUser, action: this.handleDeactivateUser,
icon: require('@tabler/icons/icons/user-off.svg'),
}, { }, {
text: intl.formatMessage(messages.deleteUser, { name: report.getIn(['account', 'username']) }), text: intl.formatMessage(messages.deleteUser, { name: report.getIn(['account', 'username']) }),
action: this.handleDeleteUser, action: this.handleDeleteUser,
icon: require('@tabler/icons/icons/user-minus.svg'),
}]; }];
} }

View file

@ -32,9 +32,11 @@ class ReportStatus extends ImmutablePureComponent {
return [{ return [{
text: intl.formatMessage(messages.viewStatus, { acct: `@${acct}` }), text: intl.formatMessage(messages.viewStatus, { acct: `@${acct}` }),
to: `/@${acct}/posts/${status.get('id')}`, to: `/@${acct}/posts/${status.get('id')}`,
icon: require('@tabler/icons/icons/pencil.svg'),
}, { }, {
text: intl.formatMessage(messages.deleteStatus, { acct: `@${acct}` }), text: intl.formatMessage(messages.deleteStatus, { acct: `@${acct}` }),
action: this.handleDeleteStatus, action: this.handleDeleteStatus,
icon: require('@tabler/icons/icons/trash.svg'),
}]; }];
} }

View file

@ -44,6 +44,7 @@ class Reports extends ImmutablePureComponent {
return [{ return [{
text: intl.formatMessage(messages.modlog), text: intl.formatMessage(messages.modlog),
to: '/admin/log', to: '/admin/log',
icon: require('@tabler/icons/icons/list.svg'),
}]; }];
} }

View file

@ -52,6 +52,7 @@ class Backups extends ImmutablePureComponent {
return [{ return [{
text: intl.formatMessage(messages.create), text: intl.formatMessage(messages.create),
action: this.handleCreateBackup, action: this.handleCreateBackup,
icon: require('@tabler/icons/icons/plus.svg'),
}]; }];
} }

View file

@ -261,8 +261,16 @@ class ChatMessageList extends ImmutablePureComponent {
renderMessage = (chatMessage) => { renderMessage = (chatMessage) => {
const { me, intl } = this.props; const { me, intl } = this.props;
const menu = [ const menu = [
{ text: intl.formatMessage(messages.delete), action: this.handleDeleteMessage(chatMessage.get('chat_id'), chatMessage.get('id')) }, {
{ text: intl.formatMessage(messages.report), action: this.handleReportUser(chatMessage.get('account_id')) }, text: intl.formatMessage(messages.delete),
action: this.handleDeleteMessage(chatMessage.get('chat_id'), chatMessage.get('id')),
icon: require('@tabler/icons/icons/trash.svg'),
},
{
text: intl.formatMessage(messages.report),
action: this.handleReportUser(chatMessage.get('account_id')),
icon: require('@tabler/icons/icons/flag.svg'),
},
]; ];
return ( return (

View file

@ -50,8 +50,16 @@ class Header extends ImmutablePureComponent {
const { group, intl } = this.props; const { group, intl } = this.props;
const menu = [ const menu = [
{ text: intl.formatMessage(messages.edit), to: `/groups/${group.get('id')}/edit` }, {
{ text: intl.formatMessage(messages.removed_accounts), to: `/groups/${group.get('id')}/removed_accounts` }, text: intl.formatMessage(messages.edit),
to: `/groups/${group.get('id')}/edit`,
icon: require('@tabler/icons/icons/edit.svg'),
},
{
text: intl.formatMessage(messages.removed_accounts),
to: `/groups/${group.get('id')}/removed_accounts`,
icon: require('@tabler/icons/icons/trash.svg'),
},
]; ];
return <DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' />; return <DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' />;

View file

@ -56,6 +56,7 @@ class InstanceInfoPanel extends ImmutablePureComponent {
return [{ return [{
text: intl.formatMessage(pinned ? messages.unpinHost : messages.pinHost, { host }), text: intl.formatMessage(pinned ? messages.unpinHost : messages.pinHost, { host }),
action: this.handlePinHost, action: this.handlePinHost,
icon: require(pinned ? '@tabler/icons/icons/pinned-off.svg' : '@tabler/icons/icons/pin.svg'),
}]; }];
} }

View file

@ -52,6 +52,7 @@ class InstanceModerationPanel extends ImmutablePureComponent {
return [{ return [{
text: intl.formatMessage(messages.editFederation), text: intl.formatMessage(messages.editFederation),
action: this.handleEditFederation, action: this.handleEditFederation,
icon: require('@tabler/icons/icons/edit.svg'),
}]; }];
} }

View file

@ -113,8 +113,17 @@ class ProfileDropdown extends React.PureComponent {
menu.push(null); menu.push(null);
menu.push({ text: intl.formatMessage(messages.add), to: '/auth/sign_in' }); menu.push({
menu.push({ text: intl.formatMessage(messages.logout, { acct: account.get('acct') }), to: '/auth/sign_out', action: this.handleLogOut }); text: intl.formatMessage(messages.add),
to: '/auth/sign_in',
icon: require('@tabler/icons/icons/plus.svg'),
});
menu.push({
text: intl.formatMessage(messages.logout, { acct: account.get('acct') }),
to: '/auth/sign_out',
action: this.handleLogOut,
icon: require('@tabler/icons/icons/logout.svg'),
});
return ( return (
<div className='compose__action-bar' style={{ 'marginTop':'-6px' }}> <div className='compose__action-bar' style={{ 'marginTop':'-6px' }}>