From 706aa6a8081bb71ec8bc9bc89ac5bedd53938488 Mon Sep 17 00:00:00 2001 From: Anmol Baranwal <74038190+Anmol-Baranwal@users.noreply.github.com> Date: Tue, 13 Jun 2023 21:45:55 +0530 Subject: [PATCH] chore: clean up codebase and code organization (#1021) --- .prettierrc.json | 2 +- SECURITY.md | 18 +- app/constants.ts | 2 +- assets/icons/SearchIcon.tsx | 10 +- components/Aside/Aside.tsx | 8 +- components/BackToTop/BackToTopButton.tsx | 46 +-- components/BackToTop/index.ts | 2 +- components/Backdrop/Backdrop.tsx | 17 +- components/Cards/Card.tsx | 29 +- components/Cards/CardsList.tsx | 51 ++- components/Cards/CardsListItem.tsx | 14 +- components/Footer/Footer.tsx | 8 +- components/Footer/index.ts | 2 +- components/ForkButton/GitHubForkButton.tsx | 69 ++-- components/Header/Header.tsx | 33 +- components/Loader/Preloader.tsx | 20 +- components/Loader/Spinner.tsx | 8 +- components/MainContainer/MainContainer.tsx | 6 +- components/MainContainer/index.ts | 2 +- components/NewIssue/NewIssue.tsx | 18 +- components/Searchbar/Searchbar.tsx | 41 +- components/Searchbar/index.ts | 2 +- components/SideNavbar/SideNavbar.tsx | 33 +- components/SideNavbar/SideNavbarCategory.tsx | 32 +- components/SideNavbar/SideNavbarHeader.tsx | 29 +- components/SideNavbar/index.ts | 2 +- .../SocialMedia/SocialMediaIconsList.tsx | 20 +- components/ThemeToggler/intex.ts | 2 +- components/ThemeToggler/themeToggler.tsx | 29 +- components/TopBar/TopBar.tsx | 24 +- components/TopBar/index.ts | 2 +- components/logo/index.tsx | 12 +- components/popup/index.tsx | 6 +- context/GlobalContext.tsx | 30 +- context/GlobalReducer.ts | 20 +- database/backend/authentication.json | 28 +- database/backend/system-design.json | 18 +- database/backend/testing.json | 1 - database/backend/validation.json | 6 +- database/frontend/accessibility.json | 2 +- database/frontend/animations.json | 198 +++++----- database/frontend/colors.json | 2 +- database/frontend/design-inspirations.json | 352 +++++++++--------- database/frontend/fonts.json | 100 ++--- database/frontend/illustrations.json | 2 +- database/frontend/online-code-editors.json | 1 - database/frontend/react.json | 116 +++--- database/frontend/themes-templates.json | 99 +++-- database/frontend/videos.json | 16 +- database/languages/c-programming.json | 2 +- database/languages/csharp.json | 42 +-- database/languages/golang.json | 14 +- database/languages/javascript.json | 142 +++---- database/languages/python.json | 56 +-- database/languages/ruby.json | 16 +- database/ml&ai/datascience.json | 44 +-- database/ml&ai/deeplearning.json | 16 +- database/ml&ai/ml.json | 44 +-- database/opensource/blogs.json | 56 +-- database/opensource/tools.json | 42 +-- database/other/communities.json | 16 +- database/other/devtools.json | 2 +- database/other/github.json | 22 +- database/other/other-resources.json | 46 +-- database/other/podcasts.json | 14 +- database/resources/blogs.json | 278 +++++++------- database/resources/e-book.json | 64 ++-- database/resources/hosting.json | 129 +++---- database/resources/project-ideas.json | 3 +- database/youtube/android.json | 10 +- database/youtube/competitive-programming.json | 66 ++-- database/youtube/computer-science.json | 2 +- database/youtube/css.json | 2 +- database/youtube/data-structures.json | 12 +- database/youtube/fintech.json | 80 ++-- database/youtube/game-development.json | 2 +- database/youtube/machine-learning.json | 130 +++---- database/youtube/tensorflow.json | 48 +-- database/youtube/testing.json | 48 +-- database/youtube/web3-metaverse.json | 2 +- hooks/useDelayUnmount.ts | 24 +- hooks/useFilterDB.ts | 24 +- hooks/useLoader.ts | 16 +- hooks/useSearch.ts | 20 +- layouts/GeneralLayout.tsx | 12 +- pages/[subcategory]/index.tsx | 34 +- pages/_app.tsx | 14 +- pages/index.tsx | 5 +- styles/globals.css | 53 +-- 89 files changed, 1633 insertions(+), 1609 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 2fd08941b..043b0cd76 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -4,4 +4,4 @@ "singleQuote": true, "tabWidth": 2, "useTabs": false -} \ No newline at end of file +} diff --git a/SECURITY.md b/SECURITY.md index 3fa5e654d..bbad04c56 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,49 +1,43 @@ - # Security Policy - - - ## Introduction This document outlines the security policy for the [Linkshub](https://linkshub.vercel.app/) open source project that provides links to websites for courses across the internet. The policy is intended to provide guidelines and procedures for reporting, triaging, and addressing security vulnerabilities in the project. + ## Scope The security policy covers the codebase and documentation of the open source project, as well as the external links to websites for courses. + ## Vulnerability Disclosure Process The project will provide a dedicated email address (rupali7487@gmail.com) for submitting vulnerability reports related to the [Linkshub](https://linkshub.vercel.app/) website or any of the linked websites. Vulnerability reports will be reviewed and triaged by the project's maintainers. The owner will aim to respond to vulnerability reports within 72 hours, and will provide regular updates on the status of the vulnerability and any remediation efforts. + ## Roles and Responsibilities The maintainers are responsible for handling vulnerability reports and making decisions about how to address them. They will also work with contributors and external website owners to resolve the issue(s) as quickly as possible. - - ## Response Timeline LinksHub will aim to resolve critical vulnerabilities within 30 days and non-critical vulnerabilities within 90 days. These deadlines may extend if additional time is needed to address the issue(s). - -## Secure Coding Practices +## Secure Coding Practices LinksHub will provide guidance on secure coding practices for contributors, including guidelines for input validation, authentication, authorization, and data protection. + ## Regular Review and Update The security policy will be regularly reviewed and updated to ensure that it remains effective and relevant. The maintainers will evaluate the vulnerability disclosure process, update secure coding guidelines, and revise the response timeline as needed. + ## Disclosure Policy LinksHub will follow a coordinated disclosure policy, which means that vulnerabilities will be disclosed publicly only after they have been remediated. The project may work with external website owners to coordinate disclosure of vulnerabilities that affect their websites. - ## Legal Disclaimer The security policy includes a legal disclaimer that limits the liability of the project maintainers and contributors for any security vulnerabilities or incidents that occur as a result of using[Linkshub's](https://linkshub.vercel.app/) website or any of the linked sources. - ## Contact Information If you have any questions or concerns about the security policy or any security vulnerabilities in the project, please contact us at _linkshub.opensource@gmail.com_. - By implementing this security policy, we aim to ensure that vulnerabilities are addressed in a timely manner, and that users and contributors can use [Linkshub](https://linkshub.vercel.app/) and its linked sources safely and securely. - diff --git a/app/constants.ts b/app/constants.ts index 26402b9c3..ff1feb446 100644 --- a/app/constants.ts +++ b/app/constants.ts @@ -1 +1 @@ -export const SCROLL_LIMIT = 200; +export const SCROLL_LIMIT = 200 diff --git a/assets/icons/SearchIcon.tsx b/assets/icons/SearchIcon.tsx index f09f00b98..199c09a0f 100644 --- a/assets/icons/SearchIcon.tsx +++ b/assets/icons/SearchIcon.tsx @@ -1,5 +1,5 @@ -import React from "react"; -import { SVGProps } from "react"; +import React from 'react' +import { SVGProps } from 'react' const SearchIcon = ({ ...rest }: SVGProps) => { return ( ) => { clipRule="evenodd" > - ); -}; + ) +} -export default SearchIcon; +export default SearchIcon diff --git a/components/Aside/Aside.tsx b/components/Aside/Aside.tsx index c0907a24c..a2cce97be 100644 --- a/components/Aside/Aside.tsx +++ b/components/Aside/Aside.tsx @@ -1,10 +1,10 @@ -import { FC } from "react"; -import { SideNavbarBody } from "components/SideNavbar/SideNavbarBody"; +import { FC } from 'react' +import { SideNavbarBody } from 'components/SideNavbar/SideNavbarBody' export const Aside: FC<{}> = () => { return ( - ); -}; + ) +} diff --git a/components/BackToTop/BackToTopButton.tsx b/components/BackToTop/BackToTopButton.tsx index ca27c831e..336556f77 100644 --- a/components/BackToTop/BackToTopButton.tsx +++ b/components/BackToTop/BackToTopButton.tsx @@ -1,47 +1,47 @@ -import React, { useEffect, useState } from "react"; -import { useTransition } from "react-transition-state"; -import { FaArrowUp } from "react-icons/fa"; -import { SCROLL_LIMIT } from "app/constants"; +import React, { useEffect, useState } from 'react' +import { useTransition } from 'react-transition-state' +import { FaArrowUp } from 'react-icons/fa' +import { SCROLL_LIMIT } from 'app/constants' export const BackToTopButton = () => { - const [scrollY, setScrollY] = useState(0); + const [scrollY, setScrollY] = useState(0) const [{ isMounted, status }, toggle] = useTransition({ mountOnEnter: true, unmountOnExit: true, preEnter: true, - }); + }) useEffect(() => { const handleScroll = () => { - setScrollY(window.scrollY); - }; + setScrollY(window.scrollY) + } - handleScroll(); + handleScroll() - window.addEventListener("scroll", handleScroll); + window.addEventListener('scroll', handleScroll) return () => { - window.removeEventListener("scroll", handleScroll); - }; - }, []); + window.removeEventListener('scroll', handleScroll) + } + }, []) useEffect(() => { - toggle(scrollY > SCROLL_LIMIT); - }, [scrollY]); + toggle(scrollY > SCROLL_LIMIT) + }, [scrollY]) const handleClick = () => { window.scrollTo({ top: 0, - behavior: "smooth", - }); - }; + behavior: 'smooth', + }) + } return isMounted ? (
- ) : null; -}; + ) : null +} diff --git a/components/BackToTop/index.ts b/components/BackToTop/index.ts index 0ac1f43b8..c923a0f8b 100644 --- a/components/BackToTop/index.ts +++ b/components/BackToTop/index.ts @@ -1 +1 @@ -export { BackToTopButton } from "./BackToTopButton"; +export { BackToTopButton } from './BackToTopButton' diff --git a/components/Backdrop/Backdrop.tsx b/components/Backdrop/Backdrop.tsx index fa50684a8..a6ae96641 100644 --- a/components/Backdrop/Backdrop.tsx +++ b/components/Backdrop/Backdrop.tsx @@ -1,14 +1,17 @@ -import { FC } from "react"; -import { createPortal } from "react-dom"; +import { FC } from 'react' +import { createPortal } from 'react-dom' -export const Backdrop: FC<{ onClick: (() => void) | undefined, className?: string | undefined }> = (props) => { - const { onClick, className } = props; +export const Backdrop: FC<{ + onClick: (() => void) | undefined + className?: string | undefined +}> = (props) => { + const { onClick, className } = props return createPortal( -
, document.getElementById('backdrop-root')! - ); -}; + ) +} diff --git a/components/Cards/Card.tsx b/components/Cards/Card.tsx index fb6f22d36..585ad3a40 100644 --- a/components/Cards/Card.tsx +++ b/components/Cards/Card.tsx @@ -1,4 +1,4 @@ -import { FC,useState, useRef, useEffect } from 'react' +import { FC, useState, useRef, useEffect } from 'react' import { BsBoxArrowUpRight } from 'react-icons/bs' import { CopyToClipboard } from 'components/CopyToClipboard' import type { IData } from 'types' @@ -6,10 +6,13 @@ import type { IData } from 'types' const Card: FC<{ data: IData }> = (props) => { const { data } = props const { name, description, url } = data - const descriptionRef = useRef(document.createElement("p")); - const [isOverflow, setIsOverflow] = useState(false); - useEffect (() => { - setIsOverflow(descriptionRef.current?.scrollHeight > descriptionRef.current?.offsetHeight); + const descriptionRef = useRef(document.createElement('p')) + const [isOverflow, setIsOverflow] = useState(false) + useEffect(() => { + setIsOverflow( + descriptionRef.current?.scrollHeight > + descriptionRef.current?.offsetHeight + ) }, []) return ( @@ -25,11 +28,17 @@ const Card: FC<{ data: IData }> = (props) => {
-

{description}

- { - (isOverflow) && -

Read More

- } +

+ {description} +

+ {isOverflow && ( +

+ Read More +

+ )}