Skip to content

Commit 992f5e1

Browse files
authored
Merge pull request #30 from diggerhq/feat/branch-project
Add branch to project screen
2 parents b9c9b34 + ead6d5e commit 992f5e1

File tree

5 files changed

+10
-317
lines changed

5 files changed

+10
-317
lines changed

src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/project/[projectSlug]/(specific-project-pages)/layout.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
44
import { getProjectTitleById, getSlimProjectBySlug } from "@/data/user/projects";
55
import { isLocalEnvironment } from "@/lib/utils";
66
import { projectSlugParamSchema } from "@/utils/zod-schemas/params";
7-
import { AlertCircleIcon } from "lucide-react";
7+
import { AlertCircleIcon, GitBranch } from "lucide-react";
88
import { Suspense } from "react";
99

1010

11-
async function ProjectPageHeading({ projectId }: { projectId: string }) {
11+
async function ProjectPageHeading({ projectId, branch }: { projectId: string, branch: string | null }) {
1212
const projectTitle = await getProjectTitleById(projectId);
1313
return (
1414
<PageHeading
1515
title={projectTitle}
16-
subTitle="Manage your project here"
16+
subTitle={<p className="flex items-center"><GitBranch /> {branch || 'main'}</p>}
1717
/>
1818
);
1919
}
@@ -54,7 +54,7 @@ export default async function ProjectPagesLayout({ params, children }: { params:
5454
)}
5555

5656
<Suspense>
57-
<ProjectPageHeading projectId={project.id} />
57+
<ProjectPageHeading projectId={project.id} branch={project.branch} />
5858
</Suspense>
5959
<Suspense>
6060
<TabsNavigationV2 tabs={tabs} />

src/components/CreateProjectForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const createProjectFormSchema = z.object({
2727
name: z.string().min(1, "Project name is required"),
2828
repository: z.number().int().positive("Please select a repository"),
2929
terraformDir: z.string().min(1, "Terraform working directory is required"),
30-
branch: z.string().optional(),
30+
branch: z.string().min(1, "Branch is required").default("main"),
3131
labels: z.array(z.string()),
3232
managedState: z.boolean().default(true),
3333
teamId: z.number().int().positive().nullable(),

src/components/PageHeading/PageHeading.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Link from 'next/link';
44

55
type PageHeadingProps = {
66
title: string;
7-
subTitle?: string;
7+
subTitle?: React.ReactNode;
88
actions?: React.ReactNode;
99
titleHref?: string;
1010
titleClassName?: string;

src/data/user/projects.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const getSlimProjectBySlug = async (projectSlug: string) => {
2929
const supabaseClient = createSupabaseUserServerComponentClient();
3030
const { data, error } = await supabaseClient
3131
.from("projects")
32-
.select("id, slug, name, organization_id")
32+
.select("id, slug, name, organization_id, branch")
3333
.eq("slug", projectSlug)
3434
.single();
3535
if (error) {

0 commit comments

Comments
 (0)