-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added changelog page to show releases with there changes, these changelog page will show data from generated changelog file from relase script β Closes: #143
- Loading branch information
1 parent
4ee0bf9
commit 5677e81
Showing
21 changed files
with
259 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Metadata } from "next"; | ||
|
||
import { ReleaseCard } from "@/components/changeLogPage/releaseCard"; | ||
import BrandName from "@/components/common/brandName"; | ||
import { Badge } from "@/components/ui/badge"; | ||
import { changelog } from "@/lib/data/changelog"; | ||
import { changeLogSchema } from "@/lib/validations/changeLog"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Changelog", | ||
}; | ||
|
||
export default function Page() { | ||
const changeLogValidation = changeLogSchema.safeParse(changelog); | ||
const changeLogs = changeLogValidation.success | ||
? changeLogValidation.data | ||
: []; | ||
const removedEmptyReleases = changeLogs.filter( | ||
(release) => | ||
release.commits.features.length > 0 || | ||
release.commits.improvements.length > 0 || | ||
release.commits.fixes.length > 0, | ||
); | ||
|
||
return ( | ||
<div> | ||
<div className="sticky top-0 z-50 mb-10 border-b bg-white/70 shadow-sm backdrop-blur"> | ||
<div className=" w-full p-3 lg:container "> | ||
<BrandName className="text-xl lg:text-2xl" /> | ||
</div> | ||
</div> | ||
<main className="lg:container"> | ||
<div className="mb-10 flex flex-col items-center justify-center lg:mb-20"> | ||
<Badge variant="secondary" className="font-medium"> | ||
Changelog | ||
</Badge> | ||
<h1 className="text-xl font-bold lg:text-5xl">Changes and updates</h1> | ||
</div> | ||
<div className="flex items-start justify-center"> | ||
<div className="w-full max-w-[700px]"> | ||
{removedEmptyReleases.map((release) => ( | ||
<ReleaseCard key={release.title} release={release} /> | ||
))} | ||
</div> | ||
</div> | ||
</main> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Link from "next/link"; | ||
import { GitCommitHorizontal } from "lucide-react"; | ||
|
||
import { extractCommitMessage } from "@/lib/github"; | ||
import { Commit } from "@/lib/validations/changeLog"; | ||
|
||
export const CommitItem = ({ commit }: { commit: Commit }) => { | ||
const commitMessage = extractCommitMessage(commit.message); | ||
|
||
return ( | ||
<div className="items-start lg:flex"> | ||
<Link | ||
href={commit.href} | ||
target="_blank" | ||
rel="noopener noreferrer nofollow" | ||
> | ||
<div className="flex items-center pt-1"> | ||
<GitCommitHorizontal size={20} className="mr-2" />{" "} | ||
<span className="mr-2 text-xs">{commit.shorthash}</span> | ||
</div> | ||
</Link> | ||
<span className="text-md first-letter:capitalize">{commitMessage}</span> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Commit, CommitSections } from "@/lib/validations/changeLog"; | ||
import { Badge } from "../ui/badge"; | ||
import { CommitItem } from "./commitItem"; | ||
|
||
const sectionBadgeVariants = { | ||
features: "customSuccess", | ||
improvements: "customInfo", | ||
fixes: "customDanger", | ||
} as const; | ||
|
||
export const CommitSection = ({ | ||
section, | ||
commits, | ||
}: { | ||
section: CommitSections; | ||
commits: Commit[]; | ||
}) => { | ||
return ( | ||
<div> | ||
<Badge | ||
variant={sectionBadgeVariants[section]} | ||
className="mb-3 text-xs font-normal capitalize" | ||
> | ||
{section} | ||
</Badge> | ||
<ul className="grid gap-2 ps-3"> | ||
{commits.map((commit) => ( | ||
<li key={commit.shorthash} className="border-b pb-2"> | ||
<CommitItem commit={commit} /> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { CommitSections, Release } from "@/lib/validations/changeLog"; | ||
import { SectionCard } from "../landingPage/sectionCard"; | ||
import { CommitSection } from "./commitSection"; | ||
|
||
export const commitsSections = [ | ||
"features", | ||
"improvements", | ||
"fixes", | ||
] as CommitSections[]; | ||
|
||
export const ReleaseCard = ({ release }: { release: Release }) => { | ||
const commitSectionsWithCommits = commitsSections.filter( | ||
(section) => release.commits[section].length > 0, | ||
); | ||
|
||
return ( | ||
<SectionCard | ||
stickyHeader | ||
title={`${release.title} - ${release.isoDate}`} | ||
headerClassName="bg-transparent top-12 py-2 lg:py-3" | ||
> | ||
<div className="grid gap-3"> | ||
{commitSectionsWithCommits.map((section) => ( | ||
<CommitSection | ||
key={section} | ||
section={section} | ||
commits={release.commits[section]} | ||
/> | ||
))} | ||
</div> | ||
</SectionCard> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const changelog = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { z } from "zod"; | ||
|
||
export type CommitSections = "features" | "improvements" | "fixes"; | ||
|
||
export const commitSchema = z.object({ | ||
message: z.string(), | ||
shorthash: z.string(), | ||
href: z.string(), | ||
}); | ||
|
||
export type Commit = z.infer<typeof commitSchema>; | ||
|
||
export const releaseSchema = z.object({ | ||
title: z.string(), | ||
tag: z.string(), | ||
isoDate: z.string(), | ||
commits: z.object({ | ||
features: z.array(commitSchema), | ||
improvements: z.array(commitSchema), | ||
fixes: z.array(commitSchema), | ||
}), | ||
}); | ||
|
||
export type Release = z.infer<typeof releaseSchema>; | ||
|
||
export const changeLogSchema = z.array(releaseSchema); |
Oops, something went wrong.