2021-09-14 12:18:44 -04:00
|
|
|
import { Check } from "@styled-icons/boxicons-regular";
|
2021-06-27 06:17:59 -04:00
|
|
|
import { Cog } from "@styled-icons/boxicons-solid";
|
2021-07-29 14:01:40 -04:00
|
|
|
import { observer } from "mobx-react-lite";
|
2021-07-05 06:23:23 -04:00
|
|
|
import { Link } from "react-router-dom";
|
2021-06-21 16:35:21 -04:00
|
|
|
import { ServerPermission } from "revolt.js/dist/api/permissions";
|
2021-07-30 17:40:49 -04:00
|
|
|
import { Server } from "revolt.js/dist/maps/Servers";
|
2021-07-05 06:23:23 -04:00
|
|
|
import styled from "styled-components";
|
|
|
|
|
2021-10-31 18:42:40 -04:00
|
|
|
import { Text } from "preact-i18n";
|
|
|
|
|
2021-07-05 06:23:23 -04:00
|
|
|
import Header from "../ui/Header";
|
|
|
|
import IconButton from "../ui/IconButton";
|
|
|
|
|
2021-08-17 18:54:55 -04:00
|
|
|
import Tooltip from "./Tooltip";
|
|
|
|
|
2021-06-21 16:35:21 -04:00
|
|
|
interface Props {
|
2021-07-05 06:25:20 -04:00
|
|
|
server: Server;
|
2021-06-21 16:35:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
const ServerName = styled.div`
|
2021-07-05 06:25:20 -04:00
|
|
|
flex-grow: 1;
|
2021-06-21 16:35:21 -04:00
|
|
|
`;
|
|
|
|
|
2021-07-29 14:01:40 -04:00
|
|
|
export default observer(({ server }: Props) => {
|
2021-07-30 17:40:49 -04:00
|
|
|
const bannerURL = server.generateBannerURL({ width: 480 });
|
2021-06-21 16:35:21 -04:00
|
|
|
|
2021-07-05 06:25:20 -04:00
|
|
|
return (
|
|
|
|
<Header
|
|
|
|
borders
|
|
|
|
placement="secondary"
|
|
|
|
background={typeof bannerURL !== "undefined"}
|
|
|
|
style={{
|
|
|
|
background: bannerURL ? `url('${bannerURL}')` : undefined,
|
|
|
|
}}>
|
2021-09-14 12:18:44 -04:00
|
|
|
{server.flags && server.flags & 1 ? (
|
2021-10-31 18:42:40 -04:00
|
|
|
<Tooltip
|
|
|
|
content={<Text id="app.special.server-badges.official" />}
|
|
|
|
placement={"bottom-start"}>
|
2021-08-17 18:54:55 -04:00
|
|
|
<svg width="20" height="20">
|
|
|
|
<image
|
2021-08-17 19:58:49 -04:00
|
|
|
xlinkHref="/assets/badges/verified.svg"
|
2021-08-17 18:54:55 -04:00
|
|
|
height="20"
|
|
|
|
width="20"
|
|
|
|
/>
|
|
|
|
<image
|
2021-08-17 19:58:49 -04:00
|
|
|
xlinkHref="/assets/badges/revolt_r.svg"
|
2021-08-17 18:54:55 -04:00
|
|
|
height="15"
|
|
|
|
width="15"
|
2021-08-17 19:06:57 -04:00
|
|
|
x="2"
|
2021-08-17 18:54:55 -04:00
|
|
|
y="3"
|
|
|
|
style={
|
2021-08-17 19:06:57 -04:00
|
|
|
"justify-content: center; align-items: center; filter: brightness(0);"
|
2021-08-17 18:54:55 -04:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
</svg>
|
|
|
|
</Tooltip>
|
|
|
|
) : undefined}
|
2021-09-14 12:18:44 -04:00
|
|
|
{server.flags && server.flags & 2 ? (
|
2021-10-31 18:42:40 -04:00
|
|
|
<Tooltip
|
|
|
|
content={<Text id="app.special.server-badges.verified" />}
|
|
|
|
placement={"bottom-start"}>
|
2021-09-14 12:18:44 -04:00
|
|
|
<svg width="20" height="20">
|
|
|
|
<image
|
|
|
|
xlinkHref="/assets/badges/verified.svg"
|
|
|
|
height="20"
|
|
|
|
width="20"
|
|
|
|
/>
|
|
|
|
<foreignObject x="2" y="2" width="15" height="15">
|
|
|
|
<Check size={15} color="black" strokeWidth={8} />
|
|
|
|
</foreignObject>
|
|
|
|
</svg>
|
|
|
|
</Tooltip>
|
|
|
|
) : undefined}
|
2021-08-17 18:54:55 -04:00
|
|
|
|
2021-07-05 06:25:20 -04:00
|
|
|
<ServerName>{server.name}</ServerName>
|
2021-07-30 17:40:49 -04:00
|
|
|
{(server.permission & ServerPermission.ManageServer) > 0 && (
|
2021-07-05 06:25:20 -04:00
|
|
|
<div className="actions">
|
|
|
|
<Link to={`/server/${server._id}/settings`}>
|
|
|
|
<IconButton>
|
|
|
|
<Cog size={24} />
|
|
|
|
</IconButton>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</Header>
|
|
|
|
);
|
2021-07-29 14:01:40 -04:00
|
|
|
});
|