From e46cf13e5da53e53b58825809ea741a82501347f Mon Sep 17 00:00:00 2001 From: Daniel Berger Date: Mon, 26 Feb 2024 22:31:11 -0500 Subject: [PATCH] make all files kabob case and organize components --- src/app/(routes)/analytics/page.tsx | 11 ++++++ src/app/{ => (routes)}/blog/[slug]/page.tsx | 0 src/app/(routes)/blog/page.tsx | 11 ++++++ src/app/(routes)/projects/page.tsx | 11 ++++++ src/app/layout.tsx | 16 ++++---- src/app/page.tsx | 6 +-- src/app/robots.ts | 12 ++++++ src/app/sitemap.ts | 16 ++++++++ src/components/Footer.tsx | 21 ++++------ src/components/Header.tsx | 12 ++---- ...sDashboard.tsx => analytics-dashboard.tsx} | 0 .../{Combobox.tsx => combo-box.tsx} | 0 .../{ImageSlider.tsx => image-slider.tsx} | 31 +-------------- .../mobile-navigation.tsx} | 24 ++++-------- .../navigation.tsx} | 13 +++---- .../user-navigation.tsx} | 8 ++-- .../pages/analytics.tsx} | 6 +-- .../page.tsx => components/pages/blogs.tsx} | 10 +---- src/components/{Body.tsx => pages/home.tsx} | 12 +++--- src/components/pages/index.ts | 4 ++ .../pages/projects.tsx} | 4 +- .../{ProjectCard.tsx => project-card.tsx} | 14 +++---- src/configs/app-metadata.ts | 31 +++++++++++++++ src/configs/index.ts | 1 + src/data/dummy.js | 38 ------------------- src/hooks/index.ts | 2 +- src/hooks/{useProjects.ts => use-projects.ts} | 0 src/state/index.ts | 2 +- ...seProjectStore.ts => use-project-store.ts} | 0 29 files changed, 156 insertions(+), 160 deletions(-) create mode 100644 src/app/(routes)/analytics/page.tsx rename src/app/{ => (routes)}/blog/[slug]/page.tsx (100%) create mode 100644 src/app/(routes)/blog/page.tsx create mode 100644 src/app/(routes)/projects/page.tsx create mode 100644 src/app/robots.ts create mode 100644 src/app/sitemap.ts rename src/components/{AnalyticsDashboard.tsx => analytics-dashboard.tsx} (100%) rename src/components/{Combobox.tsx => combo-box.tsx} (100%) rename src/components/{ImageSlider.tsx => image-slider.tsx} (83%) rename src/components/{MobileNavigation.tsx => navigation/mobile-navigation.tsx} (63%) rename src/components/{Navigation.tsx => navigation/navigation.tsx} (95%) rename src/components/{UserNav.tsx => navigation/user-navigation.tsx} (92%) rename src/{app/analytics/page.tsx => components/pages/analytics.tsx} (94%) rename src/{app/blog/page.tsx => components/pages/blogs.tsx} (82%) rename src/components/{Body.tsx => pages/home.tsx} (95%) create mode 100644 src/components/pages/index.ts rename src/{app/projects/page.tsx => components/pages/projects.tsx} (96%) rename src/components/{ProjectCard.tsx => project-card.tsx} (94%) create mode 100644 src/configs/app-metadata.ts create mode 100644 src/configs/index.ts delete mode 100644 src/data/dummy.js rename src/hooks/{useProjects.ts => use-projects.ts} (100%) rename src/state/{useProjectStore.ts => use-project-store.ts} (100%) diff --git a/src/app/(routes)/analytics/page.tsx b/src/app/(routes)/analytics/page.tsx new file mode 100644 index 0000000..43fc5dd --- /dev/null +++ b/src/app/(routes)/analytics/page.tsx @@ -0,0 +1,11 @@ +import { Analytics } from '@/components/pages' +import { appMetadata } from '@/configs' +import { Metadata } from 'next' + +export const metadata: Metadata = { + ...appMetadata.analytics, +} + +export default function AnalyticsPage() { + return +} diff --git a/src/app/blog/[slug]/page.tsx b/src/app/(routes)/blog/[slug]/page.tsx similarity index 100% rename from src/app/blog/[slug]/page.tsx rename to src/app/(routes)/blog/[slug]/page.tsx diff --git a/src/app/(routes)/blog/page.tsx b/src/app/(routes)/blog/page.tsx new file mode 100644 index 0000000..6f2c61d --- /dev/null +++ b/src/app/(routes)/blog/page.tsx @@ -0,0 +1,11 @@ +import { Blogs } from '@/components/pages' +import { appMetadata } from '@/configs' +import { Metadata } from 'next' + +export const metadata: Metadata = { + ...appMetadata.blogs, +} + +export default async function BlogsPage() { + return +} diff --git a/src/app/(routes)/projects/page.tsx b/src/app/(routes)/projects/page.tsx new file mode 100644 index 0000000..285fd3b --- /dev/null +++ b/src/app/(routes)/projects/page.tsx @@ -0,0 +1,11 @@ +import { Projects } from '@/components/pages' +import { appMetadata } from '@/configs' +import { Metadata } from 'next' + +export const metadata: Metadata = { + ...appMetadata.projects, +} + +export default function ProjectsPage() { + return +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index ce697bd..4bb1bae 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,6 +1,7 @@ -import Footer from '@/components/Footer' -import { Header } from '@/components/Header' +import { Footer } from '@/components/footer' +import { Header } from '@/components/header' import { ThemeProvider } from '@/components/theme/theme-provider' +import { appMetadata } from '@/configs' import { cn } from '@/lib/utils' import type { Metadata } from 'next' import { Space_Grotesk } from 'next/font/google' @@ -9,8 +10,7 @@ import './globals.css' const spaceGrotesk = Space_Grotesk({ subsets: ['latin'] }) export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + ...appMetadata.home, } export default function RootLayout({ @@ -26,10 +26,10 @@ export default function RootLayout({ enableSystem={true} disableTransitionOnChange > -
-
-
{children}
-
+
+
+
{children}
+
diff --git a/src/app/page.tsx b/src/app/page.tsx index fb66508..63164d4 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,5 @@ -import { Body } from '@/components/Body' +import { Home } from '@/components/pages' -export default function Home() { - return +export default function HomePage() { + return } diff --git a/src/app/robots.ts b/src/app/robots.ts new file mode 100644 index 0000000..633e2ae --- /dev/null +++ b/src/app/robots.ts @@ -0,0 +1,12 @@ +import { MetadataRoute } from 'next' + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: '*', + allow: '/', + disallow: '/private/', + }, + sitemap: 'https://lualabs.xyz/sitemap.xml', + } +} diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts new file mode 100644 index 0000000..f468336 --- /dev/null +++ b/src/app/sitemap.ts @@ -0,0 +1,16 @@ +import { getSortedBlogPosts } from '../lib/blog' + +export default async function sitemap() { + const blogPosts = await getSortedBlogPosts() + const blogPostRoutes = blogPosts.map((blogPost) => ({ + url: `https://seistart.com//blog/${blogPost.id}`, + lastModified: new Date(blogPost.date).toISOString().split('T')[0], + })) + + const staticRoutes = ['', '/blog', '/projects', 'analytics'].map((route) => ({ + url: `https://seistart.com/${route}`, + lastModified: new Date().toISOString().split('T')[0], + })) + + return [...staticRoutes, ...blogPostRoutes] +} diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 3e15d6d..76b2871 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,29 +1,24 @@ -'use client' - -import React from 'react' - -const Footer: React.FC = () => { +export const Footer = () => { + const date = new Date().getFullYear() return ( -
-
+
+
-

Block 1

+

Block 1

Content for block 1...

-

Block 2

+

Block 2

Content for block 2...

-

Block 3

+

Block 3

Content for block 3...

-

© {new Date().getFullYear()} SeiStart

+

© {date} SeiStart

) } - -export default Footer diff --git a/src/components/Header.tsx b/src/components/Header.tsx index fe1c3ba..b97563d 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,15 +1,11 @@ import Image from 'next/image' import Link from 'next/link' import { FaBell, FaSearch } from 'react-icons/fa' -import { MobileNavigation } from './MobileNavigation' -import { NavigationMenuPage } from './Navigation' -import { UserNav } from './UserNav' +import { MobileNavigation } from './navigation/mobile-navigation' +import { NavigationMenuPage } from './navigation/navigation' +import { UserNavigation } from './navigation/user-navigation' import { Button } from './ui/button' -/** - * Header component that renders a header with logo, navigation, - * and action buttons like connect wallet. - */ export const Header = () => { return (
@@ -36,7 +32,7 @@ export const Header = () => {
- +
) diff --git a/src/components/AnalyticsDashboard.tsx b/src/components/analytics-dashboard.tsx similarity index 100% rename from src/components/AnalyticsDashboard.tsx rename to src/components/analytics-dashboard.tsx diff --git a/src/components/Combobox.tsx b/src/components/combo-box.tsx similarity index 100% rename from src/components/Combobox.tsx rename to src/components/combo-box.tsx diff --git a/src/components/ImageSlider.tsx b/src/components/image-slider.tsx similarity index 83% rename from src/components/ImageSlider.tsx rename to src/components/image-slider.tsx index c5fc977..e56f4cb 100644 --- a/src/components/ImageSlider.tsx +++ b/src/components/image-slider.tsx @@ -1,7 +1,5 @@ 'use client' -import React from 'react' - import Image from 'next/image' import Link from 'next/link' import { Button } from './ui/button' @@ -58,10 +56,9 @@ const images: ImageData[] = [ subtitle: 'Subtitle 6', tags: ['Tag1', 'Tag2', 'Tag3'], }, - // Add more images as needed ] -const ImageSlider: React.FC = () => { +export const ImageSlider = () => { return (
@@ -134,30 +131,6 @@ const ImageSlider: React.FC = () => { ))} - {/*
  • - Facebook -
  • -
  • - Disney -
  • -
  • - Airbnb -
  • -
  • - Apple -
  • -
  • - Spark -
  • -
  • - Samsung -
  • -
  • - Quora -
  • -
  • - Sass -
  • */}
    @@ -165,5 +138,3 @@ const ImageSlider: React.FC = () => { ) } - -export default ImageSlider diff --git a/src/components/MobileNavigation.tsx b/src/components/navigation/mobile-navigation.tsx similarity index 63% rename from src/components/MobileNavigation.tsx rename to src/components/navigation/mobile-navigation.tsx index 250aff7..bbccf7c 100644 --- a/src/components/MobileNavigation.tsx +++ b/src/components/navigation/mobile-navigation.tsx @@ -1,7 +1,5 @@ 'use client' -import * as React from 'react' - import { Button } from '@/components/ui/button' import { Drawer, @@ -9,28 +7,20 @@ import { DrawerContent, DrawerTrigger, } from '@/components/ui/drawer' -import { Cross1Icon } from '@radix-ui/react-icons' -import { RxHamburgerMenu } from 'react-icons/rx' +import { useEffect, useState } from 'react' +import { RxCross2, RxHamburgerMenu } from 'react-icons/rx' -export function MobileNavigation() { - const [isDrawerOpen, setIsDrawerOpen] = React.useState(false) +export const MobileNavigation = () => { + const [isDrawerOpen, setIsDrawerOpen] = useState(false) - // Listen for viewport changes and close the drawer if the viewport - // width exceeds the breakpoint (e.g., 768px). - React.useEffect(() => { + useEffect(() => { function handleResize() { if (window.innerWidth > 768) { - setIsDrawerOpen(false) // Close the drawer + setIsDrawerOpen(false) } } - - // Add resize event listener window.addEventListener('resize', handleResize) - - // Call the resize function initially in case the initial viewport width is above the breakpoint handleResize() - - // Remove event listener on cleanup return () => window.removeEventListener('resize', handleResize) }, []) @@ -53,7 +43,7 @@ export function MobileNavigation() { variant='ghost' onClick={() => setIsDrawerOpen(false)} > - + diff --git a/src/components/Navigation.tsx b/src/components/navigation/navigation.tsx similarity index 95% rename from src/components/Navigation.tsx rename to src/components/navigation/navigation.tsx index 960dc30..4c2ecac 100644 --- a/src/components/Navigation.tsx +++ b/src/components/navigation/navigation.tsx @@ -1,8 +1,5 @@ 'use client' -import Link from 'next/link' -import * as React from 'react' - import { NavigationMenu, NavigationMenuContent, @@ -14,6 +11,8 @@ import { } from '@/components/ui/navigation-menu' import { cn } from '@/lib/utils' import { preventDefaultAction } from '@/utils' +import Link from 'next/link' +import { ReactNode } from 'react' const components: { title: string; href: string; description: string }[] = [ { @@ -30,7 +29,7 @@ const components: { title: string; href: string; description: string }[] = [ }, ] -export function NavigationMenuPage() { +export const NavigationMenuPage = () => { return ( @@ -89,9 +88,9 @@ export function NavigationMenuPage() { - + - Activity + Analytics @@ -111,7 +110,7 @@ interface ListItemProps { className?: string title: string href: string - children: React.ReactNode + children: ReactNode } const ListItem = ({ className, title, children, href }: ListItemProps) => { diff --git a/src/components/UserNav.tsx b/src/components/navigation/user-navigation.tsx similarity index 92% rename from src/components/UserNav.tsx rename to src/components/navigation/user-navigation.tsx index 954131e..45946ce 100644 --- a/src/components/UserNav.tsx +++ b/src/components/navigation/user-navigation.tsx @@ -2,8 +2,8 @@ import { Avatar, AvatarFallback, AvatarImage } from '@radix-ui/react-avatar' -import { ThemeRadioGroup } from './theme/theme-radio-group' -import { Button } from './ui/button' +import { ThemeRadioGroup } from '../theme/theme-radio-group' +import { Button } from '../ui/button' import { DropdownMenu, DropdownMenuContent, @@ -16,9 +16,9 @@ import { DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, -} from './ui/dropdown-menu' +} from '../ui/dropdown-menu' -export function UserNav() { +export const UserNavigation = () => { return ( diff --git a/src/app/analytics/page.tsx b/src/components/pages/analytics.tsx similarity index 94% rename from src/app/analytics/page.tsx rename to src/components/pages/analytics.tsx index 23057d7..0999815 100644 --- a/src/app/analytics/page.tsx +++ b/src/components/pages/analytics.tsx @@ -1,8 +1,8 @@ -import AnalyticsDashboard from '@/components/AnalyticsDashboard' +import AnalyticsDashboard from '@/components/analytics-dashboard' import { getDate } from '@/utils' import { analytics } from '@/utils/analytics' -const Page = async () => { +export const Analytics = async () => { const TRACKING_DAYS = 7 const pageviews = await analytics.retrieveDays('pageview', TRACKING_DAYS) @@ -74,5 +74,3 @@ const Page = async () => { ) } - -export default Page diff --git a/src/app/blog/page.tsx b/src/components/pages/blogs.tsx similarity index 82% rename from src/app/blog/page.tsx rename to src/components/pages/blogs.tsx index 752e19f..c1b789a 100644 --- a/src/app/blog/page.tsx +++ b/src/components/pages/blogs.tsx @@ -8,15 +8,7 @@ import { import { getSortedBlogPosts } from '@/lib/blog' import Link from 'next/link' -export function generateMetadata() { - return { - title: 'Blog', - description: '', - keywords: [], - } -} - -export default async function Blogs() { +export const Blogs = async () => { const blogPosts = await getSortedBlogPosts() return ( <> diff --git a/src/components/Body.tsx b/src/components/pages/home.tsx similarity index 95% rename from src/components/Body.tsx rename to src/components/pages/home.tsx index ec49dbf..8403a61 100644 --- a/src/components/Body.tsx +++ b/src/components/pages/home.tsx @@ -1,10 +1,10 @@ import { Paintbrush2Icon } from 'lucide-react' -import ImageSlider from './ImageSlider' -import CardComponent from './ProjectCard' -import { Avatar, AvatarFallback, AvatarImage } from './ui/avatar' -import { Button } from './ui/button' +import { ImageSlider } from '../image-slider' +import { ProjectCard } from '../project-card' +import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar' +import { Button } from '../ui/button' -export const Body = () => { +export const Home = () => { return (
    @@ -110,7 +110,7 @@ export const Body = () => {

    Highlights

    - { const { setSearchTerm, filteredProjects, diff --git a/src/components/ProjectCard.tsx b/src/components/project-card.tsx similarity index 94% rename from src/components/ProjectCard.tsx rename to src/components/project-card.tsx index bb75ca1..a45d2ba 100644 --- a/src/components/ProjectCard.tsx +++ b/src/components/project-card.tsx @@ -1,9 +1,10 @@ 'use client' -import React from 'react' +import { UserIcon } from 'lucide-react' +import Image from 'next/image' import { Button } from './ui/button' -interface CardProps { +interface ProjectCardProps { title: string subtitle: string count: number @@ -12,17 +13,14 @@ interface CardProps { buttonLabel: string } -import { UserIcon } from 'lucide-react' -import Image from 'next/image' - -const ProjectCard: React.FC = ({ +export const ProjectCard = ({ title, subtitle, count, imgSrc, smallImgSrcs, buttonLabel, -}) => { +}: ProjectCardProps) => { return (
    {Array(4) @@ -74,5 +72,3 @@ const ProjectCard: React.FC = ({
    ) } - -export default ProjectCard diff --git a/src/configs/app-metadata.ts b/src/configs/app-metadata.ts new file mode 100644 index 0000000..bfa48dd --- /dev/null +++ b/src/configs/app-metadata.ts @@ -0,0 +1,31 @@ +import { Metadata } from 'next' + +interface AppMetadata { + home: Metadata + projects: Metadata + blogs: Metadata + analytics: Metadata +} + +export const appMetadata: AppMetadata = { + home: { + title: 'SeiStart: Home', + description: '', + keywords: [], + }, + projects: { + title: 'SeiStart: Projects', + description: '', + keywords: [], + }, + blogs: { + title: 'SeiStart: Blogs', + description: '', + keywords: [], + }, + analytics: { + title: 'SeiStart: Analytics', + description: '', + keywords: [], + }, +} diff --git a/src/configs/index.ts b/src/configs/index.ts new file mode 100644 index 0000000..c2d8645 --- /dev/null +++ b/src/configs/index.ts @@ -0,0 +1 @@ +export * from './app-metadata' diff --git a/src/data/dummy.js b/src/data/dummy.js deleted file mode 100644 index ae9b807..0000000 --- a/src/data/dummy.js +++ /dev/null @@ -1,38 +0,0 @@ -const projects = [ - { - name: 'Project 1', - description: 'This is a project', - image: 'https://picsum.photos/id/1/200/300', - url: 'https://www.google.com', - }, - { - name: 'Project 2', - description: 'This is a project', - image: 'https://picsum.photos/id/2/200/300', - url: 'https://www.google.com', - }, - { - name: 'Project 3', - description: 'This is a project', - image: 'https://picsum.photos/id/3/200/300', - url: 'https://www.google.com', - }, - { - name: 'Project 4', - description: 'This is a project', - image: 'https://picsum.photos/id/4/200/300', - url: 'https://www.google.com', - }, - { - name: 'Project 5', - description: 'This is a project', - image: 'https://picsum.photos/id/5/200/300', - url: 'https://www.google.com', - }, - { - name: 'Project 6', - description: 'This is a project', - image: 'https://picsum.photos/id/6/200/300', - url: 'https://www.google.com', - }, -] diff --git a/src/hooks/index.ts b/src/hooks/index.ts index d328f35..404bb76 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1 +1 @@ -export * from './useProjects' +export * from './use-projects' diff --git a/src/hooks/useProjects.ts b/src/hooks/use-projects.ts similarity index 100% rename from src/hooks/useProjects.ts rename to src/hooks/use-projects.ts diff --git a/src/state/index.ts b/src/state/index.ts index 7ec9432..949cf1f 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -1 +1 @@ -export * from './useProjectStore' +export * from './use-project-store' diff --git a/src/state/useProjectStore.ts b/src/state/use-project-store.ts similarity index 100% rename from src/state/useProjectStore.ts rename to src/state/use-project-store.ts