Skip to content

Commit

Permalink
🔥 fully removed old section list logic #66
Browse files Browse the repository at this point in the history
  • Loading branch information
damien-schneider authored Dec 15, 2024
1 parent 62b793a commit 9f3eacb
Show file tree
Hide file tree
Showing 51 changed files with 124 additions and 757 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import ComingSoonCard from "#/src/components/coming-soon";
import HeaderComponent from "#/src/components/component-wrapper/header-component";
import InspirationComponentFooter from "#/src/components/component-wrapper/inspiration-component-footer";
import VariantTabs from "#/src/components/component-wrapper/variant-tabs";
import type {
NewCategoryType,
SectionType,
} from "@cuicui/ui/lib/types/component";
import type { CategoryType, SectionType } from "@cuicui/ui/lib/types/component";
import GithubEditButton from "#/src/components/component-wrapper/github-edit-button";

export default async function MultipleComponentCategory({
category,
sectionSlug,
}: Readonly<{ category: NewCategoryType; sectionSlug: SectionType["slug"] }>) {
if (category.meta?.comingSoonCategory) {
}: Readonly<{
category: CategoryType;
sectionSlug: SectionType["slug"];
}>) {
if (category.meta?.isComingSoon) {
return <ComingSoonCard />;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/app/(site)/[section]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default async function Page({ params }: Props) {
>
<MainMenuCardContent
slugCategory={category.slug}
isComingSoon={category.meta.comingSoonCategory}
isComingSoon={category.meta.isComingSoon}
/>
</MainMenusGradientCard>
</Link>
Expand Down
126 changes: 0 additions & 126 deletions apps/website/src/app/api/get-components/get-components.utils.ts

This file was deleted.

61 changes: 0 additions & 61 deletions apps/website/src/app/api/get-components/route.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/website/src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function getComponentsSitemap(): MetadataRoute.Sitemap {
const componentSitemap: MetadataRoute.Sitemap = [];
sectionList.flatMap((section) => {
for (const category of section.categories) {
if (category.meta.comingSoonCategory) {
if (category.meta.isComingSoon) {
return;
}
if (section.slug && category.slug) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "./full-component.css";

import { ComponentWrapper } from "#/src/components/component-wrapper/component-wrapper";
import type {
NewComponentType,
NewVariantType,
ComponentType,
VariantType,
} from "@cuicui/ui/lib/types/component";
import CodeHighlighter from "#/src/ui/code-highlighter";
import {} from "#/src/ui/shadcn/resizable";
Expand All @@ -27,8 +27,8 @@ export default async function ComponentTabRenderer({
component,
variant,
}: {
component: NewComponentType;
variant: NewVariantType;
component: ComponentType;
variant: VariantType;
}) {
const variantCode = await readFileContent(variant.pathname);
if (!variantCode) {
Expand Down Expand Up @@ -127,7 +127,7 @@ export default async function ComponentTabRenderer({
const CodeTab = ({
code,
component,
}: { code: string; component: NewComponentType }) => {
}: { code: string; component: ComponentType }) => {
return (
<>
<ScrollArea
Expand Down Expand Up @@ -155,8 +155,8 @@ const PreviewTab = ({
component,
variant,
}: {
component: NewComponentType;
variant: NewVariantType;
component: ComponentType;
variant: VariantType;
}) => {
if (component.meta.isResizable) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import * as Tabs from "@radix-ui/react-tabs";
import ComponentTabRenderer from "#/src/components/component-wrapper/component-tab-renderer";

import { cn } from "#/src/utils/cn";
import type { NewComponentType } from "@cuicui/ui/lib/types/component";
import type { ComponentType } from "@cuicui/ui/lib/types/component";

export type TabType = "preview" | "code-component" | "code-preview";

export default function VariantTabs({
component,
}: {
component: NewComponentType;
component: ComponentType;
}) {
if (!component.variants || component.variants.length === 0) {
return (
Expand Down
26 changes: 4 additions & 22 deletions apps/website/src/components/navigation/navigation-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ import {
SectionWrapper,
} from "#/src/components/navigation/navigation-item";
import { sectionList } from "@/section-list";
import type {
NewCategoryType,
SingleComponentCategoryType,
} from "@cuicui/ui/lib/types/component";
import type { CategoryType } from "@cuicui/ui/lib/types/component";
import { cn } from "#/src/utils/cn";

export default function NavigationMenu({
isMobile,
className,
}: Readonly<{ isMobile?: boolean; className?: string }>) {
function getCategoryTagMultipleComponentCategory(category: NewCategoryType) {
function getCategoryTag(category: CategoryType) {
const isNew =
differenceInDays(new Date(), category.meta.releaseDateCategory ?? 0) < 21;
if (category.meta.comingSoonCategory) {
if (category.meta.isComingSoon) {
return "Coming Soon";
}
if (isNew) {
Expand All @@ -27,21 +24,6 @@ export default function NavigationMenu({
return null;
}

function getCategoryTagSingleComponentCategory(
category: SingleComponentCategoryType,
) {
const isNew =
differenceInDays(new Date(), category.releaseDateCategory ?? 0) < 21;
if (category.comingSoonCategory) {
return "Coming Soon";
}
if (isNew) {
return "New";
}

return null;
}

function getClosestUpdatedComponentDate(dateList: (Date | null)[]) {
return dateList.reduce((acc, date) => {
if (!date) {
Expand Down Expand Up @@ -76,7 +58,7 @@ export default function NavigationMenu({
href={`/${section.slug}/${category.slug}`}
isMobile={isMobile}
name={category.meta.name}
tag={getCategoryTagMultipleComponentCategory(category)}
tag={getCategoryTag(category)}
target="sameWindow"
/>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { useRouter } from "next/navigation";
import type {
NewSectionType,
NewCategoryType,
} from "@cuicui/ui/lib/types/component";
import type { SectionType, CategoryType } from "@cuicui/ui/lib/types/component";
import { CommandGroup, CommandItem } from "#/src/ui/shadcn/command";
import Link from "next/link";

export function SearchGroupComponentSection({
closeSearchMenu,
section,
}: Readonly<{ closeSearchMenu: () => void; section: NewSectionType }>) {
}: Readonly<{ closeSearchMenu: () => void; section: SectionType }>) {
const router = useRouter();

return (
Expand All @@ -31,7 +28,7 @@ const MultipleComponentSearchItems = ({
sectionSlug,
closeSearchMenu,
}: {
category: NewCategoryType;
category: CategoryType;
sectionSlug: string;
closeSearchMenu: () => void;
}) => {
Expand Down
7 changes: 2 additions & 5 deletions packages/internal-cli/templates/category.template.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import type { CategoryType } from "@/lib/types/component";
import { __CATEGORY_NAME__Icon } from "lucide-react";

// Import your components here
// e.g., import MyComponent from "./my-component/my-component";

export const __CATEGORY_NAME__Category: CategoryType = {
export const __CATEGORY_NAME__Category = {
slug: "__CATEGORY_NAME__",
name: "__CATEGORY_NAME__",
description: "__CATEGORY_NAME__ components",
releaseDateCategory: new Date(),
icon: __CATEGORY_NAME__Icon,
// icon: __CATEGORY_NAME__Icon,
componentList: [
// Add components here
],
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/cuicui/application-ui/action-menu/category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const actionMenuCategory: CategoryMetaType = {
description: "Create action menus to display actions in a dropdown",
releaseDateCategory: new Date("2024-07-29"),
icon: StretchHorizontalIcon,
comingSoonCategory: true,
isComingSoon: true,
};

export default actionMenuCategory;
Loading

0 comments on commit 9f3eacb

Please sign in to comment.