Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 49 additions & 37 deletions packages/client/src/interface/navigation/channels/ServerSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ const CategoryBase = styled("div", {
},
});


/**
* Server channel entry
*/
Expand All @@ -325,6 +326,16 @@ function Entry(
) {
const { openModal } = useModals();

// determine if user can edit channel (any relevant permission)
const canEditChannel = [
"ManageChannel",
"ManagePermissions",
"ManageWebhooks",
].some((perm) => props.channel.server?.havePermission(perm));

// user can create invites??
const canInvite = props.channel.server?.havePermission("InviteOthers");

return (
<a href={`/server/${props.channel.serverId}/channel/${props.channel.id}`}>
<MenuButton
Expand Down Expand Up @@ -352,42 +363,43 @@ function Entry(
}
actions={
<>
<a
use:floating={{
tooltip: {
placement: "top",
content: "Create Invite",
},
}}
onClick={(e) => {
e.preventDefault();
openModal({
type: "create_invite",
channel: props.channel,
});
}}
>
<MdPersonAdd {...iconSize("14px")} />
</a>

<a
use:floating={{
tooltip: {
placement: "top",
content: "Edit Channel",
},
}}
onClick={(e) => {
e.preventDefault();
openModal({
type: "settings",
config: "channel",
context: props.channel,
});
}}
>
<MdSettings {...iconSize("14px")} />
</a>
<Show when={canInvite}>
<a
use:floating={{
tooltip: {
placement: "top",
content: "Create Invite",
},
}}
onClick={(e) => {
e.preventDefault();
openModal({
type: "create_invite",
channel: props.channel,
});
}}
>
<MdPersonAdd {...iconSize("14px")} />
</a>
</Show>

<Show when={canEditChannel}>
<a
use:floating={{
tooltip: { placement: "top", content: "Edit Channel" },
}}
onClick={(e) => {
e.preventDefault();
openModal({
type: "settings",
config: "channel",
context: props.channel,
});
}}
>
<MdSettings {...iconSize("14px")} />
</a>
</Show>
</>
}
>
Expand Down Expand Up @@ -419,4 +431,4 @@ const List = styled(Column, {
width: "var(--layout-width-channel-sidebar)",
paddingRight: "var(--gap-md)",
},
});
});