From 6540d31dc9fb35b01ffc73f8cf57c908fc93f51a Mon Sep 17 00:00:00 2001 From: Siamak Mokhtari Date: Tue, 12 Nov 2024 20:51:26 +0330 Subject: [PATCH 1/2] feat: Improved Registy card and Registy page (single) --- .../templates/CodemodPage/AuthorSection.tsx | 7 +- .../templates/CodemodPage/CodemodPageUI.tsx | 105 ++++++++++-------- .../templates/Registry/RegistryCard.tsx | 34 +++--- .../templates/Registry/VerifiedBadge.tsx | 4 +- .../components/templates/Registry/helpers.ts | 10 ++ 5 files changed, 92 insertions(+), 68 deletions(-) diff --git a/apps/frontend/components/templates/CodemodPage/AuthorSection.tsx b/apps/frontend/components/templates/CodemodPage/AuthorSection.tsx index 1051e9f70..34eb0427a 100644 --- a/apps/frontend/components/templates/CodemodPage/AuthorSection.tsx +++ b/apps/frontend/components/templates/CodemodPage/AuthorSection.tsx @@ -12,9 +12,8 @@ export const AuthorSection = ({ className="rounded-sm focus:outline-none focus-visible:ring-[4px] focus-visible:ring-border-light dark:focus-visible:ring-border-dark" prefetch > -
+
by - <> {authorImage?.image.light && ( )} - {author} + + @{author} +
); diff --git a/apps/frontend/components/templates/CodemodPage/CodemodPageUI.tsx b/apps/frontend/components/templates/CodemodPage/CodemodPageUI.tsx index 66e590b8a..a07ca7d42 100644 --- a/apps/frontend/components/templates/CodemodPage/CodemodPageUI.tsx +++ b/apps/frontend/components/templates/CodemodPage/CodemodPageUI.tsx @@ -3,7 +3,6 @@ import Icon from "@/components/shared/Icon"; import Section from "@/components/shared/Section"; import Snippet from "@/components/shared/Snippet"; import Tag from "@/components/shared/Tag"; -import { AuthorSection } from "@/components/templates/CodemodPage/AuthorSection"; import { VCCodeShift } from "@/components/templates/CodemodPage/VCCodeShift"; import { getCodemodCard } from "@/components/templates/CodemodPage/buildYourCodemodCard"; import { getFrameworkCard } from "@/components/templates/CodemodPage/getFrameworkCard"; @@ -17,10 +16,12 @@ import { prop, uniqBy } from "ramda"; import type { ReactNode } from "react"; import VerifiedBadge from "../Registry/VerifiedBadge"; import { + extractRepoPath, getAutomationFrameworkTitles, getFilterIcon, getFilterSection, } from "../Registry/helpers"; +import { AuthorSection } from "./AuthorSection"; import InfoTooltip from "./parts/InfoTooltip"; export interface CodemodPageProps { @@ -72,6 +73,12 @@ export default function CodemodPageUI({ data, description }: CodemodPageProps) { ); const currentVersion = data?.versions[0]; + const totalRunsValue = data?.totalRuns ?? 0; + + const totalRuns = + totalRunsValue < 100 ? "< 100 runs" : totalRunsValue.toLocaleString(); + + const sourceRepo = extractRepoPath(currentVersion?.sourceRepo || ""); return (
@@ -88,7 +95,47 @@ export default function CodemodPageUI({ data, description }: CodemodPageProps) {
-
+
+ {data?.automationName && ( +

{unslugify(data?.automationName)}

+ )} +
+ +
+ {currentVersion?.version} + + {currentVersion?.updatedAt && ( + <> + + · + + + Last update{" "} + {new Date(currentVersion?.updatedAt).toLocaleString("en-us", { + month: "short", + day: "numeric", + year: "numeric", + })} + + + )} + + {/* Attribution */} + {data?.author && ( + <> + + · + + + + )} +
+ +
{data?.verified && ( @@ -108,48 +155,10 @@ export default function CodemodPageUI({ data, description }: CodemodPageProps) { )}
- {/* Attribution */} - {data?.author && ( - - )}
-
- {data?.automationName && ( -

{unslugify(data?.automationName)}

- )} -
+ {/*
*/} -
- {/*{frameworks.length ? (*/} - {/* <>*/} - {/* */} - {/* */} - {/* */} - {/*) : null}*/} - {currentVersion?.updatedAt && ( - - )} -
{description ? (
{description} @@ -157,10 +166,9 @@ export default function CodemodPageUI({ data, description }: CodemodPageProps) { ) : null}
{/* Sidebar */} -