Add icons to all? dropdown menus

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
features-override
marcin mikołajczak 2021-11-04 20:19:04 +01:00
rodzic e669938793
commit 43fe27eecc
10 zmienionych plików z 203 dodań i 39 usunięć

Wyświetl plik

@ -182,61 +182,141 @@ class Header extends ImmutablePureComponent {
}
if (account.get('id') === me) {
menu.push({ text: intl.formatMessage(messages.edit_profile), to: '/settings/profile' });
menu.push({ text: intl.formatMessage(messages.preferences), to: '/settings/preferences' });
menu.push({
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({ 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({ text: intl.formatMessage(messages.mutes), to: '/mutes' });
menu.push({ text: intl.formatMessage(messages.blocks), to: '/blocks' });
menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' });
menu.push({
text: intl.formatMessage(messages.mutes),
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 {
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) {
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 {
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', '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 {
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 (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 {
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) {
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(null);
} 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'])) {
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 {
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'])) {
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 {
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)) {
@ -245,9 +325,17 @@ class Header extends ImmutablePureComponent {
menu.push(null);
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 {
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);
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 (isAdmin(account)) {
menu.push({ text: intl.formatMessage(messages.demoteToModerator, { name: account.get('username') }), action: this.props.onPromoteToModerator });
menu.push({ text: intl.formatMessage(messages.demoteToUser, { name: account.get('username') }), action: this.props.onDemoteToUser });
menu.push({
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)) {
menu.push({ text: intl.formatMessage(messages.promoteToAdmin, { name: account.get('username') }), action: this.props.onPromoteToAdmin });
menu.push({ text: intl.formatMessage(messages.demoteToUser, { name: account.get('username') }), action: this.props.onDemoteToUser });
menu.push({
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 {
menu.push({ text: intl.formatMessage(messages.promoteToAdmin, { name: account.get('username') }), action: this.props.onPromoteToAdmin });
menu.push({ text: intl.formatMessage(messages.promoteToModerator, { name: account.get('username') }), action: this.props.onPromoteToModerator });
menu.push({
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)) {
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 {
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) {
menu.push({ text: intl.formatMessage(messages.deactivateUser, { name: account.get('username') }), action: this.props.onDeactivateUser });
menu.push({ text: intl.formatMessage(messages.deleteUser, { name: account.get('username') }), action: this.props.onDeleteUser });
menu.push({
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'),
});
}
}

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -261,8 +261,16 @@ class ChatMessageList extends ImmutablePureComponent {
renderMessage = (chatMessage) => {
const { me, intl } = this.props;
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 (

Wyświetl plik

@ -50,8 +50,16 @@ class Header extends ImmutablePureComponent {
const { group, intl } = this.props;
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' />;

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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