├── .eslintignore ├── .eslintrc ├── .github ├── FUNDING.yml └── workflows │ ├── CI.yml │ ├── release.yml │ └── update-deps.yml ├── .gitignore ├── .storybook ├── main.ts └── preview.ts ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analyze └── nodejs.html ├── commitlint.config.js ├── cypress.config.js ├── cypress ├── e2e │ ├── Navigation.cy.ts │ └── SeoMetadata.cy.ts ├── fixtures │ └── example.json ├── support │ └── e2e.ts └── tsconfig.json ├── diff.txt ├── jest.config.js ├── jest.setup.ts ├── lint-staged.config.js ├── netlify.toml ├── next-env.d.ts ├── next-sitemap.config.js ├── next.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── Boon 2022 Bluray 1080p AV1 AC3 5 1 UH UserHEVC.torrent ├── apple-touch-icon.png ├── assets │ └── images │ │ ├── background-cicles.png │ │ └── nextjs-starter-banner.png ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── navIcon.png ├── noposter.jpg └── searchnormal1.png ├── src ├── Common │ ├── Card.tsx │ ├── CardCompact.tsx │ ├── CardExpanded.tsx │ ├── CardGrid.tsx │ ├── Header.js │ ├── Loader.js │ ├── SideBar.tsx │ ├── ToastMsg.js │ └── loader.scss ├── SVG │ ├── listing.tsx │ └── search.tsx ├── layouts │ └── layout.js ├── pages │ ├── _app.js │ ├── _document.tsx │ ├── about-us.js │ ├── components │ │ ├── CardGenre.js │ │ ├── CardImage.js │ │ ├── CardInfo.js │ │ ├── CardNormal.js │ │ ├── CardTrending.js │ │ ├── Collection.js │ │ ├── CollectionSearch.js │ │ ├── FilmCasts.js │ │ ├── FilmGenres.js │ │ ├── FilmHeading.js │ │ ├── FilmImage.js │ │ ├── FilmInfo.js │ │ ├── FilmRating.js │ │ ├── FilmResources.js │ │ ├── FilmSynopsis.js │ │ ├── Footer.js │ │ ├── Genres.js │ │ ├── Heading.js │ │ ├── Layout.js │ │ ├── Loading.js │ │ ├── Navigation.js │ │ ├── NavigationIcon.js │ │ ├── PageTitle.js │ │ ├── Pagination.js │ │ ├── PaginationImproved.js │ │ ├── SearchBar.js │ │ ├── SearchButton.js │ │ └── icons │ │ │ ├── AppIcon.js │ │ │ ├── IconBookmarkEmpty.js │ │ │ ├── IconBookmarkFull.js │ │ │ ├── IconCategoryMovie.js │ │ │ ├── IconCategoryTv.js │ │ │ ├── IconNavBookmark.js │ │ │ ├── IconNavHome.js │ │ │ ├── IconNavMovie.js │ │ │ ├── IconNavTv.js │ │ │ ├── IconPlay.js │ │ │ └── IconSearch.js │ ├── dashboard.js │ ├── get-posts │ │ └── [category].js │ ├── index.js │ ├── lendingPage.js │ ├── lib │ │ ├── recoil-atoms.js │ │ └── tmdb.js │ ├── login.js │ ├── pages │ │ ├── 404.js │ │ ├── 500.js │ │ ├── api │ │ │ ├── certification.js │ │ │ ├── movie │ │ │ │ ├── [id].js │ │ │ │ ├── now │ │ │ │ │ └── [id].js │ │ │ │ ├── popular │ │ │ │ │ └── [id].js │ │ │ │ ├── top │ │ │ │ │ └── [id].js │ │ │ │ ├── trending │ │ │ │ │ └── [id].js │ │ │ │ └── upcoming │ │ │ │ │ └── [id].js │ │ │ └── tv │ │ │ │ ├── [id].js │ │ │ │ ├── airing │ │ │ │ └── [id].js │ │ │ │ ├── onair │ │ │ │ └── [id].js │ │ │ │ ├── popular │ │ │ │ └── [id].js │ │ │ │ ├── top │ │ │ │ └── [id].js │ │ │ │ └── trending │ │ │ │ └── [id].js │ │ ├── bookmark.js │ │ ├── index.js │ │ ├── movie │ │ │ ├── [id].js │ │ │ ├── genre │ │ │ │ └── [id].js │ │ │ ├── index.js │ │ │ ├── now │ │ │ │ └── [id].js │ │ │ ├── popular │ │ │ │ └── [id].js │ │ │ ├── top │ │ │ │ └── [id].js │ │ │ ├── trending │ │ │ │ └── [id].js │ │ │ ├── upcoming.js │ │ │ └── upcoming │ │ │ │ └── [id].js │ │ ├── post-detail │ │ │ └── [slug].js │ │ ├── search │ │ │ ├── [id].js │ │ │ ├── movie │ │ │ │ └── [id].js │ │ │ └── tv │ │ │ │ └── [id].js │ │ └── tv │ │ │ ├── [id].js │ │ │ ├── airing │ │ │ └── [id].js │ │ │ ├── genre │ │ │ └── [id].js │ │ │ ├── index.js │ │ │ ├── onair.js │ │ │ ├── onair │ │ │ └── [id].js │ │ │ ├── popular │ │ │ └── [id].js │ │ │ ├── top.js │ │ │ ├── top │ │ │ └── [id].js │ │ │ └── trending │ │ │ └── [id].js │ ├── post-detail │ │ └── [id] │ │ │ └── [slug].js │ ├── public │ │ ├── favicon.ico │ │ ├── logo.svg │ │ └── vercel.svg │ ├── register.js │ ├── search.js │ ├── upload.js │ └── utils │ │ ├── AppConfig.ts │ │ └── index.js ├── service │ └── service.js └── styles │ ├── global.scss │ └── nprogress.css ├── tailwind.config.js └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | out 3 | !.storybook 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | // Configuration for JavaScript files 3 | "extends": [ 4 | "airbnb-base", 5 | "next/core-web-vitals", // Needed to avoid warning in next.js build: 'The Next.js plugin was not detected in your ESLint configuration' 6 | "plugin:prettier/recommended", 7 | "plugin:tailwindcss/recommended" 8 | ], 9 | "rules": { 10 | "prettier/prettier": [ 11 | "error", 12 | { 13 | "singleQuote": true, 14 | "endOfLine": "auto" 15 | } 16 | ] 17 | }, 18 | "overrides": [ 19 | // Configuration for TypeScript files 20 | { 21 | "files": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], 22 | "parser": "@typescript-eslint/parser", 23 | 24 | "plugins": [ 25 | "@typescript-eslint", 26 | "unused-imports", 27 | "tailwindcss", 28 | "simple-import-sort" 29 | ], 30 | "extends": [ 31 | "plugin:tailwindcss/recommended", 32 | "airbnb", 33 | "airbnb-typescript", 34 | "airbnb/hooks", 35 | "next/core-web-vitals", 36 | "plugin:prettier/recommended" 37 | ], 38 | "parserOptions": { 39 | "project": "./tsconfig.json" 40 | }, 41 | "rules": { 42 | "prettier/prettier": [ 43 | "error", 44 | { 45 | "singleQuote": true, 46 | "endOfLine": "auto" 47 | } 48 | ], 49 | "react/function-component-definition": "off", // Disable Airbnb's specific function type 50 | "react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable 51 | "react/require-default-props": "off", // Allow non-defined react props as undefined 52 | "react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form 53 | "react-hooks/exhaustive-deps": "off", // Incorrectly report needed dependency with Next.js router 54 | "@next/next/no-img-element": "off", // We currently not using next/image because it isn't supported with SSG mode 55 | "@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier 56 | "@typescript-eslint/consistent-type-imports": "error", // Ensure `import type` is used when it's necessary 57 | "no-restricted-syntax": [ 58 | "error", 59 | "ForInStatement", 60 | "LabeledStatement", 61 | "WithStatement" 62 | ], // Overrides Airbnb configuration and enable no-restricted-syntax 63 | "import/prefer-default-export": "off", // Named export is easier to refactor automatically 64 | "simple-import-sort/imports": "error", // Import configuration for `eslint-plugin-simple-import-sort` 65 | "simple-import-sort/exports": "error", // Export configuration for `eslint-plugin-simple-import-sort` 66 | "@typescript-eslint/no-unused-vars": "off", 67 | "unused-imports/no-unused-imports": "error", 68 | "unused-imports/no-unused-vars": [ 69 | "error", 70 | { "argsIgnorePattern": "^_" } 71 | ] 72 | } 73 | }, 74 | // Configuration for testing 75 | { 76 | "files": ["**/*.test.ts", "**/*.test.tsx"], 77 | "plugins": ["jest", "jest-formatting", "testing-library", "jest-dom"], 78 | "extends": [ 79 | "plugin:jest/recommended", 80 | "plugin:jest-formatting/recommended", 81 | "plugin:testing-library/react", 82 | "plugin:jest-dom/recommended" 83 | ] 84 | }, 85 | // Configuration for e2e testing (Cypress) 86 | { 87 | "files": ["cypress/**/*.ts"], 88 | "plugins": ["cypress"], 89 | "extends": ["plugin:cypress/recommended"], 90 | "parserOptions": { 91 | "project": "./cypress/tsconfig.json" 92 | } 93 | }, 94 | // Configuration for Storybook 95 | { 96 | "files": ["*.stories.*"], 97 | "extends": ["plugin:storybook/recommended"], 98 | "rules": { 99 | "import/no-extraneous-dependencies": [ 100 | "error", 101 | { 102 | "devDependencies": true 103 | } 104 | ] 105 | } 106 | } 107 | ] 108 | } 109 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: 2 | ["https://donate.stripe.com/7sI5m5146ehfddm7tj", "https://nextlessjs.com"] 3 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | node-version: [16.x, 18.x, 20.x] 14 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 15 | 16 | name: Build with ${{ matrix.node-version }} 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v3 21 | - name: Use Node.js ${{ matrix.node-version }} 22 | uses: actions/setup-node@v3 23 | with: 24 | node-version: ${{ matrix.node-version }} 25 | cache: "npm" 26 | - run: npm ci 27 | - run: npm run build-prod 28 | 29 | test: 30 | strategy: 31 | matrix: 32 | node-version: [16.x] 33 | 34 | name: Run all tests 35 | runs-on: ubuntu-latest 36 | 37 | steps: 38 | - uses: actions/checkout@v3 39 | with: 40 | fetch-depth: 0 # Retrieve Git history, needed to verify commits 41 | - name: Use Node.js ${{ matrix.node-version }} 42 | uses: actions/setup-node@v3 43 | with: 44 | node-version: ${{ matrix.node-version }} 45 | cache: "npm" 46 | - run: npm ci 47 | 48 | - if: github.event_name == 'pull_request' 49 | name: Validate all commits from PR 50 | run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose 51 | 52 | - name: Linter 53 | run: npm run lint 54 | 55 | - name: Type checking 56 | run: npm run check-types 57 | 58 | - name: Run unit tests 59 | run: npm run test 60 | 61 | - name: Run storybook tests 62 | run: npm run test-storybook:ci 63 | 64 | - name: Run e2e tests 65 | run: npx percy exec -- npm run e2e:headless 66 | env: 67 | PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} 68 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | workflow_run: 5 | workflows: ["CI"] 6 | types: 7 | - completed 8 | branches: 9 | - main 10 | 11 | jobs: 12 | release: 13 | strategy: 14 | matrix: 15 | node-version: [16.x] 16 | 17 | name: Create a new release 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | with: 23 | fetch-depth: 0 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v3 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | cache: "npm" 29 | - run: HUSKY=0 npm ci 30 | 31 | - name: Release 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 35 | run: npx semantic-release 36 | -------------------------------------------------------------------------------- /.github/workflows/update-deps.yml: -------------------------------------------------------------------------------- 1 | name: Update dependencies 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "0 0 1 * *" 7 | 8 | jobs: 9 | update: 10 | strategy: 11 | matrix: 12 | node-version: [16.x] 13 | 14 | name: Update all dependencies 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v3 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | cache: "npm" 24 | - run: npm ci 25 | 26 | - run: npx npm-check-updates -u # Update dependencies 27 | - run: rm -Rf node_modules package-lock.json 28 | - run: npm install 29 | - name: Create Pull Request 30 | uses: peter-evans/create-pull-request@v4 31 | with: 32 | commit-message: "build: update dependencies to the latest version" 33 | title: Update dependencies to the latest version 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # storybook 12 | storybook-static 13 | 14 | # cypress 15 | cypress/screenshots 16 | cypress/videos 17 | 18 | # next.js 19 | /.next 20 | /out 21 | 22 | # next-sitemap 23 | public/robots.txt 24 | public/sitemap.xml 25 | public/sitemap-*.xml 26 | 27 | # cache 28 | .swc/ 29 | 30 | # production 31 | /build 32 | 33 | # misc 34 | .DS_Store 35 | *.pem 36 | Thumbs.db 37 | 38 | # debug 39 | npm-debug.log* 40 | pnpm-debug.log* 41 | yarn-debug.log* 42 | yarn-error.log* 43 | 44 | # local env files 45 | .env*.local 46 | 47 | # local folder 48 | local 49 | 50 | # vercel 51 | .vercel 52 | -------------------------------------------------------------------------------- /.storybook/main.ts: -------------------------------------------------------------------------------- 1 | import type { StorybookConfig } from '@storybook/nextjs'; 2 | 3 | const config: StorybookConfig = { 4 | stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'], 5 | addons: [ 6 | '@storybook/addon-links', 7 | '@storybook/addon-essentials', 8 | '@storybook/addon-interactions', 9 | ], 10 | framework: { 11 | name: '@storybook/nextjs', 12 | options: {}, 13 | }, 14 | docs: { 15 | autodocs: 'tag', 16 | }, 17 | core: { 18 | disableTelemetry: true, 19 | }, 20 | }; 21 | 22 | export default config; 23 | -------------------------------------------------------------------------------- /.storybook/preview.ts: -------------------------------------------------------------------------------- 1 | import '../src/styles/global.css'; 2 | 3 | import type { Preview } from '@storybook/react'; 4 | 5 | const preview: Preview = { 6 | parameters: { 7 | actions: { argTypesRegex: '^on[A-Z].*' }, 8 | controls: { 9 | matchers: { 10 | color: /(background|color)$/i, 11 | date: /Date$/, 12 | }, 13 | }, 14 | }, 15 | }; 16 | 17 | export default preview; 18 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "esbenp.prettier-vscode", 5 | "mikestead.dotenv", 6 | "csstools.postcss", 7 | "bradlc.vscode-tailwindcss", 8 | "Orta.vscode-jest", 9 | "yoavbls.pretty-ts-errors" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "chrome", 9 | "request": "launch", 10 | "name": "Next: Chrome", 11 | "url": "http://localhost:3000", 12 | "webRoot": "${workspaceFolder}" 13 | }, 14 | { 15 | "type": "node", 16 | "request": "launch", 17 | "name": "Next: Node", 18 | "program": "${workspaceFolder}/node_modules/.bin/next", 19 | "args": ["dev"], 20 | "autoAttachChildProcesses": true, 21 | "skipFiles": ["/**"], 22 | "console": "integratedTerminal" 23 | } 24 | ], 25 | "compounds": [ 26 | { 27 | "name": "Next: Full", 28 | "configurations": ["Next: Node", "Next: Chrome"] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.tabSize": 2, 3 | "editor.detectIndentation": false, 4 | "search.exclude": { 5 | "package-lock.json": true 6 | }, 7 | "editor.defaultFormatter": "dbaeumer.vscode-eslint", 8 | "editor.formatOnSave": false, 9 | "editor.codeActionsOnSave": [ 10 | "source.addMissingImports", 11 | "source.fixAll.eslint" 12 | ], 13 | "jest.autoRun": { 14 | "watch": false // Start the jest with the watch flag 15 | // "onStartup": ["all-tests"] // Run all tests upon project launch 16 | }, 17 | "jest.showCoverageOnLoad": true, // Show code coverage when the project is launched 18 | "jest.autoRevealOutput": "on-exec-error", // Don't automatically open test explorer terminal on launch 19 | // Multiple language settings for json and jsonc files 20 | "[json][jsonc][yaml]": { 21 | "editor.formatOnSave": true, 22 | "editor.defaultFormatter": "esbenp.prettier-vscode" 23 | }, 24 | "prettier.ignorePath": ".gitignore" // Don't run prettier for files listed in .gitignore 25 | } 26 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Project wide type checking with TypeScript", 8 | "type": "npm", 9 | "script": "check-types", 10 | "problemMatcher": ["$tsc"], 11 | "group": { 12 | "kind": "build", 13 | "isDefault": true 14 | }, 15 | "presentation": { 16 | "clear": true, 17 | "reveal": "never" 18 | } 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.0 (2023-04-25) 2 | 3 | ### Features 4 | 5 | 6 | 7 | ### Bug Fixes 8 | 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Remi W. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | New Frontend For theRARBG [On-Progress] 2 | 3 | ### Requirements 4 | - Use Node 19.9.0 5 | - Node.js 19+ and npm 6 | 7 | ### Getting started 8 | 9 | Run the following command on your local environment: 10 | 11 | ```shell 12 | npm install 13 | ``` 14 | 15 | Then, you can run locally in development mode with live reload: 16 | 17 | ```shell 18 | npm run dev 19 | ``` 20 | 21 | ### Contributions 22 | 23 | Everyone is welcome to contribute to this project. Feel free to open an issue if you have question or found a bug. Totally open to any suggestions and improvements. 24 | 25 | ### License 26 | 27 | Licensed under the MIT License, Copyright © 2022 28 | 29 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ['@commitlint/config-conventional'] }; 2 | -------------------------------------------------------------------------------- /cypress.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const { defineConfig } = require('cypress'); 3 | 4 | module.exports = defineConfig({ 5 | e2e: { 6 | baseUrl: 'http://localhost:3000', 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /cypress/e2e/Navigation.cy.ts: -------------------------------------------------------------------------------- 1 | describe('Navigation', () => { 2 | describe('Static pages', () => { 3 | it('should navigate to the about page', () => { 4 | // Start from the index page 5 | cy.visit('/'); 6 | 7 | // The index page should contain an h1 8 | cy.findByRole('heading', { 9 | name: 'Boilerplate code for your Nextjs project with Tailwind CSS', 10 | }); 11 | 12 | // Find a link containing "About" text and click it 13 | cy.findByRole('link', { name: 'About' }).click(); 14 | 15 | // The new url should include "/about" 16 | cy.url().should('include', '/about'); 17 | 18 | // The new page should contain two "lorem ipsum" paragraphs 19 | cy.findAllByText('Lorem ipsum dolor sit amet', { exact: false }).should( 20 | 'have.length', 21 | 2 22 | ); 23 | }); 24 | 25 | it('should take screenshot of the homepage', () => { 26 | cy.visit('/'); 27 | 28 | // Wait until the page is displayed 29 | cy.findByRole('heading', { 30 | name: 'Boilerplate code for your Nextjs project with Tailwind CSS', 31 | }); 32 | 33 | cy.percySnapshot('Homepage'); 34 | }); 35 | 36 | it('should take screenshot of the About page', () => { 37 | cy.visit('/about'); 38 | 39 | // Wait until the page is displayed 40 | cy.findByRole('link', { name: 'About' }); 41 | 42 | cy.percySnapshot('About'); 43 | }); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /cypress/e2e/SeoMetadata.cy.ts: -------------------------------------------------------------------------------- 1 | describe('Seo metadata', () => { 2 | describe('Verify SEO Metadata', () => { 3 | it('should render SEO metadata on Index page', () => { 4 | cy.visit('/'); 5 | 6 | // The Index page should have a page title 7 | cy.title().should('not.be.empty'); 8 | 9 | // The Index page should also contain a meta description for SEO 10 | cy.get('head meta[name="description"]') 11 | .invoke('attr', 'content') 12 | .should('not.be.empty'); 13 | }); 14 | 15 | it('should render SEO metadata on About page', () => { 16 | cy.visit('/about'); 17 | 18 | // The About page should have a page title 19 | cy.title().should('not.be.empty'); 20 | 21 | // The About page should also contain a meta description for SEO 22 | cy.get('head meta[name="description"]') 23 | .invoke('attr', 'content') 24 | .should('not.be.empty'); 25 | }); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } 6 | -------------------------------------------------------------------------------- /cypress/support/e2e.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | // *********************************************************** 3 | // This example support/e2e.ts is processed and 4 | // loaded automatically before your test files. 5 | // 6 | // This is a great place to put global configuration and 7 | // behavior that modifies Cypress. 8 | // 9 | // You can change the location of this file or turn off 10 | // automatically serving support files with the 11 | // 'supportFile' configuration option. 12 | // 13 | // You can read more here: 14 | // https://on.cypress.io/configuration 15 | // *********************************************************** 16 | 17 | // Import commands.js using ES2015 syntax: 18 | import '@testing-library/cypress/add-commands'; 19 | import '@percy/cypress'; 20 | 21 | // Alternatively you can use CommonJS syntax: 22 | // require('./commands') 23 | -------------------------------------------------------------------------------- /cypress/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "target": "es5", 5 | "lib": ["es5", "dom"], 6 | "types": ["node", "cypress", "@percy/cypress", "@testing-library/cypress"], 7 | 8 | "isolatedModules": false 9 | }, 10 | "include": ["**/*.ts"], 11 | "exclude": [] 12 | } 13 | -------------------------------------------------------------------------------- /diff.txt: -------------------------------------------------------------------------------- 1 | diff --git a/public/navIcon.png b/public/navIcon.png 2 | new file mode 100644 3 | index 0000000..b2ff2c9 4 | Binary files /dev/null and b/public/navIcon.png differ 5 | diff --git a/src/Common/Header.tsx b/src/Common/Header.tsx 6 | index 12ffb8f..79e32eb 100644 7 | --- a/src/Common/Header.tsx 8 | +++ b/src/Common/Header.tsx 9 | @@ -1,4 +1,4 @@ 10 | -import React from 'react'; 11 | +import React, { useState } from 'react'; 12 | import { usePathname, useRouter } from 'next/navigation'; 13 | 14 | const cRoutes = [ 15 | @@ -19,12 +19,19 @@ const cRoutes = [ 16 | } 17 | ]; 18 | 19 | + 20 | const Header = () => { 21 | + const [showNav,setShowNav] = useState(false); 22 | const router = usePathname(); 23 | const route = useRouter(); 24 | let cRouter = router?.split("/") ?? []; 25 | return ( 26 | -
27 | +
28 | +
29 | + 30 | + 31 | + 32 | + 33 | route.push("/")}>theRARBG 34 | 35 |
36 | @@ -36,6 +43,22 @@ const Header = () => { 37 |
38 | 39 |
40 | + {/*Mobile Hamburger Menu */} 41 | +
42 | +
43 | + route.push("/")}>theRARBG 44 | + The Navigation Icon setShowNav(!showNav)}/> 45 | +
46 | +
47 | + {cRoutes.map((obj, i) => ( 48 | +
{route.push(`${obj.path[0]}`); setShowNav(false)}} key={i}> 49 | +

{obj.title}

50 | +
51 | + ))} 52 | +
53 | +
54 | + 55 | +
56 | ); 57 | }; 58 | 59 | diff --git a/src/pages/home.tsx b/src/pages/home.tsx 60 | new file mode 100644 61 | index 0000000..f4309b4 62 | --- /dev/null 63 | +++ b/src/pages/home.tsx 64 | @@ -0,0 +1,72 @@ 65 | +import { useRouter } from 'next/navigation' 66 | +import React, { useState } from 'react' 67 | + 68 | +import { SearchSVG, MovieSVG } from '../SVG/search' 69 | + 70 | +let data1 = [{name:"Torrents",cat:"",time:"2D"}, {name:"Movie",cat:"Movies",time:"10D"}, {name:"TV-Show",cat:"TV",time:"10D"},{name:"Games",cat:"Games",time:"10D"}, {name:"Music",cat:"Music",time:"10D"}, {name:"Anime",cat:"Anime",time:"10D"}, {name:"Books",cat:"Books",time:"10D"},{name: "Other",cat:"Other",time:"10D"}] 71 | + 72 | +let array: (string | number)[] = [] 73 | + 74 | +const Home = () => { 75 | + const router = useRouter() 76 | + const [data, setData] = useState(data1); 77 | + 78 | + 79 | + return ( 80 | +
81 | +
82 | +

This World.
At Your Fingertips.

83 | +
84 | +
85 | + 86 | + 87 | +
88 | +
89 | +
90 | + { 91 | + data1.map((item, index) => { 92 | + return ( 93 | + 108 | + 109 | + ) 110 | + }) 111 | + } 112 | +
113 | +
114 | +
115 | +
116 | + 117 | +
118 | + { 119 | + data.map((item, index) => { 120 | + return ( 121 | +
router.push(`/get-posts/category:${item?.cat?item?.cat:false}?time=${item?.time}`)} className="cursor-pointer w-[150px] md:w-[195px] h-[115px] md:pl-[26px] md:pr-[161px] pt-7 pb-16 bg-off-white/10 rounded-lg border-off-white/30 flex-col justify-start items-center md:items-start gap-3.5 inline-flex hover:bg-primary/10 border-[1px] hover:border-primary/50 group"> 122 | +
123 | +
{item?.name}
124 | +
125 | + ) 126 | + })} 127 | + 128 | + 129 | +
130 | +
131 | +
132 | +
133 | + ) 134 | +} 135 | + 136 | +export default Home 137 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | const nextJest = require('next/jest'); 2 | 3 | const createJestConfig = nextJest({ 4 | // Provide the path to your Next.js app to load next.config.js and .env files in your test environment 5 | dir: './', 6 | }); 7 | 8 | const customJestConfig = { 9 | moduleNameMapper: { 10 | // Handle module aliases (this will be automatically configured for you soon) 11 | '^@/(.*)$': '/src/$1', 12 | 13 | '^@/public/(.*)$': '/public/$1', 14 | 15 | '^__mocks__/(.*)$': '/__mocks__/$1', 16 | }, 17 | setupFilesAfterEnv: ['./jest.setup.ts'], 18 | clearMocks: true, 19 | collectCoverage: true, 20 | collectCoverageFrom: [ 21 | './src/**/*.{js,jsx,ts,tsx}', 22 | '!./src/**/_*.{js,jsx,ts,tsx}', 23 | '!./src/**/*.stories.{js,jsx,ts,tsx}', 24 | '!**/*.d.ts', 25 | '!**/node_modules/**', 26 | ], 27 | coverageThreshold: { 28 | global: { 29 | branches: 30, 30 | functions: 30, 31 | lines: 30, 32 | statements: 30, 33 | }, 34 | }, 35 | testEnvironment: 'jest-environment-jsdom', 36 | }; 37 | 38 | module.exports = createJestConfig(customJestConfig); 39 | -------------------------------------------------------------------------------- /jest.setup.ts: -------------------------------------------------------------------------------- 1 | // Optional: configure or set up a testing framework before each test. 2 | // If you delete this file, remove `setupFilesAfterEnv` from `jest.config.js` 3 | import '@testing-library/jest-dom/extend-expect'; 4 | -------------------------------------------------------------------------------- /lint-staged.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '*.{js,jsx,ts,tsx}': ['eslint --fix', 'eslint'], 3 | '**/*.ts?(x)': () => 'npm run check-types', 4 | '*.{json,yaml}': ['prettier --write'], 5 | }; 6 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | publish = "out" 3 | command = "npm run build-prod" 4 | 5 | [build.environment] 6 | NETLIFY_NEXT_PLUGIN_SKIP = "true" 7 | -------------------------------------------------------------------------------- /next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /next-sitemap.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next-sitemap').IConfig} */ 2 | module.exports = { 3 | siteUrl: 'https://example.com', // FIXME: Change to the production URL 4 | generateRobotsTxt: true, 5 | }; 6 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const withBundleAnalyzer = require('@next/bundle-analyzer')({ 3 | enabled: false, 4 | }); 5 | 6 | module.exports = withBundleAnalyzer({ 7 | pageExtensions: ['page.tsx', 'page.ts', 'page.jsx', 'page.js'], 8 | images: { 9 | domains: ['i.therarbg.com','localhost'], 10 | }, 11 | eslint: { 12 | dirs: ['.'], 13 | }, 14 | poweredByHeader: false, 15 | trailingSlash: true, 16 | basePath: '', 17 | // The starter code load resources from `public` folder with `router.basePath` in React components. 18 | // So, the source code is "basePath-ready". 19 | // You can remove `basePath` if you don't need it. 20 | reactStrictMode: true, 21 | }); 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TheRarBg", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "dev": "next dev", 6 | "build": "next build", 7 | "start": "next start", 8 | "build-stats": "cross-env ANALYZE=true npm run build", 9 | "export": "next export", 10 | "build-prod": "run-s clean build export", 11 | "clean": "rimraf .next .swc out coverage", 12 | "lint": "next lint", 13 | "test": "jest", 14 | "commit": "cz", 15 | "cypress": "cypress open", 16 | "cypress:headless": "cypress run", 17 | "e2e": "start-server-and-test dev http://localhost:3000 cypress", 18 | "e2e:headless": "start-server-and-test dev http://localhost:3000 cypress:headless", 19 | "storybook": "storybook dev -p 6006", 20 | "storybook:build": "storybook build", 21 | "storybook:serve": "http-server storybook-static --port 6006 --silent", 22 | "serve-storybook": "run-s storybook:*", 23 | "test-storybook:ci": "start-server-and-test serve-storybook http://localhost:6006 test-storybook", 24 | "prepare": "husky install", 25 | "postbuild": "next-sitemap" 26 | }, 27 | "dependencies": { 28 | "axios": "^1.4.0", 29 | "moment": "^2.29.4", 30 | "next": "^13.4.4", 31 | "next-seo": "^6.0.0", 32 | "next-sitemap": "^4.1.3", 33 | "nprogress": "^0.2.0", 34 | "react": "^18.2.0", 35 | "react-bootstrap": "^2.8.0", 36 | "react-dom": "^18.2.0", 37 | "react-icons": "^4.10.1", 38 | "react-rating": "^2.0.5", 39 | "react-select": "^5.7.4", 40 | "react-toastify": "^9.1.3", 41 | "react-youtube": "^10.1.0", 42 | "recoil": "^0.7.7", 43 | "saas": "^1.0.0", 44 | "sass": "^1.63.6", 45 | "scss": "^0.2.4", 46 | "sharp": "^0.32.5", 47 | "swr": "^2.2.1" 48 | }, 49 | "devDependencies": { 50 | "@commitlint/cli": "^17.6.5", 51 | "@commitlint/config-conventional": "^17.6.5", 52 | "@commitlint/cz-commitlint": "^17.5.0", 53 | "@next/bundle-analyzer": "^13.4.4", 54 | "@percy/cli": "^1.25.0", 55 | "@percy/cypress": "^3.1.2", 56 | "@semantic-release/changelog": "^6.0.3", 57 | "@semantic-release/git": "^10.0.1", 58 | "@storybook/addon-essentials": "^7.0.18", 59 | "@storybook/addon-interactions": "^7.0.18", 60 | "@storybook/addon-links": "^7.0.18", 61 | "@storybook/blocks": "^7.0.18", 62 | "@storybook/nextjs": "^7.0.18", 63 | "@storybook/react": "^7.0.18", 64 | "@storybook/test-runner": "^0.10.0", 65 | "@storybook/testing-library": "^0.1.0", 66 | "@testing-library/cypress": "^9.0.0", 67 | "@testing-library/jest-dom": "^5.16.5", 68 | "@testing-library/react": "^14.0.0", 69 | "@types/jest": "^29.5.2", 70 | "@types/node": "^20.2.5", 71 | "@types/react": "^18.2.8", 72 | "@typescript-eslint/eslint-plugin": "^5.59.9", 73 | "@typescript-eslint/parser": "^5.59.9", 74 | "autoprefixer": "^10.4.14", 75 | "commitizen": "^4.3.0", 76 | "cross-env": "^7.0.3", 77 | "cssnano": "^6.0.1", 78 | "cypress": "^12.13.0", 79 | 80 | "eslint-config-airbnb": "^19.0.4", 81 | "eslint-config-airbnb-typescript": "^17.0.0", 82 | "eslint-config-next": "^13.4.4", 83 | "eslint-config-prettier": "^9.0.0", 84 | "eslint-plugin-cypress": "^2.13.3", 85 | "eslint-plugin-import": "^2.27.5", 86 | "eslint-plugin-jest": "^27.2.1", 87 | "eslint-plugin-jest-dom": "^5.0.1", 88 | "eslint-plugin-jest-formatting": "^3.1.0", 89 | "eslint-plugin-jsx-a11y": "^6.7.1", 90 | "eslint-plugin-prettier": "^5.0.0", 91 | "eslint-plugin-react": "^7.32.2", 92 | "eslint-plugin-react-hooks": "^4.6.0", 93 | "eslint-plugin-simple-import-sort": "^10.0.0", 94 | "eslint-plugin-storybook": "^0.6.12", 95 | "eslint-plugin-tailwindcss": "^3.12.1", 96 | "eslint-plugin-testing-library": "^5.11.0", 97 | "eslint-plugin-unused-imports": "^2.0.0", 98 | "http-server": "^14.1.1", 99 | "husky": "^8.0.3", 100 | "jest": "^29.5.0", 101 | "jest-environment-jsdom": "^29.5.0", 102 | "lint-staged": "^13.2.2", 103 | "npm-run-all": "^4.1.5", 104 | "postcss": "^8.4.24", 105 | "prettier": "^3.0.2", 106 | "rimraf": "^5.0.1", 107 | "semantic-release": "^19.0.5", 108 | "start-server-and-test": "^2.0.0", 109 | "storybook": "^7.0.18", 110 | "tailwindcss": "^3.3.2", 111 | "typescript": "^4.9.5" 112 | }, 113 | "config": { 114 | "commitizen": { 115 | "path": "@commitlint/cz-commitlint" 116 | } 117 | }, 118 | "release": { 119 | "branches": [ 120 | "main" 121 | ], 122 | "plugins": [ 123 | "@semantic-release/commit-analyzer", 124 | "@semantic-release/release-notes-generator", 125 | "@semantic-release/changelog", 126 | [ 127 | "@semantic-release/npm", 128 | { 129 | "npmPublish": false 130 | } 131 | ], 132 | "@semantic-release/git", 133 | "@semantic-release/github" 134 | ] 135 | }, 136 | "author": "the-rarbg (https://github.com/the-rarbg)" 137 | } 138 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /public/Boon 2022 Bluray 1080p AV1 AC3 5 1 UH UserHEVC.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/Boon 2022 Bluray 1080p AV1 AC3 5 1 UH UserHEVC.torrent -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/assets/images/background-cicles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/assets/images/background-cicles.png -------------------------------------------------------------------------------- /public/assets/images/nextjs-starter-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/assets/images/nextjs-starter-banner.png -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/favicon.ico -------------------------------------------------------------------------------- /public/navIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/navIcon.png -------------------------------------------------------------------------------- /public/noposter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/noposter.jpg -------------------------------------------------------------------------------- /public/searchnormal1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-rarbg/therarbg/35d69d26902fc79be995a6c646bd182f2451574e/public/searchnormal1.png -------------------------------------------------------------------------------- /src/Common/Card.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {useRouter } from 'next/navigation'; 3 | 4 | function formatBytes(bytes: number, decimals:number = 1) { 5 | if (!+bytes) return '0 Bytes' 6 | 7 | const k = 1024 8 | const dm = decimals < 0 ? 0 : decimals 9 | const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] 10 | 11 | const i = Math.floor(Math.log(bytes) / Math.log(k)) 12 | 13 | return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}` 14 | } 15 | 16 | interface CardProps { 17 | // @ts-ignore the any type is used here because the data is not typed 18 | item: Record; 19 | index: number; 20 | categoryId: string; 21 | page:string; 22 | blur:Boolean; 23 | } 24 | 25 | const Card = (props: CardProps) => { 26 | const router = useRouter(); 27 | let name = props.item[`name`]; 28 | let time = new Date(props.item[`timestamp`]); 29 | return ( 30 |
{ 31 | if(props?.page ==="dashboard" || props?.blur){ 32 | return; 33 | } 34 | let slug = name.toLowerCase().trim().replace(/[^\w\s-]/g, '').replace(/[\s_-]+/g, '-').replace(/^-+|-+$/g, ''); 35 | router.push(`/post-detail/${props.item?.eid}/${slug}/`) 36 | }} key={props.index} className={`my-2 overflow-hidden w-full ${props?.page ==="dashboard"?"":"cursor-pointer"} py-2 bg-off-white/10 rounded-md flex justify-center hover:bg-primary/10 border border-off-white/10 hover:border-primary/50`}> 37 |
38 |
39 |
40 |
41 | 42 | {props?.item?.name} 43 | 44 |
45 | 46 |
47 | 48 | {props.item['c'] || props.categoryId} 49 | 50 | {" "} 51 | 52 | {time.getDate()||""}-{time.getMonth()+1||""}-{time.getFullYear()||""} 53 | 54 | {" "} 55 | 56 | {formatBytes(props.item['size'])} 57 | 58 | {props?.page ==="dashboard"? {router.push(`/upload?data=${JSON.stringify(props?.item)}`)}} className='font-medium cursor-pointer text-primary' >Edit:null} 59 |
60 |
); 61 | }; 62 | 63 | export default Card; 64 | -------------------------------------------------------------------------------- /src/Common/CardCompact.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {useRouter } from 'next/navigation'; 3 | 4 | function formatBytes(bytes: number, decimals:number = 1) { 5 | if (!+bytes) return '0 Bytes' 6 | 7 | const k = 1024 8 | const dm = decimals < 0 ? 0 : decimals 9 | const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] 10 | 11 | const i = Math.floor(Math.log(bytes) / Math.log(k)) 12 | 13 | return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}` 14 | } 15 | 16 | interface CardProps { 17 | // @ts-ignore the any type is used here because the data is not typed 18 | item: Record; 19 | index: number; 20 | categoryId: string; 21 | } 22 | 23 | const CardCompact = (props: CardProps) => { 24 | const router = useRouter(); 25 | let name = props.item[`n`]; 26 | let time = new Date(props.item[`a`]*1000); 27 | return ( 28 |
{ 29 | let slug = name.toLowerCase().trim().replace(/[^\w\s-]/g, '').replace(/[\s_-]+/g, '-').replace(/^-+|-+$/g, ''); 30 | router.push(`/post-detail/${props.item?.pk}/${slug}/`) 31 | }} key={props.index} className="my-2 overflow-hidden w-full cursor-pointer py-2 bg-off-white/10 rounded-md flex justify-center hover:bg-primary/10 border border-off-white/10 hover:border-primary/50"> 32 |
33 |
34 |
35 |
36 | 37 | {name} 38 | 39 |
40 |
41 | 42 | {props.item['c'] || props.categoryId} 43 | 44 | 45 | 46 | {time.getDate()}-{time.getMonth()+1}-{time.getFullYear()} 47 | 48 | 49 | 50 | {formatBytes(props.item['s'])} 51 | 52 |
53 |
); 54 | }; 55 | 56 | export default CardCompact; 57 | -------------------------------------------------------------------------------- /src/Common/CardExpanded.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {useRouter } from 'next/navigation'; 3 | 4 | export function formatBytes(bytes: number, decimals:number = 1) { 5 | if (!+bytes) return '0 Bytes' 6 | 7 | const k = 1024 8 | const dm = decimals < 0 ? 0 : decimals 9 | const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] 10 | 11 | const i = Math.floor(Math.log(bytes) / Math.log(k)) 12 | 13 | return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}` 14 | } 15 | 16 | interface CardProps { 17 | // @ts-ignore the any type is used here because the data is not typed 18 | item: Record; 19 | index: number; 20 | categoryId: string; 21 | } 22 | 23 | const CardExpanded = (props: CardProps) => { 24 | const router = useRouter(); 25 | let name = props.item[`n`]; 26 | let time = new Date(props.item[`a`]*1000); 27 | return ( 28 |
{ 29 | let slug = name.toLowerCase().trim().replace(/[^\w\s-]/g, '').replace(/[\s_-]+/g, '-').replace(/^-+|-+$/g, ''); 30 | router.push(`/post-detail/${props.item?.pk}/${slug}/`) 31 | }} key={props.index} className="my-2 mx-2 overflow-hidden w-[190px] cursor-pointer py-2 bg-off-white/10 rounded-md flex-col justify-center inline-flex hover:bg-primary/10 border border-off-white/10 hover:border-primary/50"> 32 |
33 |
34 |
35 |
36 | 37 | {name} 38 | 39 |
40 |
41 | 42 | {props.item['c'] || props.categoryId} 43 | 44 | 45 | 46 | {time.getDate()}-{time.getMonth()+1}-{time.getFullYear()} 47 | 48 | 49 | 50 | {formatBytes(props.item['s'])} 51 | 52 |
53 |
); 54 | }; 55 | 56 | export default CardExpanded; 57 | -------------------------------------------------------------------------------- /src/Common/CardGrid.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {useRouter } from 'next/navigation'; 3 | export function formatBytes(bytes: number, decimals:number = 1) { 4 | if (!+bytes) return '0 Bytes' 5 | 6 | const k = 1024 7 | const dm = decimals < 0 ? 0 : decimals 8 | const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] 9 | 10 | const i = Math.floor(Math.log(bytes) / Math.log(k)) 11 | 12 | return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}` 13 | } 14 | 15 | interface CardProps { 16 | // @ts-ignore the any type is used here because the data is not typed 17 | item: Record; 18 | index: number; 19 | categoryId: string; 20 | blur:Boolean; 21 | setBlur:Function; 22 | } 23 | 24 | const CardExpanded = (props: CardProps) => { 25 | console.log("pp",props?.blur) 26 | const router = useRouter(); 27 | let name = props.item[`name`]; 28 | let time = new Date(props.item[`timestamp`]); 29 | return ( 30 |
{ 31 | 32 | if( props?.blur==true){ 33 | props?.setBlur(false) 34 | return; 35 | } 36 | let slug = name.toLowerCase().trim().replace(/[^\w\s-]/g, '').replace(/[\s_-]+/g, '-').replace(/^-+|-+$/g, ''); 37 | router.push(`/post-detail/${props.item?.eid}/${slug}/`) 38 | }} key={props.index} className="my-2 mx-3 overflow-hidden w-[190px] cursor-pointer py-2 bg-off-white/10 rounded-md flex-col justify-center inline-flex hover:bg-primary/10 border border-off-white/10 hover:border-primary/50"> 39 |
40 |
41 |
42 |
43 | 44 | {props?.item?.name} 45 | 46 |
47 |
48 | 49 | {props.item['c'] || props.categoryId} 50 | 51 | 52 | 53 | {time.getDate()}-{time.getMonth()+1}-{time.getFullYear()} 54 | 55 | 56 | 57 | {formatBytes(props.item['size']||props.item['s'])} 58 | 59 |
60 |
); 61 | }; 62 | 63 | export default CardExpanded; 64 | -------------------------------------------------------------------------------- /src/Common/Header.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import { usePathname, useRouter } from 'next/navigation'; 3 | 4 | 5 | const cRoutes = [ 6 | { 7 | path: [""], 8 | route: "/", 9 | title: "Home", 10 | }, 11 | { 12 | path: ["search"], 13 | route: "/search", 14 | title: "Search", 15 | }, 16 | 17 | { 18 | path: ["get-posts"], 19 | route: "/get-posts/category:Movies/", 20 | title: "Browse", 21 | }, 22 | { 23 | path: ["upload"], 24 | route: "/upload/", 25 | title: "Upload", 26 | }, 27 | { 28 | path: ["dashboard"], 29 | route: "/dashboard/", 30 | title: "Dashboard", 31 | }, 32 | { 33 | path: ["pages/movie"], 34 | route: "/pages/movie", 35 | title: "MOVIE", 36 | }, 37 | { 38 | path: ["pages/tv"], 39 | route: "/pages/tv", 40 | title: "TV", 41 | }, 42 | ]; 43 | 44 | 45 | const Header = () => { 46 | const [showNav,setShowNav] = useState(false); 47 | const router = usePathname(); 48 | const route = useRouter(); 49 | const[token,setToken]=useState(false) 50 | 51 | let cRouter = router?.split("/") ?? []; 52 | useEffect(()=>{ 53 | let temp = localStorage.getItem("access_token") || false 54 | setToken(temp) 55 | },[]) 56 | return ( 57 |
58 |
59 | 60 | 61 | 62 | 63 | route.push("/")}>theRARBG 64 | 65 |
66 | {cRoutes.map((obj, i) => ( 67 |
68 | { 69 | let temp = token?false:true 70 | if(i===3&&temp){ 71 | window.location.href=`/login`; 72 | } 73 | 74 | else{ 75 | route.push(`${obj.route}`); 76 | } 77 | }} key={i}> 78 |

{obj.title}

79 |
80 | ))} 81 |
82 | 91 |
92 | {/*Mobile Hamburger Menu */} 93 |
94 |
95 | route.push("/")}>theRARBG 96 | The Navigation Icon setShowNav(!showNav)}/> 97 |
98 |
99 | {cRoutes.map((obj, i) => ( 100 |
{ 102 | if(i===3&&!token){ 103 | route.push(`/login`); 104 | } 105 | else{ 106 | route.push(`${obj.route}`); 107 | } 108 | setShowNav(false)} 109 | } 110 | key={i}> 111 |

{obj.title}

112 |
113 | ))} 114 |
115 |
116 | 117 |
118 | ); 119 | }; 120 | 121 | export default Header 122 | -------------------------------------------------------------------------------- /src/Common/Loader.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Spinner } from "react-bootstrap"; 3 | 4 | //Whole page loader 5 | export const Loader = (props) => { 6 | return ( 7 |
8 | {" "} 9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
{props.loadingText||"Loading..."}
20 |
21 | ); 22 | }; 23 | 24 | //Button spinner 25 | export const BtnSpinner = () => { 26 | return ( 27 | <> 28 |