mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 17:41:33 +03:00
Merge pull request #3745 from urbit/mp/landscape/admins-only
landscape: only show 'new channel' if admin
This commit is contained in:
commit
4354fdde09
@ -20,6 +20,8 @@ import { getGroupFromWorkspace } from "~/logic/lib/workspace";
|
||||
import { SidebarAppConfigs } from './types';
|
||||
import { SidebarList } from "./SidebarList";
|
||||
import { SidebarInvite } from './SidebarInvite';
|
||||
import { roleForShip } from "~/logic/lib/group";
|
||||
|
||||
|
||||
interface SidebarProps {
|
||||
children: ReactNode;
|
||||
@ -89,6 +91,14 @@ export function Sidebar(props: SidebarProps) {
|
||||
);
|
||||
const sidebarInvites = (workspace?.type === 'home')
|
||||
? inviteItems(invites, api) : null;
|
||||
|
||||
const role = props.groups?.[groupPath] ? roleForShip(props.groups[groupPath], window.ship) : undefined;
|
||||
const isAdmin = (role === "admin") || (workspace?.type === 'home');
|
||||
|
||||
const newStyle = {
|
||||
display: isAdmin ? "block" : "none"
|
||||
};
|
||||
|
||||
return (
|
||||
<Col
|
||||
display={display}
|
||||
@ -131,6 +141,7 @@ export function Sidebar(props: SidebarProps) {
|
||||
py="2"
|
||||
>
|
||||
<Link
|
||||
style={newStyle}
|
||||
to={!!groupPath ? `/~landscape${groupPath}/new` : `/~landscape/home/new`}
|
||||
>
|
||||
<Box
|
||||
|
Loading…
Reference in New Issue
Block a user