diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index c550055..0000000 --- a/.dockerignore +++ /dev/null @@ -1,7 +0,0 @@ -Dockerfile -.dockerignore -node_modules -npm-debug.log -README.md -.next -.git diff --git a/.env.example.local b/.env.example.local deleted file mode 100644 index 9e1a313..0000000 --- a/.env.example.local +++ /dev/null @@ -1,6 +0,0 @@ -NODE_ENV=development -NEXT_PUBLIC_EXPRESS_API_URL=http://127.0.0.1:3100 -NEXT_PUBLIC_RECAPTCHA_KEY="" -NEXT_PUBLIC_GOOGLE_ANALYTICS_HOME="" -NEXT_PUBLIC_GOOGLE_ANALYTICS_PAGES="" -NEXT_PUBLIC_MICROSOFT_CLARITY="" \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index 93ca692..c3d2c1e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,7 +1,6 @@ -postcss.config.js -tailwind.config.js -next.config.js +index.html +postcss.config.cjs +tailwind.config.cjs dist/* node_modules/* -public/* -.next/* +public/* \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index 33450d6..37f73c0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,27 +1,27 @@ { - "env": { - "browser": true, - "es2021": true - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:@typescript-eslint/recommended" - ], - "overrides": [ - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": [ - "react", - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/no-unused-vars": "error", - "react/react-in-jsx-scope": "off", - "react/jsx-filename-extension": [1, { "extensions": [".tsx"] }] - } + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended" + ], + "overrides": [ + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "react", + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/no-unused-vars": "error", + "react/react-in-jsx-scope": "off", + "react/jsx-filename-extension": [1, { "extensions": [".tsx"] }] + } } diff --git a/.gitignore b/.gitignore index 7f12483..c57a349 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,26 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug +# Logs +logs +.env +*.log npm-debug.log* yarn-debug.log* yarn-error.log* - -# local env files -.env -.env.development.local -.env.production.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local +package-lock.json + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 93ca692..0000000 --- a/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -postcss.config.js -tailwind.config.js -next.config.js -dist/* -node_modules/* -public/* -.next/* diff --git a/.prettierrc b/.prettierrc index b303599..5e16a0e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,12 +1,9 @@ { - "$schema": "http://json.schemastore.org/prettierrc", "quoteProps": "consistent", "printWidth": 120, "bracketSpacing": true, "singleQuote": false, "useTabs": false, "arrowParens": "avoid", - "tabWidth": 2, - "pluginSearchDirs": false, - "plugins": ["prettier-plugin-tailwindcss"] + "tabWidth": 2 } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index dfe4799..0000000 --- a/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM node:18-alpine AS alpine - -FROM alpine AS deps -RUN apk add --no-cache libc6-compat -WORKDIR /app -COPY package.json yarn.lock* ./ -RUN yarn --frozen-lockfile; - -# Rebuild the source code only when needed -FROM alpine AS builder -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules -COPY . . -RUN yarn build - -# Production image, copy all the files and run next -FROM alpine AS runner -WORKDIR /app -ENV NODE_ENV production - -COPY --from=builder /app/public ./public -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/.env.production.local ./.env.production.local -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/package.json ./package.json -COPY --from=builder /app/next.config.js ./next.config.js - -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs -RUN chown -R nextjs:nodejs /app/.next -USER nextjs -EXPOSE 3000 -CMD ["yarn", "start"] \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index f4da3c4..0000000 --- a/README.md +++ /dev/null @@ -1,34 +0,0 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). - -## Getting Started - -First, run the development server: - -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 447cd35..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: "3" -services: - zoz.bio: - container_name: zoz.bio - build: - context: . - dockerfile: ./Dockerfile - restart: unless-stopped - environment: - NODE_ENV: production - networks: - - npm - deploy: - resources: - limits: - cpus: '2' - memory: '4GB' -networks: - npm: - external: true - name: npm \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..2dd8baa --- /dev/null +++ b/index.html @@ -0,0 +1,66 @@ + + + + + + + + + + Codestin Search App + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + diff --git a/next.config.js b/next.config.js deleted file mode 100644 index b0c6800..0000000 --- a/next.config.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = { - reactStrictMode: false, - images: { - domains: ["api.zoz.bio", "127.0.0.1"], - }, -}; - -module.exports = nextConfig; diff --git a/package.json b/package.json index 678cdcc..a26e4f3 100644 --- a/package.json +++ b/package.json @@ -1,58 +1,48 @@ { - "name": "zoz.bio-frontend", - "version": "1.0.0", - "description": "A beauty platform to create your bio page and link your socials", - "repository": "https://github.com/guustavocl/zoz.bio-frontend", - "author": "@guustavocl - https://gus.sh/", - "license": "MIT", + "name": "zoz.gg", "private": true, + "version": "0.0.0", + "type": "module", "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint" + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" }, "dependencies": { - "@headlessui/react": "^1.7.15", - "@heroicons/react": "^2.0.18", - "@hookform/resolvers": "^3.1.0", - "@tanstack/react-query": "^4.29.12", - "@tippyjs/react": "^4.2.6", - "autoprefixer": "10.4.14", - "axios": "^1.4.0", - "clsx": "^1.2.1", - "cookies-next": "^2.1.1", - "css-doodle": "^0.34.9", - "next": "^13.4.4", - "next-auth": "^4.22.1", - "nextjs-toploader": "^1.4.2", + "@bigheads/core": "^0.3.3", + "@headlessui/react": "^1.7.3", + "@heroicons/react": "^2.0.12", + "@hookform/resolvers": "^3.0.1", + "@tanstack/react-query": "^4.15.0", + "axios": "^1.1.3", + "formik": "^2.2.9", "react": "^18.2.0", "react-colorful": "^5.6.1", "react-dom": "^18.2.0", - "react-google-recaptcha": "^3.1.0", - "react-hook-form": "^7.44.3", - "react-toastify": "^9.1.3", - "tailwind-merge": "^1.13.0", + "react-google-recaptcha": "^2.1.0", + "react-hook-form": "^7.43.9", + "react-router-dom": "^6.4.2", + "react-toastify": "^9.1.1", + "yup": "^0.32.11", "zod": "^3.21.4" }, "devDependencies": { - "@types/node": "20.2.5", - "@types/react": "18.2.7", - "@types/react-dom": "18.2.4", + "@tailwindcss/forms": "^0.5.3", + "@types/node": "^18.11.9", + "@types/react": "^18.0.17", + "@types/react-dom": "^18.0.6", "@types/react-google-recaptcha": "^2.1.5", "@typescript-eslint/eslint-plugin": "^5.50.0", "@typescript-eslint/parser": "^5.50.0", - "color": "^4.2.3", - "eslint": "8.41.0", - "eslint-config-next": "13.4.4", - "postcss": "8.4.24", - "prettier": "^3.0.3", - "prettier-plugin-tailwindcss": "^0.5.4", - "tailwindcss": "3.3.2", - "typescript": "5.0.4" - }, - "resolutions": { - "@types/react": "18.2.7", - "@types/react-dom": "18.2.4" + "@vitejs/plugin-react": "^2.1.0", + "autoprefixer": "^10.4.13", + "eslint": "^8.33.0", + "eslint-plugin-react": "^7.32.2", + "postcss": "^8.4.18", + "prettier": "^2.8.3", + "tailwindcss": "^3.2.1", + "typescript": "^4.6.4", + "vite": "^3.1.8", + "vite-plugin-compression": "^0.5.1" } } diff --git a/postcss.config.js b/postcss.config.cjs similarity index 100% rename from postcss.config.js rename to postcss.config.cjs diff --git a/public/banners/link-zelda.jpg b/public/banners/link-zelda.jpg deleted file mode 100644 index 95278c4..0000000 Binary files a/public/banners/link-zelda.jpg and /dev/null differ diff --git a/public/bg.png b/public/bg.png new file mode 100644 index 0000000..8531d86 Binary files /dev/null and b/public/bg.png differ diff --git a/public/confirm.gif b/public/confirm.gif deleted file mode 100644 index 9858cba..0000000 Binary files a/public/confirm.gif and /dev/null differ diff --git a/src/app/favicon.ico b/public/favicon.ico similarity index 100% rename from src/app/favicon.ico rename to public/favicon.ico diff --git a/public/home.jpg b/public/home.jpg deleted file mode 100644 index 84d20a6..0000000 Binary files a/public/home.jpg and /dev/null differ diff --git a/public/home2.jpg b/public/home2.jpg deleted file mode 100644 index 0b8c4d0..0000000 Binary files a/public/home2.jpg and /dev/null differ diff --git a/public/home3.jpg b/public/home3.jpg deleted file mode 100644 index 764036c..0000000 Binary files a/public/home3.jpg and /dev/null differ diff --git a/public/icons/social/flickr.png b/public/icons/social/flickr.png deleted file mode 100644 index 1b0e1db..0000000 Binary files a/public/icons/social/flickr.png and /dev/null differ diff --git a/public/login.gif b/public/login.gif deleted file mode 100644 index 28f8077..0000000 Binary files a/public/login.gif and /dev/null differ diff --git a/public/metabg.png b/public/metabg.png index ebf5f0e..89bdf6a 100644 Binary files a/public/metabg.png and b/public/metabg.png differ diff --git a/public/pfp.jpg b/public/pfp.jpg deleted file mode 100644 index 9e0b553..0000000 Binary files a/public/pfp.jpg and /dev/null differ diff --git a/public/reset.gif b/public/reset.gif deleted file mode 100644 index 753bfd9..0000000 Binary files a/public/reset.gif and /dev/null differ diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..80c5131 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: /icons/ diff --git a/public/teste.jpg b/public/teste.jpg deleted file mode 100644 index 70f0af3..0000000 Binary files a/public/teste.jpg and /dev/null differ diff --git a/public/zoz.png b/public/zoz.png index a123edd..79963ff 100644 Binary files a/public/zoz.png and b/public/zoz.png differ diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..19c470d --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,86 @@ +import React from "react"; +import { BrowserRouter, Route, Routes } from "react-router-dom"; +import { PublicLayout, PageLayout, ProtectedLayout } from "./layouts"; +import Account from "./pages/Account"; + +const Home = React.lazy(() => import("./pages/Home")); +const Login = React.lazy(() => import("./pages/Login")); +const Register = React.lazy(() => import("./pages/Register")); +const About = React.lazy(() => import("./pages/About")); +const Terms = React.lazy(() => import("./pages/Terms")); +const Privacy = React.lazy(() => import("./pages/Privacy")); +const Contact = React.lazy(() => import("./pages/Contact")); +const Reset = React.lazy(() => import("./pages/Reset")); +const Confirm = React.lazy(() => import("./pages/Confirm")); + +const publicRoutes = [ + { + path: "/", + component: Home, + }, + { + path: "/login", + component: Login, + }, + { + path: "/register", + component: Register, + }, + { + path: "/about", + component: About, + }, + { + path: "/terms", + component: Terms, + }, + { + path: "/privacy", + component: Privacy, + }, + { + path: "/contact", + component: Contact, + }, + { + path: "/reset", + component: Reset, + }, + { + path: "/confirm", + component: Confirm, + }, +]; + +const App = () => { + return ( + + + + + + } + /> + + {publicRoutes.map(({ path, component: Component }, id) => ( + + + + } + /> + ))} + + } /> + + + ); +}; + +export default App; diff --git a/src/app/(BioLayout)/[username]/Bio.tsx b/src/app/(BioLayout)/[username]/Bio.tsx deleted file mode 100644 index f95ec62..0000000 --- a/src/app/(BioLayout)/[username]/Bio.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { cookies } from "next/headers"; -import Image from "next/image"; -import React from "react"; -import BioAvatar from "./BioAvatar"; -import BioBadges from "./BioBadges"; -import BioInfos from "./BioInfos"; -import BioLinks from "./BioLinks"; -import BioNavigation from "./BioNavigation"; -import BioSocials from "./BioSocials"; -import BioCard from "./BioCard"; -import CssDoodle from "@/components/CssDoodle/CssDoodle"; - -export const BioComponent = ({ page }: { page: PageProps }) => { - const cookieStore = cookies(); - const userCookie = cookieStore.get("zoz_user"); - const user = userCookie ? JSON.parse(userCookie?.value) : undefined; - const backgroundUrl = page?.backgroundUrl || null; - const backGroundOpacity = page?.backGroundOpacity || defaultPage.bgOpacity; - - return ( - <> -
- {backgroundUrl ? ( -
- {`${page.pagename} -
- ) : ( - - )} - -
-
- - -
- - - -
-
-
- -
- -
-
-
- - ); -}; diff --git a/src/app/(BioLayout)/[username]/BioAvatar.tsx b/src/app/(BioLayout)/[username]/BioAvatar.tsx deleted file mode 100644 index 3a17f9d..0000000 --- a/src/app/(BioLayout)/[username]/BioAvatar.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { twMerge } from "tailwind-merge"; -import { memo } from "react"; -import Image from "next/image"; - -type SectionCardProps = { - page?: PageProps; - className?: string; -}; - -const BioAvatar = ({ page }: SectionCardProps) => { - const pfpUrl = page?.pfpUrl || defaultPage.pfpUrl; - const primaryColor = page?.primaryColor || defaultPage.primaryColor; - - return ( -
- bio page avatar - bio page avatar -
- ); -}; - -export default memo(BioAvatar); diff --git a/src/app/(BioLayout)/[username]/BioBadges.tsx b/src/app/(BioLayout)/[username]/BioBadges.tsx deleted file mode 100644 index 49769bd..0000000 --- a/src/app/(BioLayout)/[username]/BioBadges.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { getBadge } from "@/utils/IconsList"; -import { memo } from "react"; - -const BioBadges = ({ page }: { page: PageProps }) => { - const badges = page.badges || defaultPage.pageBadges; - const secondaryColor = page?.secondaryColor || defaultPage.secondaryColor; - const fontColor = page?.fontColor || defaultPage.fontColor; - - if (badges && badges.length === 0) return null; - - return ( -
- {badges?.map((badge, idx) => - getBadge(badge) ? ( - - {getBadge(badge)?.label} - - ) : null - )} -
- ); -}; -export default memo(BioBadges); diff --git a/src/app/(BioLayout)/[username]/BioCard.tsx b/src/app/(BioLayout)/[username]/BioCard.tsx deleted file mode 100644 index a285138..0000000 --- a/src/app/(BioLayout)/[username]/BioCard.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { twMerge } from "tailwind-merge"; -import { ReactNode, memo } from "react"; - -type SectionCardProps = { - children: ReactNode; - page?: PageProps; - className?: string; - center?: boolean; -}; - -const BioCard = ({ children, page, className, center = true }: SectionCardProps) => { - const primaryColor = page?.primaryColor || defaultPage.primaryColor; - const cardBlur = page?.cardBlur || defaultPage.cardBlur; - const cardHueRotate = page?.cardHueRotate || defaultPage.cardHueRotate; - return ( -
- {children} -
- ); -}; - -export default memo(BioCard); diff --git a/src/app/(BioLayout)/[username]/BioIFrames.tsx b/src/app/(BioLayout)/[username]/BioIFrames.tsx deleted file mode 100644 index c096153..0000000 --- a/src/app/(BioLayout)/[username]/BioIFrames.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { LinkProps } from "@/types/LinkProps"; -import { memo } from "react"; - -// TODO - its kinda of laggy when switch folders if you hjave an iframe -// seems like the iframe is reloading everytime, find a way to save the iframe, cache, etc -// TODO - encapsulate this better -// TODO - spotify albums -const BioIFrames = ({ link }: { link: LinkProps }) => { - return ( - <> - {link.embedded === "spotify" && link.isPlaylist ? ( - - ) : link.embedded === "spotify" ? ( - - ) : link.embedded === "soundcloud" && link.url.includes("/sets/") ? ( - - ) : link.embedded === "soundcloud" ? ( - - ) : link.embedded === "youtube" && link.url.length > 20 ? ( - - ) : link.embedded === "youtube" ? ( - - ) : null} - - ); -}; -export default memo(BioIFrames); diff --git a/src/app/(BioLayout)/[username]/BioInfos.tsx b/src/app/(BioLayout)/[username]/BioInfos.tsx deleted file mode 100644 index 3b3c487..0000000 --- a/src/app/(BioLayout)/[username]/BioInfos.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { memo } from "react"; -import { PageProps } from "@/types/PageProps"; -import { getAdornmentIcon } from "@/utils/IconsList"; -import CopyLabel from "@/components/Labels/CopyLabel"; -import { defaultPage } from "@/utils/BioVariables"; - -const BioInfos = ({ page }: { page: PageProps }) => { - const fontColor = page?.fontColor || defaultPage.fontColor; - - return ( -
-

- - {page?.uname || "No name~"} - - {page?.adornment ? ( - {getAdornmentIcon(page.adornment)?.label} - ) : null} - - -

-
- -
- {page?.bio && ( -
- {page?.bio} -
- )} -
- ); -}; - -export default memo(BioInfos); diff --git a/src/app/(BioLayout)/[username]/BioLink.tsx b/src/app/(BioLayout)/[username]/BioLink.tsx deleted file mode 100644 index 7b089de..0000000 --- a/src/app/(BioLayout)/[username]/BioLink.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import { LinkProps } from "@/types/LinkProps"; -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { getIcon } from "@/utils/IconsList"; -import clsx from "clsx"; -import Image from "next/image"; -import Link from "next/link"; -import { memo } from "react"; - -type BioLinkProps = { - page: PageProps; - link: LinkProps; - setFolderOwner: (link: LinkProps) => void; -}; - -const BannerComponent = ({ link, fontColor }: { link: LinkProps; fontColor: string }) => { - const typeCover = link.bannerUrl || ""; - - return ( - <> - {typeCover && ( - link banner - )} -
- {`folder - {link.isFolder ? "Folder" : "Link"} -
- - ); -}; - -const LinkComponent = ({ page, link, setFolderOwner }: BioLinkProps) => { - const fontColor = page?.fontColor || defaultPage.fontColor; - const h2ClassName = - "sm:ml-7 flex-1 flex-shrink-0 truncate whitespace-pre-wrap text-center font-bold tracking-wide overflow-visible whitespace-nowrap text-lg sm:text-xl"; - if (link.isFolder) - return ( -
{ - link.isSelected = true; - setFolderOwner(link); - }} - > -

- {/* TODO - UX upgrade */} - {link.isSelected ? "Click to go back" : link.label} -

-
- ); - return ( - -

- {link.label} -

- - ); -}; - -const BioLink = ({ page, link, setFolderOwner }: BioLinkProps) => { - const primaryColor = page?.primaryColor || defaultPage.primaryColor; - const fontColor = page?.fontColor || defaultPage.fontColor; - const cardBlur = page?.cardBlur || defaultPage.cardBlur; - const cardHueRotate = page?.cardHueRotate || defaultPage.cardHueRotate; - - const cardStyle = { - backgroundColor: `rgb(${primaryColor.r},${primaryColor.g},${primaryColor.b},${primaryColor.a})`, - }; - - return ( - <> -
-
- -
-
- -
-
- -
-
- - ); -}; - -export default memo(BioLink); diff --git a/src/app/(BioLayout)/[username]/BioLinks.tsx b/src/app/(BioLayout)/[username]/BioLinks.tsx deleted file mode 100644 index 66df956..0000000 --- a/src/app/(BioLayout)/[username]/BioLinks.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client"; -import { LinkProps } from "@/types/LinkProps"; -import { PageProps } from "@/types/PageProps"; -import { memo, useState } from "react"; -import BioIFrames from "./BioIFrames"; -import BioLink from "./BioLink"; -import BioCard from "./BioCard"; - -type BioLinksProps = { - page: PageProps; -}; - -const BioLinks = ({ page }: BioLinksProps) => { - const [folderOwner, setFolderOwner] = useState(); - - const pageLinks = page?.pageLinks - ? folderOwner - ? page.pageLinks - .filter(link => { - return link.folderOwner === folderOwner._id; - }) - .sort(function (a, b) { - return a.position - b.position; - }) - : page.pageLinks - .filter(link => { - return !link.folderOwner; - }) - .sort(function (a, b) { - return a.position - b.position; - }) - : []; - return ( - <> - {folderOwner ? ( -
- { - link.isSelected = false; - setFolderOwner(null); - }} - /> -
- ) : null} - {pageLinks.map((link, idx) => - link.embedded === "none" ? ( -
- -
- ) : ( - - - - ) - )} - - ); -}; - -export default memo(BioLinks); diff --git a/src/app/(BioLayout)/[username]/BioNavigation.tsx b/src/app/(BioLayout)/[username]/BioNavigation.tsx deleted file mode 100644 index 2b94b91..0000000 --- a/src/app/(BioLayout)/[username]/BioNavigation.tsx +++ /dev/null @@ -1,47 +0,0 @@ -"use client"; -import { PageProps } from "@/types/PageProps"; -import { memo } from "react"; -import { HomeIcon, Cog6ToothIcon, ExclamationTriangleIcon } from "@heroicons/react/20/solid"; -import { Link } from "@/components/Buttons"; -import { UserProps } from "@/types/UserProps"; - -const BioNavigation = ({ page, user, editPage }: { page: PageProps; user: UserProps; editPage?: boolean }) => { - //TODO - make a better visual here, make report dialog - if (page && user) - return ( -
- -
-
- - {!editPage && ( - - )} -
- ); - - return ( -
- -
-
- -
- ); -}; -export default memo(BioNavigation); diff --git a/src/app/(BioLayout)/[username]/BioSocials.tsx b/src/app/(BioLayout)/[username]/BioSocials.tsx deleted file mode 100644 index 55bbf0b..0000000 --- a/src/app/(BioLayout)/[username]/BioSocials.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { memo } from "react"; -import BioIcon from "./BioIcon"; -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; - -const BioSocials = ({ page }: { page: PageProps }) => { - const socialMedias = page?.socialMedias?.length > 0 ? page.socialMedias : defaultPage.pageSocialMedias; - return ( -
- {socialMedias && socialMedias.map((media, idx) => )} -
- ); -}; -export default memo(BioSocials); diff --git a/src/app/(BioLayout)/[username]/BioStatusIcon.tsx b/src/app/(BioLayout)/[username]/BioStatusIcon.tsx deleted file mode 100644 index 1636679..0000000 --- a/src/app/(BioLayout)/[username]/BioStatusIcon.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { memo } from "react"; -import { PageStatusProps } from "@/types/PageProps"; -import { getStatusIcon } from "@/utils/IconsList"; - -const BioStatusIcon = ({ status }: { status: PageStatusProps }) => { - const statusIcon = getStatusIcon(status.key); - return statusIcon ? ( -
- {statusIcon.label} -
- ) : null; -}; - -export default memo(BioStatusIcon); diff --git a/src/app/(BioLayout)/[username]/NotFound.tsx b/src/app/(BioLayout)/[username]/NotFound.tsx deleted file mode 100644 index 2a254d5..0000000 --- a/src/app/(BioLayout)/[username]/NotFound.tsx +++ /dev/null @@ -1,4 +0,0 @@ -// TODO -export const NotFound = ({ username }: { username: string }) => { - return
{username} - NotFound
; -}; diff --git a/src/app/(BioLayout)/[username]/layout.tsx b/src/app/(BioLayout)/[username]/layout.tsx deleted file mode 100644 index f455fce..0000000 --- a/src/app/(BioLayout)/[username]/layout.tsx +++ /dev/null @@ -1,37 +0,0 @@ -// import Script from "next/script"; -import "@/app/(BioLayout)/biolayout.css"; -import "react-toastify/dist/ReactToastify.css"; -import "tippy.js/animations/perspective.css"; -import "tippy.js/dist/tippy.css"; -import "tippy.js/themes/translucent.css"; -import ToastProvider from "@/providers/ToastProvider"; -import { ReactNode } from "react"; -import Analytics from "@/components/Analytics"; - -// METADATA EXAMPLE - https://nextjs.org/docs/app/api-reference/functions/generate-metadata - -export default function BioLayout({ children }: { children: ReactNode }) { - //TODO - OG GRAPH IMAGE TWITTER E FB - return ( - - - - - - - - {process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_PAGES && process.env.NEXT_PUBLIC_MICROSOFT_CLARITY && ( - - )} - {children} - - - - ); -} diff --git a/src/app/(BioLayout)/[username]/page.tsx b/src/app/(BioLayout)/[username]/page.tsx deleted file mode 100644 index 9b0e08e..0000000 --- a/src/app/(BioLayout)/[username]/page.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { QueryClientProviderComponent } from "@/providers/QueryClientProvider"; -import { fetchBioPage } from "@/services/PageService"; -import { PageProps } from "@/types/PageProps"; -import { ZOZ_META_DESCRIPTION, ZOZ_META_TITLE } from "@/utils/Constants"; -import { BioComponent } from "./Bio"; -import { NotFound } from "./NotFound"; - -let pageData: PageProps | undefined = undefined; - -export async function generateMetadata({ params }: { params: { username: string } }) { - if (pageData) { - return { - // TODO - generate profile img, change title - title: `zoz.bio - ${params.username}`, - description: pageData.bio || ZOZ_META_DESCRIPTION, - // openGraph: { - // images: ['/some-specific-page-image.jpg', ...previousImages], - // }, - }; - } - - return { - title: ZOZ_META_TITLE, - description: ZOZ_META_DESCRIPTION, - }; -} - -export default async function BioPage({ params }: { params: { username: string } }) { - const res = await fetchBioPage(params.username); - pageData = res?.page; - - return ( -
- - {pageData ? : } - -
- ); -} diff --git a/src/app/(BioLayout)/biolayout.css b/src/app/(BioLayout)/biolayout.css deleted file mode 100644 index 26d79fd..0000000 --- a/src/app/(BioLayout)/biolayout.css +++ /dev/null @@ -1,81 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -:root { - --foreground-rgb: 255, 255, 255; - --background-start-rgb: 0, 0, 0; - --background-end-rgb: 0, 0, 0; - - font-family: Inter, Avenir, Helvetica, sans-serif; - font-size: clamp(0.8rem, 1vw, 1rem); - font-weight: 500; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; -} - -/* Scrollbar */ - -::-webkit-scrollbar { - width: 0; - height: 0; - background: transparent; -} - -/* */ - -html { - overflow: scroll; - overflow-x: hidden; - overflow-y: scroll; -} - -body { - /* font-family: Roboto, sans-serif; */ - color: rgb(var(--foreground-rgb)); - background-color: #141618; -} - -button:focus, -a:focus, -button:focus-visible, -a:focus-visible { - outline: 0ch; - --tw-ring-offset-width: 0px !important; -} - -.icon-shadow { - -webkit-filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 1)); - filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 1)); -} - -.arrow-card-start { - -webkit-clip-path: polygon(0% 0%, 70% 0%, 100% 50%, 70% 100%, 0% 100%); - clip-path: polygon(0% 0%, 70% 0%, 100% 50%, 70% 100%, 0% 100%); -} - -.arrow-card-end { - -webkit-clip-path: polygon(100% 0, 100% 50%, 100% 100%, 0% 100%, 6% 50%, 0% 0%); - clip-path: polygon(100% 0, 100% 50%, 100% 100%, 0% 100%, 6% 50%, 0% 0%); -} - -.home-image-fade { - -webkit-mask-image:-webkit-gradient(linear, left top, right bottom, from(rgba(0,0,0,0)), to(rgba(0,0,0,1))); - mask-image: linear-gradient(to left, rgba(0,0,0,1), rgba(0,0,0,0)); -} - -@screen sm { - .arrow-card-start { - -webkit-clip-path: polygon(0% 0%, 85% 0%, 100% 50%, 85% 100%, 0% 100%); - clip-path: polygon(0% 0%, 85% 0%, 100% 50%, 85% 100%, 0% 100%); - } - - .arrow-card-avatar { - -webkit-clip-path: polygon(0 0, 100% 0%, 75% 100%, 0% 100%); - clip-path: polygon(0 0, 100% 0%, 75% 100%, 0% 100%); - } -} \ No newline at end of file diff --git a/src/app/(BioLayout)/edit/[username]/ButtonCard.tsx b/src/app/(BioLayout)/edit/[username]/ButtonCard.tsx deleted file mode 100644 index a56a5a7..0000000 --- a/src/app/(BioLayout)/edit/[username]/ButtonCard.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { ReactNode, memo } from "react"; -import { twMerge } from "tailwind-merge"; - -type ButtonCardProps = { - label: string; - page: PageProps; - onClick: () => void; - className?: string; - iconAdornment?: ReactNode; -}; - -const ButtonCard = ({ label, className, page, onClick, iconAdornment }: ButtonCardProps) => { - const cardBlur = page?.cardBlur || defaultPage.cardBlur; - const cardHueRotate = page?.cardHueRotate || defaultPage.cardHueRotate; - const primaryColor = page?.primaryColor || defaultPage.primaryColor; - const fontColor = page?.fontColor || defaultPage.fontColor; - - return ( - - ); -}; -export default memo(ButtonCard); diff --git a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditBadges.tsx b/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditBadges.tsx deleted file mode 100644 index f0049d7..0000000 --- a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditBadges.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import { Button } from "@/components/Buttons"; -import Dialog from "@/components/Dialogs"; -import { saveBadges } from "@/services/PageService"; -import { PageProps } from "@/types/PageProps"; -import { badgeList } from "@/utils/IconsList"; -import { errorToast } from "@/utils/toaster"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { memo } from "react"; -import { useForm } from "react-hook-form"; -import { z } from "zod"; - -const createBadgesFormSchema = z.object({ - badges: z.string().array(), -}); - -type CreateBadgesFormData = z.infer; - -type DialogEditBadgesProps = { - isOpen: boolean; - page: PageProps; - setIsOpen: (value: boolean) => void; -}; - -const DialogEditBadges = ({ isOpen, page, setIsOpen }: DialogEditBadgesProps) => { - const submitPageBadges = (data: CreateBadgesFormData) => { - if (data.badges.length <= 10) { - saveBadges(data.badges, page.pagename) - .then(() => { - setIsOpen(false); - window.location.reload(); - }) - .catch(error => { - errorToast(error); - }); - } else { - errorToast("You can only show a maximum of 10 badges"); - } - }; - - const { - watch, - handleSubmit, - setValue, - formState: { isSubmitting }, - } = useForm({ - resolver: zodResolver(createBadgesFormSchema), - defaultValues: { badges: page.badges || [] }, - }); - - const pageBadges = watch("badges"); - return ( - -
-
- {Array.from(badgeList).map((badge, idx) => ( - -1 ? "bg-violet-200 text-violet-800 " : "text-white"}` - } - onClick={() => { - if (pageBadges.indexOf(badge[0]) > -1) { - const newBadges = pageBadges.filter(value => { - return !(badge[0] === value); - }); - setValue("badges", newBadges); - } else { - setValue("badges", [...pageBadges, badge[0]]); - } - }} - > - {badge[1].label} - - ))} -
-
- ); -}; - -export default memo(DialogEditBadges); diff --git a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditInfos.tsx b/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditInfos.tsx deleted file mode 100644 index 7afd744..0000000 --- a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditInfos.tsx +++ /dev/null @@ -1,130 +0,0 @@ -import { Button } from "@/components/Buttons"; -import Dialog from "@/components/Dialogs"; -import { Input } from "@/components/Inputs"; -import { checkPagename, savePageInfos } from "@/services/PageService"; -import { PageProps } from "@/types/PageProps"; -import { errorToast } from "@/utils/toaster"; -import { CheckIcon, XMarkIcon } from "@heroicons/react/20/solid"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useEffect, useState } from "react"; -import { memo } from "react"; -import { useForm } from "react-hook-form"; -import { z } from "zod"; - -const createInfosFormSchema = z.object({ - uname: z.string().nonempty("Display Name is required").min(1, "Display Name must have at least 4 characters"), - bio: z.string(), - pagename: z - .string() - .nonempty("Page name is required") - .min(4, "Page name must have at least 4 characters") - .refine(value => /^[a-zA-Z0-9_.]+$/.test(value), "Page Name allows only alphabets, numbers, _ or ."), -}); - -type CreateInfosFormData = z.infer; - -type DialogEditInfosProps = { - isOpen: boolean; - page: PageProps; - setIsOpen: (value: boolean) => void; -}; - -const DialogEditInfos = ({ isOpen, setIsOpen, page }: DialogEditInfosProps) => { - const [newPagename, setNewPagename] = useState(""); - const [isPagenameAvailable, setPagenameAvailable] = useState(true); - - useEffect(() => { - const pagenameQuery = setTimeout(() => { - if (page?.pagename && newPagename === page.pagename) { - setPagenameAvailable(true); - } else if (newPagename && newPagename.length > 0) - checkPagename(newPagename) - .then(response => { - setPagenameAvailable(response.isAvailable); - }) - .catch(error => { - errorToast(error); - }); - }, 300); - return () => { - clearTimeout(pagenameQuery); - }; - }, [newPagename]); - - const submitPageInfos = (data: CreateInfosFormData) => { - savePageInfos(data.uname, data.bio, page.pagename, newPagename?.length > 1 ? newPagename : page.pagename) - .then(() => { - setIsOpen(false); - window.location.reload(); - }) - .catch(err => { - errorToast(err); - }); - }; - - const { - watch, - register, - handleSubmit, - formState: { errors, isSubmitting }, - } = useForm({ - resolver: zodResolver(createInfosFormSchema), - defaultValues: { uname: page?.uname, bio: page?.bio, pagename: page?.pagename }, - }); - - if (watch("pagename") !== newPagename) setNewPagename(watch("pagename")); - - return ( - -
- - - ) : ( - - ) - } - /> - -
- ); -}; - -export default memo(DialogEditInfos); diff --git a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditLink.tsx b/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditLink.tsx deleted file mode 100644 index 9810708..0000000 --- a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditLink.tsx +++ /dev/null @@ -1,198 +0,0 @@ -import { Button } from "@/components/Buttons"; -import Dialog from "@/components/Dialogs/Dialog"; -import { Input, RadioGroup } from "@/components/Inputs"; -import { deleteLink, updateLink } from "@/services/LinkService"; -import { LinkProps } from "@/types/LinkProps"; -import { PageProps } from "@/types/PageProps"; -import { errorToast } from "@/utils/toaster"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { memo, useState } from "react"; -import { useForm } from "react-hook-form"; -import { z } from "zod"; -import AutoCompleteFolders from "../AutoCompleteFolders"; -import ConfirmationDialog from "@/components/Dialogs/ConfirmationDialog"; - -type DialogEditLinkProps = { - page: PageProps; - link: LinkProps; - setSelectedLink: (value: LinkProps | null) => void; -}; - -const createLinkFormSchema = z.object({ - _id: z.string(), - url: z.string().nonempty("Url is required"), - label: z.string().nonempty("Link label is required"), - embedded: z.string().nonempty(), - isFolder: z.boolean(), - folderOwner: z.string().nullish(), -}); - -// TODO - add banner to form -const DialogEditLink = ({ page, link, setSelectedLink }: DialogEditLinkProps) => { - const { - watch, - register, - setValue, - handleSubmit, - formState: { errors, isSubmitting }, - } = useForm({ - resolver: zodResolver(createLinkFormSchema), - defaultValues: { - _id: link._id, - url: link.url, - label: link.label, - embedded: link.embedded, - isFolder: link.isFolder, - folderOwner: link.folderOwner, - }, - }); - const [confirmationDialog, setConfirmationDialog] = useState(false); - - const submitLinkInfos = (data: LinkProps) => { - updateLink(data, page.pagename) - .then(() => { - setSelectedLink(null); - window.location.reload(); - }) - .catch(error => { - errorToast(error); - }); - }; - - const isFolder = watch("isFolder"); - return ( - { - setSelectedLink(null); - }} - > -
- {/* TODO - move this to the side of Save Button */} -
- ); -}; - -export default memo(DialogEditLink); diff --git a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditSocials.tsx b/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditSocials.tsx deleted file mode 100644 index 9494775..0000000 --- a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogEditSocials.tsx +++ /dev/null @@ -1,186 +0,0 @@ -import { memo, useEffect, useState } from "react"; -import { PageProps, PageSocialMediaProps } from "@/types/PageProps"; -import { PlusIcon, XMarkIcon } from "@heroicons/react/20/solid"; -import Dialog from "@/components/Dialogs"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm } from "react-hook-form"; -import { z } from "zod"; -import { errorToast, successToast } from "@/utils/toaster"; -import { saveSocialMedia } from "@/services/PageService"; -import { Button } from "@/components/Buttons"; -import BioIcon from "@/app/(BioLayout)/[username]/BioIcon"; -import { getSocialIcon, socialIconsList } from "@/utils/IconsList"; -import { AutoComplete, Input } from "@/components/Inputs"; - -const createSocialsFormSchema = z.object({ - account: z.string().nonempty("This field is a required"), -}); - -type CreateSocialsFormData = z.infer; - -type DialogEditSocialsProps = { - isOpen: boolean; - page: PageProps; - setIsOpen: (value: boolean) => void; -}; - -// TODO - refactor -const DialogEditSocials = ({ isOpen, page, setIsOpen }: DialogEditSocialsProps) => { - const [items, setItems] = useState(); - const [mediaSelected, setMediaSelected] = useState("discord"); - - useEffect(() => { - if (isOpen && page && page.socialMedias) { - setItems(Object.assign([], page.socialMedias)); - } - }, [isOpen]); - - const submitNewSocial = (data: CreateSocialsFormData) => { - if (data.account && items && items.length < 25) { - if (items?.some(item => item.key === mediaSelected)) { - errorToast("This account has already been added!"); - } else { - const newItems = Object.assign([], items); - newItems?.push({ - key: mediaSelected, - username: data.account, - }); - setItems(newItems); - } - } - }; - - const { - watch, - register, - handleSubmit, - formState: { errors, isSubmitting }, - } = useForm({ - resolver: zodResolver(createSocialsFormSchema), - defaultValues: { account: "" }, - }); - - const account = watch("account"); - - return ( - -
- {/* SOCIALS ADDED */} -
-
{items?.length || "0"}/25
- {items?.map((item, idx) => ( -
- -
- { - const newItems = items.filter((value: PageSocialMediaProps) => { - return !(item.key === value.key && item.username === value.username); - }); - setItems(newItems); - }} - /> -
-
- ))} -
- {/* SOCIALS INPUTS */} -
- -
-
- -
- {mediaSelected ? ( -
- {getSocialIcon(mediaSelected)?.url?.(account) ? ( - <> - ↪ will open this url -
- - {getSocialIcon(mediaSelected)?.url?.("")} - - {account || "😠 fill the required input"} - {account || "😡 fill the required input"} - - - - ) : ( - <> - ↪ will be copied to clipboard: -
- { - successToast(`Copied: ${account}`); - if (navigator.clipboard) { - navigator.clipboard.writeText(account); - } - }} - > - {account || "😠 fill the required input"} - {account || "😡 fill the required input"} - - - )} -
- ) : null} - -
-
- ); -}; - -export default memo(DialogEditSocials); diff --git a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogNewLink.tsx b/src/app/(BioLayout)/edit/[username]/Dialogs/DialogNewLink.tsx deleted file mode 100644 index 9bc394a..0000000 --- a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogNewLink.tsx +++ /dev/null @@ -1,150 +0,0 @@ -import { Button } from "@/components/Buttons"; -import Dialog from "@/components/Dialogs/Dialog"; -import { Input, RadioGroup } from "@/components/Inputs"; -import { createLink } from "@/services/LinkService"; -import { LinkProps } from "@/types/LinkProps"; -import { PageProps } from "@/types/PageProps"; -import { errorToast } from "@/utils/toaster"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { memo } from "react"; -import { useForm } from "react-hook-form"; -import { z } from "zod"; -import AutoCompleteFolders from "../AutoCompleteFolders"; - -type DialogNewLinkProps = { - isOpen: boolean; - page: PageProps; - setIsOpen: (value: boolean) => void; -}; - -const createLinkFormSchema = z.object({ - url: z.string().nonempty("Url is required"), - label: z.string().nonempty("Link label is required"), - embedded: z.string().nonempty(), - isFolder: z.boolean(), - folderOwner: z.string(), -}); - -// TODO - add banner to form -const DialogNewLink = ({ isOpen, page, setIsOpen }: DialogNewLinkProps) => { - const { - watch, - register, - setValue, - handleSubmit, - formState: { errors, isSubmitting }, - } = useForm({ - resolver: zodResolver(createLinkFormSchema), - defaultValues: { url: "", label: "", embedded: "none", isFolder: false, folderOwner: "" }, - }); - - const submitLinkInfos = (data: LinkProps) => { - createLink(data, page.pagename) - .then(() => { - setIsOpen(false); - window.location.reload(); - }) - .catch(error => { - errorToast(error); - }); - }; - - const isFolder = watch("isFolder"); - return ( - -
- Link, - }, - { - value: "folder", - component: Folder, - }, - ]} - onChange={(value: string) => { - setValue("isFolder", value === "folder"); - setValue("embedded", "none"); - setValue("url", value === "folder" ? "/" : ""); - setValue("folderOwner", ""); - }} - /> - {/* TODO - this is bugged on mobile */} - None, - }, - { - value: "spotify", - component: Spotify, - color: "#1ed760", - }, - { - value: "youtube", - component: Youtube, - color: "#fe0000", - }, - { - value: "soundcloud", - component: Soundcloud, - color: "#ff5500", - }, - ]} - onChange={(value: string) => { - setValue("embedded", value); - }} - /> - { - setValue("folderOwner", value); - }} - /> - - -
- ); -}; - -export default memo(DialogNewLink); diff --git a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogNewPage.tsx b/src/app/(BioLayout)/edit/[username]/Dialogs/DialogNewPage.tsx deleted file mode 100644 index 59c03e5..0000000 --- a/src/app/(BioLayout)/edit/[username]/Dialogs/DialogNewPage.tsx +++ /dev/null @@ -1,161 +0,0 @@ -import { Button } from "@/components/Buttons"; -import Dialog from "@/components/Dialogs"; -import { Input } from "@/components/Inputs"; -import { checkPagename, createPage } from "@/services/PageService"; -import { PageProps } from "@/types/PageProps"; -import { errorToast, successToast } from "@/utils/toaster"; -import { CheckIcon, XMarkIcon } from "@heroicons/react/20/solid"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { memo, useEffect, useState } from "react"; -import { useForm } from "react-hook-form"; -import { z } from "zod"; - -type DialogNewPageProps = { - isOpen: boolean; - setIsOpen: (value: boolean) => void; - addNewPage: (page: PageProps) => void; -}; - -const pagenamesList = [ - "SharKb0y", - "LavaGr1ll", - "h0meSlander", - "El0nFluSheD", - "Crytp0Boy", - "XablinhA", - "Br3ak1NgBeD", - "LuxC00L", - "PewDiePie", - "LewDiePie", - "Th4n0sTh3M4LL", - "4TheH0rde", - "Dr4c4ryS", - "Le4veMe4l0n3", - "M4ND4L0R14N", - "3mpty", - "YE", -]; - -const createPageFormSchema = z.object({ - pagename: z - .string() - .nonempty("Page name is required") - .min(4, "Page name must have at least 4 characters") - .refine(value => /^[a-zA-Z0-9_.]+$/.test(value), "Page Name allows only alphabets, numbers, _ or ."), -}); - -type CreatePageFormData = z.infer; - -const DialogNewPage = ({ isOpen, setIsOpen, addNewPage }: DialogNewPageProps) => { - const [pagename, setPagename] = useState(""); - const [isPagenameAvailable, setPagenameAvailable] = useState(true); - const [examplePagename, setExamplePagename] = useState(""); - - const { - watch, - reset, - register, - handleSubmit, - formState: { errors, isSubmitting }, - } = useForm({ resolver: zodResolver(createPageFormSchema) }); - - if (watch("pagename") !== pagename) setPagename(watch("pagename")); - - useEffect(() => { - if (isOpen) { - reset(); - setPagename(""); - setExamplePagename(pagenamesList[~~(pagenamesList.length * Math.random())]); - } - }, [isOpen]); - - useEffect(() => { - const pagenameQuery = setTimeout(() => { - if (pagename && pagename.length > 0) - checkPagename(pagename) - .then(response => { - setPagenameAvailable(response.isAvailable); - }) - .catch(err => { - errorToast(err); - }); - }, 300); - return () => { - clearTimeout(pagenameQuery); - }; - }, [pagename]); - - const submitNewPage = (data: CreatePageFormData) => { - createPage(data.pagename) - .then(res => { - addNewPage(res.page); - successToast("Page successfully created."); - setIsOpen(false); - }) - .catch(err => { - errorToast(err); - }); - }; - - return ( - - Please choose your Page name~ -
↪ zoz.bio/ - {pagename ? pagename : examplePagename} - - } - isOpen={isOpen} - setIsOpen={setIsOpen} - > -
-

- To prevent a rush of BOTs trying to claim all short-sized page names, you can only create pages with at least - 4 characters. However, if you still want a short page name, there are a few ways to obtain one: -
- 1. Subscriptions. (COMING SOON) -
- 2. Prove that you own that page name on other social media platforms such as Instagram, Twitter, TikTok, etc. -
- 3. Future events on Discord. (COMING SOON) -
- 4. Maybe be a nice and lovely person on our Discord server?! 😳 -
-
- Additionally, you can create up to 2 pages per account without any subscription. -

-
- -
- - ) : ( - - ) - } - /> - -
- ); -}; - -export default memo(DialogNewPage); diff --git a/src/app/(BioLayout)/edit/[username]/Edit.tsx b/src/app/(BioLayout)/edit/[username]/Edit.tsx deleted file mode 100644 index db7b4fa..0000000 --- a/src/app/(BioLayout)/edit/[username]/Edit.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import BioCard from "@/app/(BioLayout)/[username]/BioCard"; -import BioNavigation from "@/app/(BioLayout)/[username]/BioNavigation"; -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { cookies } from "next/headers"; -import Image from "next/image"; -import React from "react"; -import EditAvatar from "./EditAvatar"; -import EditBadges from "./EditBadges"; -import EditInfos from "./EditInfos"; -import EditSocials from "./EditSocials"; -import EditBackground from "./EditBackground"; -import EditLinks from "./EditLinks"; -import CssDoodle from "@/components/CssDoodle/CssDoodle"; - -export const EditComponent = ({ page }: { page: PageProps }) => { - const cookieStore = cookies(); - const userCookie = cookieStore.get("zoz_user"); - const user = userCookie ? JSON.parse(userCookie?.value) : undefined; - const backgroundUrl = page?.backgroundUrl || defaultPage.bgUrl; - const backGroundOpacity = page?.backGroundOpacity || defaultPage.bgOpacity; - - return ( - <> -
- {backgroundUrl ? ( -
- {`${page.pagename} -
- ) : ( - - )} - -
- -
- - -
- - - -
-
-
- -
- -
-
-
- - ); -}; diff --git a/src/app/(BioLayout)/edit/[username]/EditAvatar.tsx b/src/app/(BioLayout)/edit/[username]/EditAvatar.tsx deleted file mode 100644 index 11268bc..0000000 --- a/src/app/(BioLayout)/edit/[username]/EditAvatar.tsx +++ /dev/null @@ -1,78 +0,0 @@ -"use client"; -import { memo } from "react"; -import Image from "next/image"; -import { ArrowUpTrayIcon } from "@heroicons/react/24/outline"; -import { uploadAvatar } from "@/services/PageService"; -import { errorToast } from "@/utils/toaster"; -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { twMerge } from "tailwind-merge"; - -const EditAvatar = ({ pageName, page }: { pageName: string; page: PageProps }) => { - const pfpUrl = page?.pfpUrl || defaultPage.pfpUrl; - const primaryColor = page?.primaryColor || defaultPage.primaryColor; - - const changeAvatar = (file: File) => { - uploadAvatar(file, pageName) - .then(() => { - window.location.reload(); - }) - .catch(error => { - errorToast(error); - }); - }; - - return ( -
- -
- ); -}; - -export default memo(EditAvatar); diff --git a/src/app/(BioLayout)/edit/[username]/EditBackground.tsx b/src/app/(BioLayout)/edit/[username]/EditBackground.tsx deleted file mode 100644 index 4b1d605..0000000 --- a/src/app/(BioLayout)/edit/[username]/EditBackground.tsx +++ /dev/null @@ -1,73 +0,0 @@ -"use client"; -import { uploadBackground } from "@/services/PageService"; -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { errorToast } from "@/utils/toaster"; -import { ArrowUpTrayIcon, Cog6ToothIcon } from "@heroicons/react/24/outline"; -import { memo } from "react"; -import EditColors from "./EditColors"; -import clsx from "clsx"; -import ButtonCard from "./ButtonCard"; - -const EditBackground = ({ page }: { page: PageProps }) => { - const cardBlur = page?.cardBlur || defaultPage.cardBlur; - const cardHueRotate = page?.cardHueRotate || defaultPage.cardHueRotate; - const primaryColor = page?.primaryColor || defaultPage.primaryColor; - - const changeBackground = (file: File) => { - uploadBackground(file, page.pagename) - .then(() => { - window.location.reload(); - }) - .catch(error => { - errorToast(error); - }); - }; - - return ( -
- -
- - console.log("click")} - iconAdornment={} - /> -
-
- ); -}; -export default memo(EditBackground); diff --git a/src/app/(BioLayout)/edit/[username]/EditBadges.tsx b/src/app/(BioLayout)/edit/[username]/EditBadges.tsx deleted file mode 100644 index 8f73042..0000000 --- a/src/app/(BioLayout)/edit/[username]/EditBadges.tsx +++ /dev/null @@ -1,47 +0,0 @@ -"use client"; -import { DefaultTooltip } from "@/components/Tooltip"; -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { getBadge } from "@/utils/IconsList"; -import { PencilSquareIcon } from "@heroicons/react/24/outline"; -import { memo, useState } from "react"; -import DialogEditBadges from "./Dialogs/DialogEditBadges"; - -const EditBadges = ({ page }: { page: PageProps }) => { - const badges = page?.badges != null ? page.badges : defaultPage.pageBadges; - const secondaryColor = page?.secondaryColor || defaultPage.secondaryColor; - const fontColor = page?.fontColor || defaultPage.fontColor; - const [dialogEditBadges, setDialogEditBadges] = useState(false); - - return ( - -
{ - setDialogEditBadges(true); - }} - > -
- {badges && - badges.map((badge, idx) => - getBadge(badge) ? ( - - {getBadge(badge)?.label} - - ) : null - )} -
- -
- -
- ); -}; -export default memo(EditBadges); diff --git a/src/app/(BioLayout)/edit/[username]/EditInfos.tsx b/src/app/(BioLayout)/edit/[username]/EditInfos.tsx deleted file mode 100644 index 004fccb..0000000 --- a/src/app/(BioLayout)/edit/[username]/EditInfos.tsx +++ /dev/null @@ -1,70 +0,0 @@ -"use client"; -import { memo, useState } from "react"; -import { PageProps } from "@/types/PageProps"; -import { getAdornmentIcon } from "@/utils/IconsList"; -import DialogEditInfos from "./Dialogs/DialogEditInfos"; -import { PencilSquareIcon } from "@heroicons/react/24/outline"; -import { DefaultTooltip } from "@/components/Tooltip"; -import { defaultPage } from "@/utils/BioVariables"; - -const EditInfos = ({ page }: { page: PageProps }) => { - const fontColor = page?.fontColor || defaultPage.fontColor; - const [dialogEditInfos, setDialogEditInfos] = useState(false); - - return ( - -
{ - setDialogEditInfos(true); - }} - > -
-

- - {page?.uname || "No name~"} - - {page?.adornment ? ( - {getAdornmentIcon(page.adornment)?.label} - ) : null} - - -

- - zoz.bio/{page?.pagename} - -
- {page?.bio} -
-
- -
- -
- ); -}; - -export default memo(EditInfos); diff --git a/src/app/(BioLayout)/edit/[username]/EditLink.tsx b/src/app/(BioLayout)/edit/[username]/EditLink.tsx deleted file mode 100644 index 15a9f8d..0000000 --- a/src/app/(BioLayout)/edit/[username]/EditLink.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import { LinkProps } from "@/types/LinkProps"; -import { PageProps } from "@/types/PageProps"; -import { defaultPage } from "@/utils/BioVariables"; -import { getIcon } from "@/utils/IconsList"; -import clsx from "clsx"; -import Image from "next/image"; -import Link from "next/link"; -import { memo } from "react"; - -type EditLinkProps = { - page: PageProps; - link: LinkProps; - setFolderOwner: (link: LinkProps) => void; - editLink?: (link: LinkProps) => void; -}; - -const BannerComponent = ({ link, fontColor }: { link: LinkProps; fontColor: string }) => { - const typeCover = link.bannerUrl || ""; - - return ( - <> - {typeCover && ( - link banner - )} -
- {`folder - Edit -
- - ); -}; - -const LinkComponent = ({ page, link, setFolderOwner }: EditLinkProps) => { - const fontColor = page?.fontColor || defaultPage.fontColor; - const h2ClassName = - "sm:ml-7 flex-1 flex-shrink-0 truncate whitespace-pre-wrap text-center font-bold tracking-wide overflow-visible whitespace-nowrap text-lg sm:text-xl"; - if (link.isFolder) - return ( -
{ - link.isSelected = true; - setFolderOwner(link); - }} - > -

- {/* TODO - UX upgrade */} - {link.isSelected ? "Click to go back" : link.label} -

-
- ); - return ( - -

- {link.label} -

- - ); -}; - -const EditLink = ({ page, link, setFolderOwner, editLink }: EditLinkProps) => { - const primaryColor = page?.primaryColor || defaultPage.primaryColor; - const fontColor = page?.fontColor || defaultPage.fontColor; - const cardBlur = page?.cardBlur || defaultPage.cardBlur; - const cardHueRotate = page?.cardHueRotate || defaultPage.cardHueRotate; - - const cardStyle = { - backgroundColor: `rgb(${primaryColor.r},${primaryColor.g},${primaryColor.b},${primaryColor.a})`, - }; - - return ( - <> -
-
editLink && editLink(link)} - > - -
-
- -
-
- -
-
- - ); -}; - -export default memo(EditLink); diff --git a/src/app/(BioLayout)/edit/[username]/EditLinks.tsx b/src/app/(BioLayout)/edit/[username]/EditLinks.tsx deleted file mode 100644 index 35866b0..0000000 --- a/src/app/(BioLayout)/edit/[username]/EditLinks.tsx +++ /dev/null @@ -1,118 +0,0 @@ -"use client"; -import BioIFrames from "@/app/(BioLayout)/[username]/BioIFrames"; -import { LinkProps } from "@/types/LinkProps"; -import { PageProps } from "@/types/PageProps"; -import { Cog6ToothIcon, PlusIcon } from "@heroicons/react/20/solid"; -import clsx from "clsx"; -import { memo, useState } from "react"; -import ButtonCard from "./ButtonCard"; -import DialogNewLink from "./Dialogs/DialogNewLink"; -import EditLink from "./EditLink"; -import DialogEditLink from "./Dialogs/DialogEditLink"; - -type EditLinksProps = { - page: PageProps; -}; - -const EditLinks = ({ page }: EditLinksProps) => { - const [folderOwner, setFolderOwner] = useState(); - const [selectedLink, setSelectedLink] = useState(); - const [dialogNewLink, setDialogNewLink] = useState(false); - - const pageLinks = page?.pageLinks - ? folderOwner - ? page.pageLinks - .filter(link => { - return link.folderOwner === folderOwner._id; - }) - .sort(function (a, b) { - return a.position - b.position; - }) - : page.pageLinks - .filter(link => { - return !link.folderOwner; - }) - .sort(function (a, b) { - return a.position - b.position; - }) - : []; - - return ( - <> -
- setDialogNewLink(true)} - iconAdornment={} - /> - {page.subscription !== "none" && ( - console.log("click")} - iconAdornment={} - /> - )} -
- {folderOwner ? ( -
- { - link.isSelected = false; - setFolderOwner(null); - }} - editLink={() => { - setSelectedLink(folderOwner); - }} - /> -
- ) : null} - {pageLinks.map((link, idx) => - link.embedded === "none" ? ( -
- { - setSelectedLink(link); - }} - /> -
- ) : ( -
-
{ - setSelectedLink(link); - }} - > - Click to Edit -
-
setSelectedLink(link)}> - -
-
- ) - )} - - {selectedLink && ( - { - setSelectedLink(link); - }} - page={page} - link={selectedLink} - /> - )} - - ); -}; - -export default memo(EditLinks); diff --git a/src/app/(BioLayout)/edit/[username]/EditSocials.tsx b/src/app/(BioLayout)/edit/[username]/EditSocials.tsx deleted file mode 100644 index 518e6af..0000000 --- a/src/app/(BioLayout)/edit/[username]/EditSocials.tsx +++ /dev/null @@ -1,31 +0,0 @@ -"use client"; -import BioIcon from "@/app/(BioLayout)/[username]/BioIcon"; -import { DefaultTooltip } from "@/components/Tooltip"; -import { PageProps } from "@/types/PageProps"; -import { PencilSquareIcon } from "@heroicons/react/24/outline"; -import { memo, useState } from "react"; -import DialogEditSocials from "./Dialogs/DialogEditSocials"; -import { defaultPage } from "@/utils/BioVariables"; - -const EditSocials = ({ page }: { page: PageProps }) => { - const socialMedias = page?.socialMedias?.length > 0 ? page.socialMedias : defaultPage.pageSocialMedias; - const [dialogEditSocials, setDialogEditSocials] = useState(false); - - return ( - -
{ - setDialogEditSocials(true); - }} - > -
- {socialMedias && socialMedias.map((media, idx) => )} -
- -
- -
- ); -}; -export default memo(EditSocials); diff --git a/src/app/(BioLayout)/edit/[username]/layout.tsx b/src/app/(BioLayout)/edit/[username]/layout.tsx deleted file mode 100644 index e3fb0c0..0000000 --- a/src/app/(BioLayout)/edit/[username]/layout.tsx +++ /dev/null @@ -1,37 +0,0 @@ -// import Script from "next/script"; -import "@/app/(BioLayout)/biolayout.css"; -import "react-toastify/dist/ReactToastify.css"; -import "tippy.js/animations/perspective.css"; -import "tippy.js/dist/tippy.css"; -import "tippy.js/themes/translucent.css"; -import ToastProvider from "@/providers/ToastProvider"; -import { ReactNode } from "react"; -import Analytics from "@/components/Analytics"; - -// METADATA EXAMPLE - https://nextjs.org/docs/app/api-reference/functions/generate-metadata - -export default function BioLayout({ children }: { children: ReactNode }) { - //TODO - OG GRAPH IMAGE TWITTER E FB - return ( - - - - - - - - {process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_HOME && process.env.NEXT_PUBLIC_MICROSOFT_CLARITY && ( - - )} - {children} - - - - ); -} diff --git a/src/app/(BioLayout)/edit/[username]/page.tsx b/src/app/(BioLayout)/edit/[username]/page.tsx deleted file mode 100644 index 7c5d857..0000000 --- a/src/app/(BioLayout)/edit/[username]/page.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { QueryClientProviderComponent } from "@/providers/QueryClientProvider"; -import { fetchEditPage } from "@/services/PageService"; -import { PageProps } from "@/types/PageProps"; -import { ZOZ_META_DESCRIPTION, ZOZ_META_TITLE } from "@/utils/Constants"; -import { cookies } from "next/headers"; -import { NotFound } from "../../[username]/NotFound"; -import { EditComponent } from "./Edit"; - -let pageData: PageProps | undefined = undefined; - -export async function generateMetadata({ params }: { params: { username: string } }) { - if (pageData) { - return { - // TODO - generate profile img, change title - title: `zoz.bio - ${params.username}`, - description: pageData.bio || ZOZ_META_DESCRIPTION, - // openGraph: { - // images: ['/some-specific-page-image.jpg', ...previousImages], - // }, - }; - } - - return { - title: ZOZ_META_TITLE, - description: ZOZ_META_DESCRIPTION, - }; -} - -export default async function BioPage({ params }: { params: { username: string } }) { - const res = await fetchEditPage(params.username, cookies().toString()); - pageData = res?.page; - - return ( -
- - {pageData ? : } - -
- ); -} diff --git a/src/app/(RootLayout)/about/page.tsx b/src/app/(RootLayout)/about/page.tsx deleted file mode 100644 index 2b2f53a..0000000 --- a/src/app/(RootLayout)/about/page.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function AboutPage() { - return
about page
; -} diff --git a/src/app/(RootLayout)/account/Account.tsx b/src/app/(RootLayout)/account/Account.tsx deleted file mode 100644 index 48b8622..0000000 --- a/src/app/(RootLayout)/account/Account.tsx +++ /dev/null @@ -1,88 +0,0 @@ -"use client"; -import { getAccount, sendConfirmEmail } from "@/services/AccountService"; -import { PageProps } from "@/types/PageProps"; -import { UserProps } from "@/types/UserProps"; -import { errorToast, successToast } from "@/utils/toaster"; -import { useQuery } from "@tanstack/react-query"; -import { deleteCookie } from "cookies-next"; -import { useRouter } from "next/navigation"; -import { useEffect, useState } from "react"; -import { AccountTabs } from "./AccountTabs"; -import { LabelButton } from "@/components/Buttons"; - -// TODO - maybe change this to server component -const AccountComponent = () => { - const [pages, setPages] = useState(); - const [account, setAccount] = useState(); - const router = useRouter(); - - useEffect(() => { - const scrollContainer = document.getElementById("pages"); - if (scrollContainer) { - scrollContainer.addEventListener("wheel", evt => { - evt.preventDefault(); - scrollContainer.scrollLeft += evt.deltaY; - }); - } - }); //TODO - fix this use effect later add dependency - - const addNewPage = (page: PageProps) => { - if (pages) setPages([...pages, page]); - }; - - // TODO - query cache - const queryAccount = useQuery({ - queryKey: ["getAccount"], - queryFn: () => getAccount(), - }); - - if (queryAccount.isError) { - if (queryAccount.error === "Unauthorized") { - errorToast("Session expired, please sign in again"); - deleteCookie("zoz_user"); - router.refresh(); - router.push("/login"); - } else { - errorToast(queryAccount.error as Error); - } - } - - if (queryAccount.data?.pages && !pages) { - setPages(queryAccount.data.pages); - } - - if (queryAccount.data?.user && !account) { - setAccount(queryAccount.data.user); - } - - return ( -
- {account && !account.isEmailConfirmed && ( -
- {/* TODO - send confirmation email and validade time to be 1min cooldown */} - - We noticed that your email has not been confirmed yet. So your account is limited, and can be suspended - without further notice. Check your spam folder if you can't find it, or{" "} - { - sendConfirmEmail(account.email || "", "aa") - .then(() => { - successToast("Confirmation email successfully sended, check your inbox or spam directory"); - }) - .catch(err => { - errorToast(err); - }); - }} - /> - -
- )} - -
- ); -}; - -export default AccountComponent; diff --git a/src/app/(RootLayout)/account/AccountTabSettings.tsx b/src/app/(RootLayout)/account/AccountTabSettings.tsx deleted file mode 100644 index a7e0a63..0000000 --- a/src/app/(RootLayout)/account/AccountTabSettings.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import BioCard from "@/app/(BioLayout)/[username]/BioCard"; -import { Input } from "@/components/Inputs"; -import { UserProps } from "@/types/UserProps"; -import { memo } from "react"; - -const AccountTabSettings = ({ account }: { account?: UserProps }) => { - return ( - -
-
- - - -
-
-
- ); -}; - -export default memo(AccountTabSettings); diff --git a/src/app/(RootLayout)/account/AccountTabSubscriptions.tsx b/src/app/(RootLayout)/account/AccountTabSubscriptions.tsx deleted file mode 100644 index 86f5b50..0000000 --- a/src/app/(RootLayout)/account/AccountTabSubscriptions.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import BioCard from "@/app/(BioLayout)/[username]/BioCard"; -import { UserProps } from "@/types/UserProps"; -import { memo } from "react"; - -const AccountTabSubscriptions = ({ account }: { account?: UserProps }) => { - return ( - -
-
- -
-
-
- ); -}; - -export default memo(AccountTabSubscriptions); diff --git a/src/app/(RootLayout)/account/AccountTabs.tsx b/src/app/(RootLayout)/account/AccountTabs.tsx deleted file mode 100644 index 7305a35..0000000 --- a/src/app/(RootLayout)/account/AccountTabs.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import Tabs from "@/components/Tabs"; -import { Tooltip } from "@/components/Tooltip"; -import { PageProps } from "@/types/PageProps"; -import { UserProps } from "@/types/UserProps"; -import Image from "next/image"; -import { useState } from "react"; -import DialogNewPage from "../../(BioLayout)/edit/[username]/Dialogs/DialogNewPage"; -import AccountTabSettings from "./AccountTabSettings"; -import AccountTabSubscriptions from "./AccountTabSubscriptions"; -import { defaultPage } from "@/utils/BioVariables"; -import { useRouter } from "next/navigation"; - -type AcountTabsProps = { - account: UserProps | undefined; - pages: PageProps[] | undefined; - addNewPage: (page: PageProps) => void; -}; - -export const AccountTabs = ({ account, pages, addNewPage }: AcountTabsProps) => { - const [dialogNewPageOpen, setDialogNewPageOpen] = useState(false); - const router = useRouter(); - - return ( - <> -
-
- - Create a new page or click on the page you want to edit -
- -
-
setDialogNewPageOpen(true)} - className="group mx-1 my-2 flex h-20 w-20 2xl:h-24 2xl:w-24 flex-shrink-0 cursor-pointer flex-col items-center justify-center rounded-full bg-secondary/30 ring-4 ring-violet-200/80 hover:bg-secondary/50 hover:ring-white" - > - + - New Page -
- - {pages - ? pages.map((page: PageProps, idx: number) => ( -
- - { - router.push(`/edit/${page.pagename}`); - }} - alt="pfp" - quality={50} - placeholder="empty" - loading="lazy" - /> - -
- )) - : null} -
- -
- {/* TODO melhorar essa tabs */} - , - }, - { - label: "⚠️ Subscriptions", - disabled: true, - component: , - }, - { - label: "💸 Pages Analytics", - disabled: true, - component: , - }, - { - label: "😍 🫣 🤓", - disabled: true, - component: , - }, - ]} - /> -
-
- - - ); -}; diff --git a/src/app/(RootLayout)/account/AutoCompleteFolders.tsx b/src/app/(RootLayout)/account/AutoCompleteFolders.tsx deleted file mode 100644 index bcbf11b..0000000 --- a/src/app/(RootLayout)/account/AutoCompleteFolders.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React, { memo } from "react"; -import { useQuery } from "@tanstack/react-query"; -import { AutoComplete } from "@/components/Inputs"; -import { LinkProps } from "@/types/LinkProps"; -import { MediaIconProps } from "@/types/MediaIconProps"; -import { getIcon } from "@/utils/IconsList"; -import { getFolders } from "@/services/LinkService"; -import { errorToast } from "@/utils/toaster"; - -type AutoCompleteFoldersProps = { - label: string; - pagename: string; - disabled?: boolean; - iconAdornment?: JSX.Element; - selected?: string; - setSelected: (value: string) => void; -}; - -const AutoCompleteFolders = ({ - label, - disabled = false, - pagename, - selected = "", - setSelected, -}: AutoCompleteFoldersProps) => { - const queryPage = useQuery({ - queryKey: ["getFolders"], - queryFn: () => getFolders(pagename), - }); - - if (queryPage.isError) { - errorToast(queryPage.error as Error); - } - - const list = new Map([]); - list.set("", { - icon: getIcon("banned")?.icon || "", - label: "None", - }); - if (queryPage.data?.folders) { - queryPage.data.folders.map((folder: LinkProps) => { - list.set(folder._id, { - icon: getIcon(folder.icon)?.icon || "", - label: folder.label, - }); - }); - } - - return ( - - ); -}; - -export default memo(AutoCompleteFolders); diff --git a/src/app/(RootLayout)/account/page.tsx b/src/app/(RootLayout)/account/page.tsx deleted file mode 100644 index 68b5153..0000000 --- a/src/app/(RootLayout)/account/page.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import Redirect from "@/components/Redirect"; -import AccountComponent from "./Account"; -import { cookies } from "next/headers"; -import { QueryClientProviderComponent } from "@/providers/QueryClientProvider"; -import Main from "@/components/Main/Main"; - -export default function AccountPage() { - const cookieStore = cookies(); - const userCookie = cookieStore.get("zoz_user"); - // TODO - userCookie is enought to validate this I think, just test and remove const user - const user = userCookie ? JSON.parse(userCookie?.value) : undefined; - - if (user) - return ( -
- - - -
- ); - else return ; - // else return redirect("/") -} diff --git a/src/app/(RootLayout)/confirm/[token]/ConfirmationButton.tsx b/src/app/(RootLayout)/confirm/[token]/ConfirmationButton.tsx deleted file mode 100644 index c17f74d..0000000 --- a/src/app/(RootLayout)/confirm/[token]/ConfirmationButton.tsx +++ /dev/null @@ -1,25 +0,0 @@ -"use client"; -import { LabelButton } from "@/components/Buttons"; -import { sendConfirmEmail } from "@/services/AccountService"; -import { errorToast, successToast } from "@/utils/toaster"; -import { memo } from "react"; - -const ConfirmationButton = ({ email }: { email: string }) => { - return ( - { - sendConfirmEmail(email, "aa") - .then(() => { - successToast("Confirmation email successfully sended, check your inbox or spam directory"); - }) - .catch(err => { - errorToast(err); - }); - }} - /> - ); -}; -export default memo(ConfirmationButton); diff --git a/src/app/(RootLayout)/confirm/[token]/page.tsx b/src/app/(RootLayout)/confirm/[token]/page.tsx deleted file mode 100644 index 50168d0..0000000 --- a/src/app/(RootLayout)/confirm/[token]/page.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { Link } from "@/components/Buttons"; -import Main from "@/components/Main/Main"; -import Redirect from "@/components/Redirect"; -import { confirmEmail } from "@/services/TokenService"; -import { cookies } from "next/headers"; -import Image from "next/image"; -import ConfirmationButton from "./ConfirmationButton"; - -export default async function ConfirmPage({ params }: { params: { token: string } }) { - const cookieStore = cookies(); - const userCookie = cookieStore.get("zoz_user"); - const user = userCookie ? JSON.parse(userCookie?.value) : undefined; - - let confirmated = false; - try { - const req = await confirmEmail(params.token); - confirmated = req.confirmated; - } catch (err) { - confirmated = false; - } - - if (user?.isEmailConfirmed) return ; - - return ( -
- - login image - -

Account confirmation

- {confirmated ? ( -

- Account has been successfully confirmed{" "} - {user ? ( - - ) : ( - - )} -

- ) : ( -

- Token invalid or expired{" "} - {user ? ( - - ) : ( - - )} -

- )} -
- ); -} diff --git a/src/app/(RootLayout)/confirm/page.tsx b/src/app/(RootLayout)/confirm/page.tsx deleted file mode 100644 index da16bc2..0000000 --- a/src/app/(RootLayout)/confirm/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import Redirect from "@/components/Redirect"; - -export default function ConfirmPage() { - return ; -} diff --git a/src/app/(RootLayout)/contact/page.tsx b/src/app/(RootLayout)/contact/page.tsx deleted file mode 100644 index 680df90..0000000 --- a/src/app/(RootLayout)/contact/page.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function ContactPage() { - return
contact page
; -} diff --git a/src/app/(RootLayout)/home/Banner.tsx b/src/app/(RootLayout)/home/Banner.tsx deleted file mode 100644 index 495c3ef..0000000 --- a/src/app/(RootLayout)/home/Banner.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import Image from "next/image"; - -const Banner = () => { - return ( -
-
-
-

- Full customizable page just for you! -

-

- You can match your background with the colors your like, choose custom badges and show your favorite songs. -

-
-
- home image example -
-
-
- ); -}; -export default Banner; diff --git a/src/app/(RootLayout)/home/Hero.tsx b/src/app/(RootLayout)/home/Hero.tsx deleted file mode 100644 index f1b696b..0000000 --- a/src/app/(RootLayout)/home/Hero.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { LinkButton } from "@/components/Buttons"; -import Socials from "./Socials"; -import clsx from "clsx"; -import Username from "./Username"; - -const Hero = () => { - return ( -
-
- -

- Link all your socials in one place -

- -

- Manage one or more pages with just one account, create links and folders, track the views and engagement of - your socials and links and much more. -

- - Create Account - -
-
- ); -}; -export default Hero; diff --git a/src/app/(RootLayout)/home/Home.tsx b/src/app/(RootLayout)/home/Home.tsx deleted file mode 100644 index 6640933..0000000 --- a/src/app/(RootLayout)/home/Home.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import Banner from "./Banner"; -import Hero from "./Hero"; -// import Users from "./Users"; - -export default function Home() { - return ( - <> - - - {/* */} - - ); -} diff --git a/src/app/(RootLayout)/home/Socials.tsx b/src/app/(RootLayout)/home/Socials.tsx deleted file mode 100644 index 55b49a1..0000000 --- a/src/app/(RootLayout)/home/Socials.tsx +++ /dev/null @@ -1,24 +0,0 @@ -const Socials = () => { - const ICONS = [ - "/icons/social/discord.png", - "/icons/social/facebook.png", - "/icons/social/instagram.png", - "/icons/social/twitter.png", - "/icons/social/tiktok.png", - "/icons/social/spotify.png", - "/icons/social/youtube.png", - "/icons/social/github.png", - "/icons/social/steam.png", - ]; - - return ( -
- {ICONS.map((src, idx) => ( -
- {`icon`} -
- ))} -
- ); -}; -export default Socials; diff --git a/src/app/(RootLayout)/home/Username.tsx b/src/app/(RootLayout)/home/Username.tsx deleted file mode 100644 index 3f93716..0000000 --- a/src/app/(RootLayout)/home/Username.tsx +++ /dev/null @@ -1,20 +0,0 @@ -"use client"; -import { useEffect } from "react"; - -const Username = () => { - const usernameInit = "username"; - - useEffect(() => { - console.log("effect"); - }, []); - - return ( -

- zoz.bio/ - - {usernameInit} - -

- ); -}; -export default Username; diff --git a/src/app/(RootLayout)/home/Users.tsx b/src/app/(RootLayout)/home/Users.tsx deleted file mode 100644 index f6197f4..0000000 --- a/src/app/(RootLayout)/home/Users.tsx +++ /dev/null @@ -1,257 +0,0 @@ -export default function Users() { - return ( -
-
-
-

Our Users

-

- Explore the whole collection of open-source web components and elements built with the utility classNamees - from Tailwind -

-
-
-
- - Bonnie Avatar - -
-

- Bonnie Green -

- CEO & Web Developer -

- Bonnie drives the technical strategy of the flowbite platform and brand. -

- -
-
-
- - Jese Avatar - -
-

- Jese Leos -

- CTO -

- Jese drives the technical strategy of the flowbite platform and brand. -

- -
-
-
- - Michael Avatar - -
-

- Michael Gough -

- Senior Front-end Developer -

- Michael drives the technical strategy of the flowbite platform and brand. -

- -
-
-
- - Sofia Avatar - -
-

- Lana Byrd -

- Marketing & Sale -

- Lana drives the technical strategy of the flowbite platform and brand. -

- -
-
-
-
-
- ); -} diff --git a/src/app/(RootLayout)/layout.tsx b/src/app/(RootLayout)/layout.tsx deleted file mode 100644 index 185e268..0000000 --- a/src/app/(RootLayout)/layout.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import "@/app/globals.css"; -import "react-toastify/dist/ReactToastify.css"; -import "tippy.js/animations/perspective.css"; -import "tippy.js/dist/tippy.css"; -import "tippy.js/themes/translucent.css"; -import Footer from "@/components/Footer/Footer"; -import Header from "@/components/Header"; -import ToastProvider from "@/providers/ToastProvider"; -import { ZOZ_META_DESCRIPTION, ZOZ_META_TITLE } from "@/utils/Constants"; -import { Metadata } from "next"; -import { cookies } from "next/headers"; -import NextTopLoader from "nextjs-toploader"; -import { ReactNode } from "react"; -import CssDoodle from "@/components/CssDoodle/CssDoodle"; -import Analytics from "@/components/Analytics"; - -export const metadata: Metadata = { - title: ZOZ_META_TITLE, - description: ZOZ_META_DESCRIPTION, -}; - -export default function RootLayout({ children }: { children: ReactNode }) { - const cookieStore = cookies(); - const userCookie = cookieStore.get("zoz_user"); - const user = userCookie ? JSON.parse(userCookie?.value) : undefined; - - return ( - - - {/* Codestin Search App */} - - - {/* */} - - {/* */} - - - - - - - - {/* */} - - - - - - - - - - - - - {process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_HOME && process.env.NEXT_PUBLIC_MICROSOFT_CLARITY && ( - - )} - - -
- {children} - -