Skip to content

Commit d6b7b2c

Browse files
temp
1 parent 464c60a commit d6b7b2c

14 files changed

Lines changed: 594 additions & 515 deletions

File tree

client/src/components/entities/Entities.css

Lines changed: 0 additions & 58 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export type EntityTypes =
2+
| "code-repository"
3+
| "data-connector"
4+
| "session-launcher";
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import cx from "classnames";
2+
import {
3+
Database,
4+
FileCode,
5+
PlayCircle,
6+
QuestionCircle,
7+
} from "react-bootstrap-icons";
8+
9+
import { EntityTypes } from "../entities/entities.types";
10+
11+
interface OffcanvasHeaderWithTypeProps {
12+
children?: React.ReactNode;
13+
entityIcon?: React.ReactNode;
14+
entityName?: string;
15+
entityType?: EntityTypes;
16+
title: string;
17+
}
18+
19+
export default function OffcanvasHeaderWithType({
20+
children,
21+
entityIcon: _entityIcon,
22+
entityName: _entityName,
23+
entityType,
24+
title,
25+
}: OffcanvasHeaderWithTypeProps) {
26+
const entityIcon = _entityIcon ? (
27+
_entityIcon
28+
) : entityType === "data-connector" ? (
29+
<Database className="me-1" />
30+
) : entityType === "session-launcher" ? (
31+
<PlayCircle className="me-1" />
32+
) : entityType === "code-repository" ? (
33+
<FileCode className="me-1" />
34+
) : (
35+
<QuestionCircle className="me-1" />
36+
);
37+
38+
const entityName = _entityName
39+
? _entityName
40+
: entityType === "data-connector"
41+
? "Data connector"
42+
: entityType === "session-launcher"
43+
? "Session launcher"
44+
: entityType === "code-repository"
45+
? "Code repository"
46+
: "Unknown";
47+
48+
return (
49+
<div>
50+
<div className={cx("small", "text-muted")}>
51+
{entityIcon}
52+
{entityName}
53+
</div>
54+
<h2
55+
className={cx("mb-0", "text-break")}
56+
data-cy={entityType ? `${entityType}-title` : undefined}
57+
>
58+
{children && <div className={cx("float-end", "ms-2")}>{children}</div>}
59+
{title}
60+
</h2>
61+
</div>
62+
);
63+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import cx from "classnames";
2+
import { useRef } from "react";
3+
import { ArrowsFullscreen, XLg } from "react-bootstrap-icons";
4+
import { Link } from "react-router";
5+
import { UncontrolledTooltip } from "reactstrap";
6+
7+
import { EntityTypes } from "../entities/entities.types";
8+
9+
interface OffcanvasTopButtonsProps {
10+
entityType?: EntityTypes;
11+
fullPageLink?: string;
12+
toggleView: () => void;
13+
}
14+
export default function OffcanvasTopButtons({
15+
entityType,
16+
fullPageLink,
17+
toggleView,
18+
}: OffcanvasTopButtonsProps) {
19+
const refClose = useRef(null);
20+
const refExpand = useRef(null);
21+
22+
return (
23+
<div className={cx("align-items-center", "d-flex", "gap-2", "mb-3")}>
24+
<button
25+
aria-label="Close"
26+
className={cx(
27+
"border-0",
28+
"btn",
29+
"d-flex",
30+
"fs-2",
31+
"link-secondary",
32+
"p-0",
33+
"shadow-none",
34+
)}
35+
data-cy={
36+
entityType
37+
? `${entityType}-close-offcanvas-button`
38+
: "close-offcanvas-button"
39+
}
40+
data-bs-dismiss="offcanvas"
41+
ref={refClose}
42+
onClick={toggleView}
43+
>
44+
<XLg />
45+
<span className="visually-hidden">Close side panel</span>
46+
</button>
47+
<UncontrolledTooltip target={refClose}>
48+
Close side panel
49+
</UncontrolledTooltip>
50+
51+
{fullPageLink && (
52+
<>
53+
<Link
54+
className={cx("d-flex", "fs-3", "link-secondary")}
55+
data-cy={
56+
entityType
57+
? `${entityType}-standalone-page-link`
58+
: "standalone-page-link"
59+
}
60+
ref={refExpand}
61+
to={fullPageLink}
62+
>
63+
<ArrowsFullscreen />
64+
<span className="visually-hidden">Open full page</span>
65+
</Link>
66+
<UncontrolledTooltip target={refExpand}>
67+
Open full page
68+
</UncontrolledTooltip>
69+
</>
70+
)}
71+
</div>
72+
);
73+
}

0 commit comments

Comments
 (0)