Skip to content

Commit 72ed777

Browse files
committed
Refactor to only have history sidebar
1 parent e7d633d commit 72ed777

File tree

4 files changed

+181
-200
lines changed

4 files changed

+181
-200
lines changed

site/src/AppRouter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ export const AppRouter: FC = () => {
369369

370370
{/* In order for the 404 page to work properly the routes that start with
371371
top level parameter must be fully qualified. */}
372+
<Route path="/:username/:workspace" element={<WorkspacePage />} />
372373
<Route
373374
path="/:username/:workspace/builds/:buildNumber"
374375
element={<WorkspaceBuildPage />}
@@ -407,7 +408,6 @@ export const AppRouter: FC = () => {
407408
</Route>
408409

409410
{/* Pages that don't have the dashboard layout */}
410-
<Route path="/:username/:workspace" element={<WorkspacePage />} />
411411
<Route
412412
path="/templates/:template/versions/:version/edit"
413413
element={<TemplateVersionEditorPage />}

site/src/components/Resources/Resources.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { WorkspaceAgent, WorkspaceResource } from "api/typesGenerated";
55
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow";
66
import { Stack } from "../Stack/Stack";
77
import { ResourceCard } from "./ResourceCard";
8+
import { useTheme } from "@mui/material/styles";
89

910
const countAgents = (resource: WorkspaceResource) => {
1011
return resource.agents ? resource.agents.length : 0;
@@ -19,6 +20,7 @@ export const Resources: FC<React.PropsWithChildren<ResourcesProps>> = ({
1920
resources,
2021
agentRow,
2122
}) => {
23+
const theme = useTheme();
2224
const [shouldDisplayHideResources, setShouldDisplayHideResources] =
2325
useState(false);
2426
const displayResources = shouldDisplayHideResources
@@ -30,7 +32,11 @@ export const Resources: FC<React.PropsWithChildren<ResourcesProps>> = ({
3032
const hasHideResources = resources.some((r) => r.hide);
3133

3234
return (
33-
<Stack direction="column" spacing={0}>
35+
<Stack
36+
direction="column"
37+
spacing={0}
38+
css={{ background: theme.palette.background.default }}
39+
>
3440
{displayResources.map((resource) => (
3541
<ResourceCard
3642
key={resource.id}

site/src/pages/WorkspacePage/HistorySidebarContent.tsx renamed to site/src/pages/WorkspacePage/HistorySidebar.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { infiniteWorkspaceBuilds } from "api/queries/workspaceBuilds";
22
import { Workspace } from "api/typesGenerated";
33
import {
4+
Sidebar,
45
SidebarCaption,
56
SidebarItem,
67
SidebarLink,
@@ -11,19 +12,15 @@ import {
1112
} from "components/WorkspaceBuild/WorkspaceBuildData";
1213
import { useInfiniteQuery } from "react-query";
1314

14-
export const HistorySidebarContent = ({
15-
workspace,
16-
}: {
17-
workspace: Workspace;
18-
}) => {
15+
export const HistorySidebar = ({ workspace }: { workspace: Workspace }) => {
1916
const buildsQuery = useInfiniteQuery({
2017
...infiniteWorkspaceBuilds(workspace?.id ?? ""),
2118
enabled: workspace !== undefined,
2219
});
2320
const builds = buildsQuery.data?.pages.flat();
2421

2522
return (
26-
<>
23+
<Sidebar>
2724
<SidebarCaption>History</SidebarCaption>
2825
{builds
2926
? builds.map((build) => (
@@ -39,6 +36,6 @@ export const HistorySidebarContent = ({
3936
<WorkspaceBuildDataSkeleton />
4037
</SidebarItem>
4138
))}
42-
</>
39+
</Sidebar>
4340
);
4441
};

0 commit comments

Comments
 (0)