mirror of
https://github.com/spacebarchat/client.git
synced 2024-11-22 02:12:38 +01:00
context menu item sorting
This commit is contained in:
parent
77091f9416
commit
7b9c6dc464
@ -50,6 +50,7 @@ function ChannelListItem({ guild, channel, isCategory, active }: Props) {
|
||||
const contextMenu = React.useContext(ContextMenuContext);
|
||||
const [contextMenuItems, setContextMenuItems] = React.useState<IContextMenuItem[]>([
|
||||
{
|
||||
index: 1,
|
||||
label: "Copy Channel ID",
|
||||
onClick: () => {
|
||||
navigator.clipboard.writeText(channel.id);
|
||||
@ -59,6 +60,7 @@ function ChannelListItem({ guild, channel, isCategory, active }: Props) {
|
||||
},
|
||||
},
|
||||
{
|
||||
index: 0,
|
||||
label: "Create Channel Invite",
|
||||
onClick: () => {
|
||||
openModal(CreateInviteModal, { guild_id: guild.id, channel_id: channel.id });
|
||||
|
@ -44,6 +44,7 @@ function ContextMenu({ position, close, items, style }: Props) {
|
||||
>
|
||||
{items
|
||||
.filter((a) => a.visible !== false)
|
||||
.sort((a, b) => (a.index ?? 0) - (b.index ?? 0))
|
||||
.map((item, index) => {
|
||||
return <ContextMenuItem key={index} item={item} close={close} index={index} />;
|
||||
})}
|
||||
|
Loading…
Reference in New Issue
Block a user