Skip to content

Commit dda60f6

Browse files
feat(console): UI improvements (#172)
* feat(console): cosmetic changes, improved visuals * feat(console): collapsed side menu * chore(console): no sorting of variables * fix(console): out of bounds horizontal scrolling for request details properties * fix(console): hide copy project ID if not in project conext * remove overview page * fix formatting
1 parent 2222741 commit dda60f6

8 files changed

Lines changed: 144 additions & 63 deletions

File tree

apps/console/src/app/components/layout/LayoutWrapper.tsx

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { Breadcrumb, Layout, theme } from "antd";
1+
import { Breadcrumb, Col, Layout, Row, theme } from "antd";
22
import { SideNavigation } from "./SideNavigation";
33
import styled from "@emotion/styled";
44
import { Header } from "./Header";
55
import { useBreadcrumbItems } from "../../lib/hooks/useBreadcrumbItems";
6-
import { colors } from "../../lib/theme/colors";
6+
import { ProjectCopy } from "../projects/ProjectCopy";
7+
import { motion } from "framer-motion";
8+
import { useLocation } from "react-router-dom";
9+
import { useCurrentProject } from "../../lib/hooks/useCurrentProject";
710

811
const StyledContent = styled(Layout.Content)`
912
padding: 18px;
10-
max-width: 1280px;
11-
margin-inline: auto;
13+
margin-inline: 24px;
1214
1315
max-height: calc(100vh - 64px);
1416
overflow-y: auto;
@@ -36,7 +38,9 @@ export const LayoutWrapper = ({
3638
withBreadcrumbs = true,
3739
}: Props) => {
3840
const { token } = theme.useToken();
41+
const { project } = useCurrentProject();
3942
const breadcrumbItems = useBreadcrumbItems();
43+
const location = useLocation();
4044

4145
return (
4246
<Layout
@@ -49,16 +53,36 @@ export const LayoutWrapper = ({
4953
{withHeader && <Header />}
5054
<div style={{ display: "flex", flexDirection: "row", height: "100%" }}>
5155
{withSideNav && <SideNavigation />}
56+
5257
<StyledContent>
53-
{withBreadcrumbs && (
54-
<Breadcrumb
55-
items={breadcrumbItems}
56-
style={{
57-
marginBottom: token.marginLG,
58-
}}
59-
/>
60-
)}
61-
{children}
58+
<Row gutter={[24, 24]}>
59+
<Col span={18}>
60+
{withBreadcrumbs && (
61+
<Breadcrumb
62+
items={breadcrumbItems}
63+
style={{
64+
marginBottom: token.marginLG,
65+
}}
66+
/>
67+
)}
68+
</Col>
69+
<Col
70+
span={6}
71+
style={{ display: "flex", justifyContent: "flex-end" }}
72+
>
73+
{project && <ProjectCopy />}
74+
</Col>
75+
</Row>
76+
77+
<motion.div
78+
key={location.pathname}
79+
initial={{ y: 10, opacity: 0 }}
80+
animate={{ y: 0, opacity: 1 }}
81+
exit={{ y: -10, opacity: 0 }}
82+
transition={{ duration: 0.1 }}
83+
>
84+
{children}
85+
</motion.div>
6286
</StyledContent>
6387
</div>
6488
</Layout>
Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1-
import {
2-
BoltIcon,
3-
ChartBarIcon,
4-
QueueListIcon,
5-
ServerStackIcon,
6-
DocumentMagnifyingGlassIcon,
7-
} from "@heroicons/react/24/solid";
1+
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
82
import { Menu } from "antd";
9-
import { useMemo } from "react";
3+
import { useMemo, useState } from "react";
104
import { useNavigate, useLocation } from "react-router-dom";
115
import styled from "@emotion/styled";
126

13-
import { colors } from "../../lib/theme/colors";
147
import { useCurrentProject } from "../../lib/hooks/useCurrentProject";
15-
import { ProjectCopy } from "../projects/ProjectCopy";
8+
import {
9+
AcademicCapIcon,
10+
CubeIcon,
11+
ServerIcon,
12+
} from "@heroicons/react/24/outline";
1613

1714
const topMenuItems = [
1815
{
1916
key: "prompts",
2017
label: "Prompts",
21-
icon: <BoltIcon height={18} />,
18+
icon: <CubeIcon height={18} />,
2219
},
2320
{
2421
key: "requests",
2522
label: "Requests",
26-
icon: <QueueListIcon height={18} width={18} />,
23+
icon: <ChatBubbleBottomCenterIcon height={18} width={18} />,
2724
},
2825
{
2926
key: "environments",
3027
label: "Environments",
31-
icon: <ServerStackIcon height={18} />,
28+
icon: <ServerIcon height={18} />,
3229
},
3330
];
3431

@@ -39,7 +36,6 @@ const BaseMenu = styled(Menu)`
3936
border-right: 1px solid red;
4037
`;
4138
const SidebarContainer = styled.div`
42-
border-inline-end: 1px solid ${colors.neutral["800"]};
4339
height: 100%;
4440
4541
display: flex;
@@ -51,22 +47,11 @@ const TopMenu = styled(BaseMenu)`
5147
flex: 100%;
5248
`;
5349

54-
const DocsMenu = () => {
55-
return (
56-
<BaseMenu>
57-
<Menu.Item key="docs" icon={<DocumentMagnifyingGlassIcon height={18} />}>
58-
<a href="https://docs.pezzo.ai/" target="_blank">
59-
<span>Read Docs</span>
60-
</a>
61-
</Menu.Item>
62-
</BaseMenu>
63-
);
64-
};
65-
6650
export const SideNavigation = () => {
6751
const { project } = useCurrentProject();
6852
const location = useLocation();
6953
const navigate = useNavigate();
54+
const [isCollapsed] = useState(true);
7055

7156
const handleTopMenuClick = (item) => {
7257
navigate(`/projects/${project.id}/${item.key}`);
@@ -86,13 +71,21 @@ export const SideNavigation = () => {
8671
return (
8772
<SidebarContainer>
8873
<TopMenu
74+
mode="inline"
8975
onClick={handleTopMenuClick}
9076
defaultSelectedKeys={["prompts"]}
9177
selectedKeys={selectedKeys.length ? selectedKeys : ["prompts"]}
9278
items={topMenuItems}
79+
inlineCollapsed={isCollapsed}
9380
/>
94-
<ProjectCopy />
95-
<DocsMenu />
81+
{/* Bottom Menu */}
82+
<BaseMenu inlineCollapsed={isCollapsed} mode="inline">
83+
<Menu.Item key="docs" icon={<AcademicCapIcon height={18} />}>
84+
<a href="https://docs.pezzo.ai/" target="_blank" rel="noreferrer">
85+
<span>Docs</span>
86+
</a>
87+
</Menu.Item>
88+
</BaseMenu>
9689
</SidebarContainer>
9790
);
9891
};

apps/console/src/app/components/prompts/PromptListItem.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { ArrowRightCircleIcon } from "@heroicons/react/24/outline";
1+
import { ArrowRightCircleIcon, CubeIcon } from "@heroicons/react/24/outline";
22
import { Card, Col, Row, Typography } from "antd";
33
import { css } from "@emotion/css";
4-
import { BoltIcon } from "@heroicons/react/24/solid";
54
import { colorPrimary } from "../../lib/theme/ant-theme";
65

76
interface Props {
@@ -21,7 +20,7 @@ export const PromptListItem = ({ name, onClick }: Props) => {
2120
padding: 4px;
2221
`}
2322
>
24-
<BoltIcon height={"80%"} width={"80%"} color={colorPrimary} />
23+
<CubeIcon height={"80%"} width={"80%"} color={colorPrimary} />
2524
</div>
2625
</Col>
2726
<Col flex="auto">

apps/console/src/app/components/requests/RequestDetails.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,6 @@ export const RequestDetails = (props: Props) => {
103103
title: "Duration",
104104
description: ms(props.calculated.duration),
105105
},
106-
{
107-
title: "Properties",
108-
description: props.properties ? (
109-
<Card size="small">
110-
<pre>{JSON.stringify(props.properties, null, 2)}</pre>
111-
</Card>
112-
) : (
113-
<Typography.Text italic type="secondary">
114-
No properties specified
115-
</Typography.Text>
116-
),
117-
},
118106
{
119107
title: "Display mode",
120108
description: (
@@ -158,6 +146,20 @@ export const RequestDetails = (props: Props) => {
158146
)}
159147
/>
160148
<br />
149+
<Space direction="vertical" style={{ width: "100%" }}>
150+
<Typography.Text strong>Properties</Typography.Text>
151+
{props.properties ? (
152+
<Card size="small" style={{ maxWidth: "100%" }}>
153+
<pre>{JSON.stringify(props.properties, null, 2)}</pre>
154+
</Card>
155+
) : (
156+
<Typography.Text italic type="secondary">
157+
No properties specified
158+
</Typography.Text>
159+
)}
160+
</Space>
161+
<br />
162+
<br />
161163
{selectedMode === "json" && (
162164
<RequestResponseViewJsonView request={request} response={response} />
163165
)}

apps/console/src/app/lib/utils/find-variables.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,5 @@ export function findVariables(text: string): string[] {
55
const foundVariables = matches
66
? matches.map((match) => match.replace(/[{}]/g, ""))
77
: [];
8-
return Array.from(new Set(foundVariables)).sort((a, b) =>
9-
a.toLowerCase() > b.toLowerCase() ? 1 : -1
10-
);
8+
return Array.from(new Set(foundVariables));
119
}

apps/console/src/app/pages/requests/RequestsPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ export const RequestsPage = () => {
118118
return (
119119
<div>
120120
<Space direction="vertical" style={{ width: "100%" }}>
121-
<Typography.Title level={4}>Requests</Typography.Title>
122-
<Divider style={{ margin: 0 }} />
121+
<Typography.Title level={2}>Requests</Typography.Title>
123122
<RequestFilters requests={tableData} />
124123
<Drawer
125124
title="Request Details"

package-lock.json

Lines changed: 67 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"cross-fetch": "^4.0.0",
6060
"date-fns": "^2.30.0",
6161
"dotenv": "^16.1.4",
62+
"framer-motion": "^10.16.0",
6263
"googleapis": "^118.0.0",
6364
"graphql": "^16.7.1",
6465
"graphql-request": "^6.0.0",

0 commit comments

Comments
 (0)