|
1 | 1 | import { ArrowUturnLeftIcon, BookOpenIcon } from "@heroicons/react/20/solid";
|
2 | 2 | import { type MetaFunction, Outlet, useLocation, useNavigate, useParams } from "@remix-run/react";
|
3 | 3 | import { type LoaderFunctionArgs } from "@remix-run/server-runtime";
|
| 4 | +import { CogIcon, GitBranchIcon } from "lucide-react"; |
4 | 5 | import { useEffect } from "react";
|
5 | 6 | import { typedjson, useTypedLoaderData } from "remix-typedjson";
|
6 | 7 | import { z } from "zod";
|
7 | 8 | import { PromoteIcon } from "~/assets/icons/PromoteIcon";
|
8 | 9 | import { DeploymentsNone, DeploymentsNoneDev } from "~/components/BlankStatePanels";
|
| 10 | +import { OctoKitty } from "~/components/GitHubLoginButton"; |
9 | 11 | import { GitMetadata } from "~/components/GitMetadata";
|
10 | 12 | import { RuntimeIcon } from "~/components/RuntimeIcon";
|
11 | 13 | import { UserAvatar } from "~/components/UserProfilePhoto";
|
@@ -50,7 +52,13 @@ import {
|
50 | 52 | } from "~/presenters/v3/DeploymentListPresenter.server";
|
51 | 53 | import { requireUserId } from "~/services/session.server";
|
52 | 54 | import { titleCase } from "~/utils";
|
53 |
| -import { EnvironmentParamSchema, docsPath, v3DeploymentPath } from "~/utils/pathBuilder"; |
| 55 | +import { cn } from "~/utils/cn"; |
| 56 | +import { |
| 57 | + EnvironmentParamSchema, |
| 58 | + docsPath, |
| 59 | + v3DeploymentPath, |
| 60 | + v3ProjectSettingsPath, |
| 61 | +} from "~/utils/pathBuilder"; |
54 | 62 | import { createSearchParams } from "~/utils/searchParams";
|
55 | 63 | import { compareDeploymentVersions } from "~/v3/utils/deploymentVersions";
|
56 | 64 |
|
@@ -122,8 +130,14 @@ export default function Page() {
|
122 | 130 | const organization = useOrganization();
|
123 | 131 | const project = useProject();
|
124 | 132 | const environment = useEnvironment();
|
125 |
| - const { deployments, currentPage, totalPages, selectedDeployment } = |
126 |
| - useTypedLoaderData<typeof loader>(); |
| 133 | + const { |
| 134 | + deployments, |
| 135 | + currentPage, |
| 136 | + totalPages, |
| 137 | + selectedDeployment, |
| 138 | + connectedGithubRepository, |
| 139 | + environmentGitHubBranch, |
| 140 | + } = useTypedLoaderData<typeof loader>(); |
127 | 141 | const hasDeployments = totalPages > 0;
|
128 | 142 |
|
129 | 143 | const { deploymentParam } = useParams();
|
@@ -160,8 +174,8 @@ export default function Page() {
|
160 | 174 | <ResizablePanelGroup orientation="horizontal" className="h-full max-h-full">
|
161 | 175 | <ResizablePanel id="deployments-main" min="100px" className="max-h-full">
|
162 | 176 | {hasDeployments ? (
|
163 |
| - <div className="grid max-h-full grid-rows-[1fr_auto]"> |
164 |
| - <Table containerClassName="border-t-0"> |
| 177 | + <div className="flex h-full max-h-full flex-col"> |
| 178 | + <Table containerClassName="border-t-0 grow"> |
165 | 179 | <TableHeader>
|
166 | 180 | <TableRow>
|
167 | 181 | <TableHeaderCell>Deploy</TableHeaderCell>
|
@@ -286,11 +300,38 @@ export default function Page() {
|
286 | 300 | )}
|
287 | 301 | </TableBody>
|
288 | 302 | </Table>
|
289 |
| - {totalPages > 1 && ( |
290 |
| - <div className="-mt-px flex justify-end border-t border-grid-dimmed py-2 pr-2"> |
291 |
| - <PaginationControls currentPage={currentPage} totalPages={totalPages} /> |
292 |
| - </div> |
293 |
| - )} |
| 303 | + <div |
| 304 | + className={cn( |
| 305 | + "-mt-px flex flex-wrap justify-end gap-2 border-t border-grid-dimmed px-3 pb-[7px] pt-[6px]", |
| 306 | + connectedGithubRepository && environmentGitHubBranch && "justify-between" |
| 307 | + )} |
| 308 | + > |
| 309 | + {connectedGithubRepository && environmentGitHubBranch && ( |
| 310 | + <div className="flex flex-nowrap items-center gap-2 whitespace-nowrap text-sm"> |
| 311 | + <OctoKitty className="size-4" /> |
| 312 | + Automatically triggered by pushes to{" "} |
| 313 | + <div className="flex max-w-32 items-center gap-1 truncate rounded bg-grid-dimmed px-1 font-mono"> |
| 314 | + <GitBranchIcon className="size-3 shrink-0" /> |
| 315 | + <span className="max-w-28 truncate">{environmentGitHubBranch}</span> |
| 316 | + </div>{" "} |
| 317 | + in |
| 318 | + <a |
| 319 | + href={connectedGithubRepository.repository.htmlUrl} |
| 320 | + target="_blank" |
| 321 | + rel="noreferrer noopener" |
| 322 | + className="max-w-52 truncate text-sm text-text-dimmed underline transition-colors hover:text-text-bright" |
| 323 | + > |
| 324 | + {connectedGithubRepository.repository.fullName} |
| 325 | + </a> |
| 326 | + <LinkButton |
| 327 | + variant="minimal/small" |
| 328 | + LeadingIcon={CogIcon} |
| 329 | + to={v3ProjectSettingsPath(organization, project, environment)} |
| 330 | + /> |
| 331 | + </div> |
| 332 | + )} |
| 333 | + <PaginationControls currentPage={currentPage} totalPages={totalPages} /> |
| 334 | + </div> |
294 | 335 | </div>
|
295 | 336 | ) : environment.type === "DEVELOPMENT" ? (
|
296 | 337 | <MainCenteredContainer className="max-w-md">
|
|
0 commit comments