2023-10-23 23:33:39 +02:00
|
|
|
import Link from "next/link"
|
|
|
|
import { CogIcon, PlusIcon } from "@heroicons/react/solid"
|
2022-01-01 20:42:25 +01:00
|
|
|
|
2023-10-23 23:33:39 +02:00
|
|
|
import { useGuildMember } from "../../../contexts/GuildMember"
|
|
|
|
import { Divider } from "../../design/Divider"
|
|
|
|
import { Channels } from "../Channels"
|
|
|
|
import { IconButton } from "../../design/IconButton"
|
|
|
|
import type { GuildsChannelsPath } from ".."
|
2022-01-01 20:42:25 +01:00
|
|
|
|
|
|
|
export interface GuildLeftSidebarProps {
|
|
|
|
path: GuildsChannelsPath
|
|
|
|
}
|
|
|
|
|
|
|
|
export const GuildLeftSidebar: React.FC<GuildLeftSidebarProps> = (props) => {
|
|
|
|
const { path } = props
|
|
|
|
|
2022-03-05 18:22:30 +01:00
|
|
|
const { guild, member } = useGuildMember()
|
2022-01-01 20:42:25 +01:00
|
|
|
|
|
|
|
return (
|
2023-10-23 23:33:39 +02:00
|
|
|
<div className="mt-2 flex w-full flex-col justify-between">
|
|
|
|
<div className="mx-8 mt-2 p-2 text-center">
|
|
|
|
<h2 data-cy="guild-left-sidebar-title" className="text-xl">
|
2022-01-01 20:42:25 +01:00
|
|
|
{guild.name}
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
<Divider />
|
|
|
|
<Channels path={path} />
|
|
|
|
<Divider />
|
2023-10-23 23:33:39 +02:00
|
|
|
<div className="mb-1 flex items-center justify-center space-x-6 p-2">
|
2022-03-05 18:22:30 +01:00
|
|
|
{member.isOwner && (
|
2022-12-13 11:38:07 +01:00
|
|
|
<Link
|
|
|
|
href={`/application/${path.guildId}/channels/create`}
|
|
|
|
passHref
|
2023-10-23 23:33:39 +02:00
|
|
|
data-cy="link-add-channel"
|
2022-12-13 11:38:07 +01:00
|
|
|
>
|
2023-10-23 23:33:39 +02:00
|
|
|
<IconButton className="h-10 w-10" title="Add a Channel">
|
2022-12-13 11:38:07 +01:00
|
|
|
<PlusIcon />
|
|
|
|
</IconButton>
|
2022-03-05 18:22:30 +01:00
|
|
|
</Link>
|
|
|
|
)}
|
2022-12-13 11:38:07 +01:00
|
|
|
<Link
|
|
|
|
href={`/application/${path.guildId}/settings`}
|
|
|
|
passHref
|
2023-10-23 23:33:39 +02:00
|
|
|
data-cy="link-settings-guild"
|
2022-12-13 11:38:07 +01:00
|
|
|
>
|
2023-10-23 23:33:39 +02:00
|
|
|
<IconButton className="h-7 w-7" title="Settings">
|
2022-12-13 11:38:07 +01:00
|
|
|
<CogIcon />
|
|
|
|
</IconButton>
|
2022-03-05 18:22:30 +01:00
|
|
|
</Link>
|
2022-01-01 20:42:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|