2021-09-19 15:33:48 +00:00
|
|
|
import * as React from "react"
|
|
|
|
import Style from "./ResearchGroupPanel.module.css"
|
2021-09-20 14:55:05 +00:00
|
|
|
import {Panel} from "@steffo/bluelib-react";
|
2021-09-19 15:33:48 +00:00
|
|
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
2021-09-20 14:55:05 +00:00
|
|
|
import {faEnvelope, faGlobe, faQuestion} from "@fortawesome/free-solid-svg-icons";
|
2021-09-19 21:49:16 +00:00
|
|
|
import {ResearchGroup} from "../types";
|
2021-09-19 22:28:02 +00:00
|
|
|
import {UserLink} from "./UserLink";
|
2021-09-19 22:59:01 +00:00
|
|
|
import {Link} from "./Link";
|
2021-09-19 15:33:48 +00:00
|
|
|
|
|
|
|
|
2021-09-19 21:49:16 +00:00
|
|
|
export function ResearchGroupPanel({owner, name, access, slug}: ResearchGroup): JSX.Element {
|
2021-09-19 22:59:01 +00:00
|
|
|
let accessIcon: JSX.Element
|
2021-09-19 15:33:48 +00:00
|
|
|
if(access === "OPEN") {
|
2021-09-19 22:59:01 +00:00
|
|
|
accessIcon = <FontAwesomeIcon icon={faGlobe} title={"Open"}/>
|
2021-09-19 15:33:48 +00:00
|
|
|
}
|
|
|
|
else if(access === "MANUAL") {
|
2021-09-19 22:59:01 +00:00
|
|
|
accessIcon = <FontAwesomeIcon icon={faEnvelope} title={"Invite-only"}/>
|
2021-09-19 15:33:48 +00:00
|
|
|
}
|
|
|
|
else {
|
2021-09-19 22:59:01 +00:00
|
|
|
accessIcon = <FontAwesomeIcon icon={faQuestion} title={"Unknown"}/>
|
2021-09-19 15:33:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Panel className={Style.Panel}>
|
|
|
|
<div className={Style.Access}>
|
2021-09-19 22:59:01 +00:00
|
|
|
{accessIcon}
|
2021-09-19 15:33:48 +00:00
|
|
|
</div>
|
|
|
|
<div className={Style.Name} title={slug}>
|
2021-09-19 22:59:01 +00:00
|
|
|
<Link href={`/g/${slug}/`}>{name}</Link>
|
2021-09-19 15:33:48 +00:00
|
|
|
</div>
|
|
|
|
<div className={Style.Owner}>
|
2021-09-19 22:28:02 +00:00
|
|
|
Created by <UserLink id={owner}/>
|
2021-09-19 15:33:48 +00:00
|
|
|
</div>
|
|
|
|
</Panel>
|
|
|
|
)
|
|
|
|
}
|