diff --git a/app/about/page.tsx b/app/about/page.tsx deleted file mode 100644 index 8840b7d..0000000 --- a/app/about/page.tsx +++ /dev/null @@ -1,152 +0,0 @@ -import { Metadata } from "next"; -import { Container, Typography, List, ListItem, Box } from "@mui/material"; -import { Button } from "@/components/buttons"; -import Link from "next/link"; -import Image from "next/legacy/image"; - -export const metadata: Metadata = { - title: "About My Lib - Your Personal Code Library", - description: - "My Lib is a simple and efficient way to store, organize, and reuse code snippets, scripts, configurations, and more. Create your own personal library with frontend, backend, and any programming languages.", - robots: "index, follow", -}; - -export default function AboutPage() { - return ( - - - My Lib: Your Universal Code & Knowledge Organizer for IT Professionals - - - - My Lib is an intuitive platform built for developers, DevOps engineers, - IT specialists, and anyone working with code or technical information. - More than just a snippet manager, it’s a versatile workspace to organize - your knowledge - - - - - - - - - - What Makes My Lib Indispensable? - - - - 🚀 Build Your Personal Code Library Save code snippets in any language - (JavaScript, Python, Go, SQL, etc.) for frontend, backend, mobile - development, or automation tasks. The built-in code editor with syntax - highlighting ensures a seamless coding experience. - - - - 📂 Organize Beyond Code Store server configurations, instructions, - documentation, checklists, bookmarks, and even images. The rich text - editor lets you format content, add tables, lists, and embed media. - - - - 🏷️ Instant Access with Categories & Labels Sort data into customizable - categories and apply labels for precise filtering. Examples: “Docker - Configs,” “React Hooks,” “SQL Templates.” - - - - 🔍 Find Anything in Seconds Search by category names, labels, or content - within code items—no more digging through messy folders, old projects, - or dozens of repositories. Stop wasting time scrolling through forums or - GitHub to rediscover solutions you’ve already used. With My Lib, every - piece of code, configuration, or knowledge you’ve saved is just a quick - search away. - - - - - Example of usage: - - - - Home page with categories: - - - - Categories example - - - - Code items inside category: - - - - Code items example - - - - - Key Features - - - - - Create custom categories like Components, Configs, Helpers, Styles. - - - Assign labels (e.g., FE, BE, env, MUI) for easy filtering. - - Search categories by name for quick access. - - Add rich descriptions with a powerful editor supporting text - formatting, code snippets, images, links, and more. - - - Use Monaco Editor for syntax highlighting and better coding - experience. - - - Fast filter and search code items by tags and names. - - - - ); -} diff --git a/app/categories/page.tsx b/app/categories/page.tsx new file mode 100644 index 0000000..70f9ef0 --- /dev/null +++ b/app/categories/page.tsx @@ -0,0 +1,47 @@ +"use client"; + +import { Grid2, useMediaQuery, useTheme } from "@mui/material"; +import { CreateCategoryButton, CategoriesList } from "@/components/categories"; +import { SearchInput } from "@/components/inputs"; +import { MainLayout } from "@/components/MainLayout"; +import { FiltersModal } from "@/components/modals"; +import { CATEGORY_TYPE } from "@/types"; +import { useGetLabels } from "@/api"; + +const Categories = () => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down("sm")); + useGetLabels({ labelType: CATEGORY_TYPE }); + + return ( + + + + + + + + + + + + + + ); +}; + +export default Categories; diff --git a/app/layout.tsx b/app/layout.tsx index af3bd7d..997fa40 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -14,6 +14,9 @@ import { ProgressBar } from "@/components/ProgressBar"; export const metadata: Metadata = { title: "My Lib", + other: { + "google-site-verification": "tF4APm9Ef57vuo1EalGFhWE486sHWOmrpH1wGcZ_Cbk", + }, }; export const viewport = { diff --git a/app/login/page.tsx b/app/login/page.tsx index e79da83..9adcc0f 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -8,6 +8,7 @@ import { useState } from "react"; import { Button, Form, TextInput, Link } from "@/components"; import { FieldValues } from "react-hook-form"; import { useSnackbar } from "notistack"; +import { CATEGORIES_ROUTE } from "@/types"; const schema = z.object({ email: z @@ -21,7 +22,7 @@ const Login = () => { const [isLoading, setIsLoading] = useState(false); const { enqueueSnackbar } = useSnackbar(); const searchParams = useSearchParams(); - const callbackUrl = searchParams.get("callbackUrl") || "/"; + const callbackUrl = searchParams.get("callbackUrl") || CATEGORIES_ROUTE; const onSubmit = async (data: FieldValues) => { setIsLoading(true); @@ -35,7 +36,7 @@ const Login = () => { if (res?.error) { enqueueSnackbar(`${res?.error}`, { variant: "error" }); } else { - window.location.assign("/"); + window.location.assign(CATEGORIES_ROUTE); } } catch (err) { enqueueSnackbar(`${err}`, { variant: "error" }); diff --git a/app/page.tsx b/app/page.tsx index 7c13381..e0882a7 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,47 +1,158 @@ -"use client"; +import { Metadata } from "next"; +import { Container, Typography, List, ListItem, Box } from "@mui/material"; +import { Button } from "@/components/buttons"; +import Link from "next/link"; +import Image from "next/legacy/image"; +import { CATEGORIES_ROUTE } from "@/types"; +import { authConfig } from "@/configs"; +import { getServerSession } from "next-auth"; -import { Grid2, useMediaQuery, useTheme } from "@mui/material"; -import { CreateCategoryButton, CategoriesList } from "@/components/categories"; -import { SearchInput } from "@/components/inputs"; -import { MainLayout } from "@/components/MainLayout"; -import { FiltersModal } from "@/components/modals"; -import { CATEGORY_TYPE } from "@/types"; -import { useGetLabels } from "@/api"; +export const metadata: Metadata = { + title: "About My Lib - Your Personal Code Library", + description: + "My Lib is a simple and efficient way to store, organize, and reuse code snippets, scripts, configurations, and more. Create your own personal library with frontend, backend, and any programming languages.", + robots: "index, follow", +}; -const Home = () => { - const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down("sm")); - useGetLabels({ labelType: CATEGORY_TYPE }); +const LandingPage = async () => { + const session = await getServerSession(authConfig); + const userId = session?.user?.id; return ( - - - - - + + My Lib: Your Universal Code & Knowledge Organizer for IT Professionals + + + + My Lib is an intuitive platform built for developers, DevOps engineers, + IT specialists, and anyone working with code or technical information. + More than just a snippet manager, it’s a versatile workspace to organize + your knowledge + + + + {userId ? ( + + ) : ( + + )} + + + + What Makes My Lib Indispensable? + + + + 🚀 Build Your Personal Code Library Save code snippets in any language + (JavaScript, Python, Go, SQL, etc.) for frontend, backend, mobile + development, or automation tasks. The built-in code editor with syntax + highlighting ensures a seamless coding experience. + + + + 📂 Organize Beyond Code Store server configurations, instructions, + documentation, checklists, bookmarks, and even images. The rich text + editor lets you format content, add tables, lists, and embed media. + + + + 🏷️ Instant Access with Categories & Labels Sort data into customizable + categories and apply labels for precise filtering. Examples: “Docker + Configs,” “React Hooks,” “SQL Templates.” + + + + 🔍 Find Anything in Seconds Search by category names, labels, or content + within code items—no more digging through messy folders, old projects, + or dozens of repositories. Stop wasting time scrolling through forums or + GitHub to rediscover solutions you’ve already used. With My Lib, every + piece of code, configuration, or knowledge you’ve saved is just a quick + search away. + + + + + Example of usage: + + + + Home page with categories: + + + + Categories example + + + + Code items inside category: + + + - + Code items example + + - - - + + Key Features + - - + + + Create custom categories like Components, Configs, Helpers, Styles. + + + Assign labels (e.g., FE, BE, env, MUI) for easy filtering. + + Search categories by name for quick access. + + Add rich descriptions with a powerful editor supporting text + formatting, code snippets, images, links, and more. + + + Use Monaco Editor for syntax highlighting and better coding + experience. + + + Fast filter and search code items by tags and names. + + + ); }; -export default Home; +export default LandingPage; diff --git a/app/registration/page.tsx b/app/registration/page.tsx index 54c6d0c..2932a73 100644 --- a/app/registration/page.tsx +++ b/app/registration/page.tsx @@ -7,6 +7,7 @@ import { Button, Form, TextInput, Link } from "@/components"; import { fetchService } from "@/services"; import { useSnackbar } from "notistack"; import { signIn } from "next-auth/react"; +import { CATEGORIES_ROUTE } from "@/types"; const schema = z .object({ @@ -47,7 +48,7 @@ const Registration = () => { }); if (!result?.error && result?.status === 200) { - window.location.assign("/"); + window.location.assign(CATEGORIES_ROUTE); enqueueSnackbar("Sign up successful. Welcome to My lib", { variant: "success", diff --git a/components/Header.tsx b/components/Header.tsx index edfa2af..01dfaa9 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -17,11 +17,11 @@ import { } from "@mui/material"; import { useGetUser } from "@/hooks"; import { useColorMode } from "@/providers"; +import { CATEGORIES_ROUTE } from "@/types"; export const Header = () => { const { userName, userImage, userId, userEmail } = useGetUser(); const [anchorElUser, setAnchorElUser] = useState(null); - const { theme, toggleTheme } = useColorMode(); const onOpenUserMenu = (event: MouseEvent) => { @@ -47,7 +47,7 @@ export const Header = () => { variant="h6" noWrap component={Link} - href="/" + href={userId ? CATEGORIES_ROUTE : "/"} color="primary" sx={{ display: "flex", @@ -100,7 +100,7 @@ export const Header = () => { About diff --git a/components/code-items/CodeItem.tsx b/components/code-items/CodeItem.tsx index ed026a0..b262912 100644 --- a/components/code-items/CodeItem.tsx +++ b/components/code-items/CodeItem.tsx @@ -57,7 +57,8 @@ const StyledListItem = styled(ListItem)(({ theme }) => ({ color: "primary", cursor: "pointer", "&:hover": { - backgroundColor: grey[200], + backgroundColor: theme.palette.primary.light, + color: theme.palette.primary.dark, }, }, [`& .${CodeItemClasses.labelsContainer}`]: { @@ -210,7 +211,8 @@ export const CodeItem = ({ borderRadius: "50%", padding: 0.6, "&:hover": { - backgroundColor: grey[200], + backgroundColor: "primary.light", + color: "primary.dark", }, }} /> diff --git a/middleware.ts b/middleware.ts index cb63b1a..bd46131 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,5 +1,5 @@ export { default } from "next-auth/middleware"; export const config = { - matcher: ["/", "/code-items/:path*"], + matcher: ["/categories", "/code-items/:path*"], }; diff --git a/netlify.toml b/netlify.toml index 5c52725..9728b02 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,6 +2,6 @@ package = "@netlify/plugin-nextjs" [build] - command = "next build" + command = "next build && next-sitemap" publish = ".next" \ No newline at end of file diff --git a/next-sitemap.config.js b/next-sitemap.config.js new file mode 100644 index 0000000..750c28e --- /dev/null +++ b/next-sitemap.config.js @@ -0,0 +1,24 @@ +/** @type {import('next-sitemap').IConfig} */ +module.exports = { + siteUrl: "https://my-lib-pro.netlify.app", + generateRobotsTxt: true, + outDir: "./public", + exclude: ["/categories", "/code-items*", "/login", "/registration"], + robotsTxtOptions: { + policies: [ + { + userAgent: "*", + allow: "/", + disallow: ["/categories", "/code-items*", "/login", "/registration"], + }, + ], + }, + additionalPaths: async () => [ + { + loc: "/", + changefreq: "monthly", + priority: 1.0, + lastmod: new Date().toISOString(), + }, + ], +}; diff --git a/package-lock.json b/package-lock.json index acad3c4..db66568 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,6 +55,7 @@ "mui-tiptap": "^1.17.1", "next": "15.1.7", "next-auth": "^4.24.11", + "next-sitemap": "^4.2.3", "notistack": "^3.0.2", "react": "^19.0.0", "react-dom": "^19.0.0", @@ -1461,6 +1462,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@corex/deepmerge": { + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.43.tgz", + "integrity": "sha512-N8uEMrMPL0cu/bdboEWpQYb/0i2K5Qn8eCsxzOmxSggJbbQte7ljMRoXm917AbntqTGOzdTu+vP3KOOzoC70HQ==", + "license": "MIT" + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -10357,6 +10364,39 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/next-sitemap": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/next-sitemap/-/next-sitemap-4.2.3.tgz", + "integrity": "sha512-vjdCxeDuWDzldhCnyFCQipw5bfpl4HmZA7uoo3GAaYGjGgfL4Cxb1CiztPuWGmS+auYs7/8OekRS8C2cjdAsjQ==", + "funding": [ + { + "url": "https://github.com/iamvishnusankar/next-sitemap.git" + } + ], + "license": "MIT", + "dependencies": { + "@corex/deepmerge": "^4.0.43", + "@next/env": "^13.4.3", + "fast-glob": "^3.2.12", + "minimist": "^1.2.8" + }, + "bin": { + "next-sitemap": "bin/next-sitemap.mjs", + "next-sitemap-cjs": "bin/next-sitemap.cjs" + }, + "engines": { + "node": ">=14.18" + }, + "peerDependencies": { + "next": "*" + } + }, + "node_modules/next-sitemap/node_modules/@next/env": { + "version": "13.5.11", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.11.tgz", + "integrity": "sha512-fbb2C7HChgM7CemdCY+y3N1n8pcTKdqtQLbC7/EQtPdLvlMUT9JX/dBYl8MMZAtYG4uVMyPFHXckb68q/NRwqg==", + "license": "MIT" + }, "node_modules/node-addon-api": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", diff --git a/package.json b/package.json index f319c01..470a24b 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "mui-tiptap": "^1.17.1", "next": "15.1.7", "next-auth": "^4.24.11", + "next-sitemap": "^4.2.3", "notistack": "^3.0.2", "react": "^19.0.0", "react-dom": "^19.0.0", diff --git a/providers/ThemeProvider.tsx b/providers/ThemeProvider.tsx index e729899..6fd98e4 100644 --- a/providers/ThemeProvider.tsx +++ b/providers/ThemeProvider.tsx @@ -172,7 +172,7 @@ const darkTheme = createTheme({ default: "#1e1e1e", }, grey: { 400: "#3a3a3a" }, - primary: { main: "#ed8002" }, + primary: { main: "#fde052", light: "#fff6c7", dark: "#f5b848" }, secondary: { main: "#008edf", light: "#00afff", dark: "#005caa" }, }, shape, diff --git a/types/constants.ts b/types/constants.ts index 5abeecb..98bb543 100644 --- a/types/constants.ts +++ b/types/constants.ts @@ -17,3 +17,6 @@ export const LIGHT_THEME = "light"; export const DARK_THEME = "dark"; export const LIGHT_TEXT = "light-text"; export const DARK_TEXT = "dark-text"; + +// Routes +export const CATEGORIES_ROUTE = "/categories";