Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rupali-codes/LinksHub
Browse files Browse the repository at this point in the history
  • Loading branch information
rupali-codes committed Jun 12, 2023
2 parents fde8342 + 2b7ee58 commit 29ec091
Show file tree
Hide file tree
Showing 56 changed files with 1,072 additions and 299 deletions.
32 changes: 16 additions & 16 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@

## Files

README.md @CBID2
.gitignore @CBID2 @rupali-codes
LICENSE @rupali-codes
.github/workflows/ @rupali-codes
app/ @rupali-codes
components/ @CBID2 @rupali-codes
lib/ @CBID2 @rupali-codes
tests/ @rupali-codes
README.md @CBID2 @ujjawaltyagii @rupali-codes
.gitignore @CBID2 @ujjawaltyagii @rupali-codes
LICENSE @rupali-codes @CBID2 @ujjawaltyagii
.github/workflows/ @rupali-codes @CBID2 @ujjawaltyagii
app/ @rupali-codes @ujjawaltyagii
components/ @ujjawaltyagii @CBID2 @rupali-codes
lib/ @CBID2 @rupali-codes @ujjawaltyagii
tests/ @rupali-codes @CBID2 @ujjawaltyagii

## Directories
.github/ @rupali-codes @CBID2
node_modules/ @rupali-codes
public/ @CBID2 @rupali-codes
.env/ @rupali-codes
.github/ @rupali-codes @CBID2 @ujjawaltyagii
node_modules/ @rupali-codes @ujjawaltyagii
public/ @CBID2 @rupali-codes @ujjawaltyagii
.env/ @rupali-codes @ujjawaltyagii @CBID2

## Special cases
# Any changes to the CODEOWNERS file must be approved by @rupali-codes and @CBID2.
# Any changes to the .gitattributes file must be approved by @rupali-codes.
# Any changes to the .gitignore file must be approved by @CBID2.
# Any changes to the CODEOWNERS file must be approved by @rupali-codes @ujjawaltyagii @CBID2.
# Any changes to the .gitattributes file must be approved by @rupali-codes @CBID2 @ujjawaltyagii.
# Any changes to the .gitignore file must be approved by @CBID2 @ujjawaltyagii @rupali-codes.

## Contact information
# If you have any questions about the CODEOWNERS file, please contact @rupali-codes and @CBID2.
# If you have any questions about the CODEOWNERS file, please contact @rupali-codes @ujjawaltyagii @CBID2.
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'Documentation 📋'
description: 'Use this form to present your suggestions on how to improve our docs'
title: '[DOCS] <write your suggestion here>'
labels: ['documenation', 'goal: enhancement']

body:
- type: textarea
id: docs_description
attributes:
label: 'Issue Description'
description: 'Please provide a brief summary of the documentation issue you are experiencing or would like to address.'
validations:
required: true
- type: textarea
id: additional_context_docs
attributes:
label: 'Additional Context'
description: 'If there is any additional context or information that would be helpful for addressing the documentation issue, please provide it here.'

- type: textarea
id: screenshots_examples_docs
attributes:
label: 'Screenshots or Examples (if applicable)'
description: 'Please include relevant screenshots or examples to help illustrate the problem.'

- type: textarea
id: proposed_solution_docs
attributes:
label: 'Proposed Solution (optional)'
description: 'If you have a proposed solution for the documentation issue, please provide it here. This can be helpful for speeding up the resolution process.'

- type: checkboxes
id: terms_checklist_docs
attributes:
label: 'Checklist'
description: 'By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/rupali-codes/LinksHub/blob/main/CODE_OF_CONDUCT.md)'
options:
- label: 'I have checked the existing [issues](https://github.com/rupali-codes/LinksHub/issues?q=is%3Aissue+)'
required: true
- label: 'I have read the [Contributing Guidelines](https://github.com/rupali-codes/LinksHub/blob/main/CONTRIBUTING.md)'
required: true
- label: 'I am willing to work on this issue (optional)'
required: false
- label: "I am a GSSoC'23 contributor"
required: false
- type: markdown
attributes:
value: 'Thank you for taking the time to raise this issue! Your input is greatly appreciated.'
16 changes: 16 additions & 0 deletions .github/workflows/author-assign-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Author Assign'

on:
pull_request_target:
types: [opened, reopened]

permissions:
pull-requests: write

jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/auto-author-assign@v1.6.2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}' # GITHUB_TOKEN will be used by default
6 changes: 3 additions & 3 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- uses: EddieHubCommunity/gh-action-community/src/welcome@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hello ${{ github.actor }}, thanks for opening a issue, your contribution is valuable to us. The maintainers will review this issue and provide feedback as soon as possible."
pr-message: "Hello ${{ github.actor }}, thanks for rising a Pull request, your contribution is valuable to us. The maintainers will review this Pull Request and provide feedback as soon as possible. Keep the great work up!"
issue-message: "Hello ${{ github.actor }}! \n Thank you for raising this issue! 😊 Your contribution is valuable to us! 😊 \n\nPlease make sure to follow our [Contributing Guidelines. 💪🏻](https://github.com/rupali-codes/LinksHub/blob/main/CONTRIBUTING.md) \n\nOur review team will carefully assess the issue and reach out to you soon! 😇 \n We appreciate your patience! "
pr-message: "Thank you, ${{ github.actor }}, for creating this pull request and contributing to LinksHub! 💗\n\n The maintainers will review this Pull Request and provide feedback as soon as possible! 😇\nWe appreciate your patience and contribution, Keep up the great work! 😀"
37 changes: 37 additions & 0 deletions .husky/checkDuplicateLinks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Global Flag for duplicates
haveDuplicates=0

# Specify the path to the database folder
databaseFolder="database"

# Get the names of staged JSON files within any folder inside the database folder
stagedFiles=$(git diff --cached --name-only --relative="$databaseFolder" -- "**/*.json")

# Find Duplicates and Print them
for file in $stagedFiles; do

# Read the JSON from staged JSON files
jsonData=$(cat $databaseFolder/$file)

# Get the URLs from the JSON data
urls=$(echo "$jsonData" | sed -n 's/.*"url"\s*:\s*"\([^"]*\)".*/\1/p')

# Get the duplicate URLs from the URLSs list
duplicates=$(echo "$urls" | uniq -d)

# Print duplicate URLs if any
if [[ -n "$duplicates" ]]; then
haveDuplicates=1
echo -e "\nDuplicate url values found in $databaseFolder/$file: \n$duplicates"
fi
done

# Exit the commit process if duplicate URLs found
if [ "$haveDuplicates" -eq 1 ]; then
echo -e "\n[Error] Duplicates URLs found"
exit 1
else
echo -e "\nNo duplicates URLs found"
fi
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

bash .husky/checkDuplicateLinks.sh
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,14 @@ If you need more tips, check out [Conventional Commits](https://www.conventional
1. When you submit a pull request, several tests are automatically run
as GitHub Actions. If any of these tests fail, it is your responsibility to try and resolve the underlying issue(s). If you don't know how to resolve the underlying issue(s), you can ask for help.

2. If your pull request has merge conflicts with the `main` branch (GitHub checks for this automatically and notifies you), you are responsible for resolving them. You can do this by merging the `main` branch into your branch (`git pull upstream main`), and then pushing the updated branch to your fork (`git push`).
2. Each pull request should contain a single logical change or related set of changes that make sense to submit together. If a pull request becomes too large or contains too many unrelated changes, it becomes too difficult to review. In such cases, the reviewer has the right to close your pull request and ask that you submit a separate pull request for each logical set of changes that belong together.

3. Each pull request should contain a single logical change or related set of changes that make sense to submit together. If a pull request becomes too large or contains too many unrelated changes, it becomes too difficult to review. In such cases, the reviewer has the right to close your pull request and ask that you submit a separate pull request for each logical set of changes that belong together.

4. Link the issue you have resolved in the Pull Request Template (e.g Closes/Fixes #99).
5. Use [Conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/) for your changes.
6. Do not re-open a pull request that a reviewer has closed.
3. Link the issue you have resolved in the Pull Request Template (e.g Closes/Fixes #99).
4. Use [Conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/) for your changes.
5. Do not re-open a pull request that a reviewer has closed.
- Make sure to tick the "Allow edits from maintainers" box. This allows us to directly make minor edits / refactors and saves a lot of time.

> **Note**
> If your pull request has merge conflicts with the `main` branch (GitHub checks for this automatically and notifies you), you are responsible for resolving them. You can do this by merging the `main` branch into your branch (`git pull upstream main`), and then pushing the updated branch to your fork (`git push`). If you need more tips, check out [Resolving a merge conflict on GitHub](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-on-github).
---
## Remarks ✅

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ You can see the live demo at: https://linkshub.vercel.app
9. Commit your changes

```sh
git commit -m <your-commit-message>
git commit -m "<your-commit-message>"
```

10. Push your changes into your branch
Expand Down
41 changes: 41 additions & 0 deletions components/ForkButton/GitHubForkButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { FC } from "react";
import Link from "next/link";
import { useEffect, useState } from "react";
import { FaCodeBranch } from "react-icons/fa";

export const GitHubForkButton: FC<{ repo: string }> = ({ repo }) => {
const [forkCount, setForkCount] = useState(0);

useEffect(() => {
const fetchForkCount = async () => {
try {
const response = await fetch(`https://api.github.com/repos/${repo}`);
const data = await response.json();
setForkCount(data.forks);
} catch (error) {
console.error("Error fetching fork count:", error);
}
};

fetchForkCount();
}, [repo]);

// Other Styles for Light Mode: [bg-violet-500 text-white] OR [text-black-500 border border-black]

return (
<Link
href={`https://github.com/${repo}/fork`}
passHref
target="_blank"
rel="noopener noreferrer"
aria-label={`Fork ${repo} on GitHub`}
>
<div className="inline-flex items-center px-4 py-1 text-sm font-semibold bg-transparent text-violet-500 border border-violet-500 border-transparent rounded-sm transition-colors shadow-md">
<FaCodeBranch className="mr-1" />
<span className="font-semibold">Fork</span>
<span className="ml-2">{forkCount}</span>
</div>

</Link>
);
};
65 changes: 44 additions & 21 deletions components/Searchbar/Searchbar.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
import React, { useState } from "react";
import SearchIcon from "assets/icons/SearchIcon";
import { ChangeEvent } from "react";
import { SearchbarProps } from "types";

export const Searchbar = ({ setSearch }: SearchbarProps) => {
const handleSearch = (e: ChangeEvent<HTMLInputElement>) => {
setSearch(e.target.value);
interface SearchbarProps {
setSearch: (search: string) => void;
}

export const Searchbar: React.FC<SearchbarProps> = ({ setSearch }) => {
const [searchQuery, setSearchQuery] = useState("");
const [errorMessage, setErrorMessage] = useState("");

const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setSearchQuery(e.target.value);
setErrorMessage("");
};

const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (searchQuery.trim() === "") {
setErrorMessage("Please enter a search query");
} else {
setErrorMessage("");
setSearch(searchQuery);
}
};

return (
<>
<label htmlFor="simple-search" className="sr-only">
Search
</label>
<div className="relative w-full">
<div className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<SearchIcon className="w-5 h-5 text-violet-600 dark:text-violet-400" />
<form onSubmit={handleSubmit} noValidate>
<div className="flex items-center">
<div className="relative flex items-center">
{/* <div className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<SearchIcon className="w-5 h-5 text-violet-600 dark:text-violet-400" />
</div> */}
<input
type="text"
id="simple-search"
className="block p-2.5 w-full bg-transparent text-sm text-gray-900 dark:text-gray-200 border border-dashed border-gray-400 dark:border-gray-500 focus:border-violet-500 dark:focus:border-violet-500 dark:focus:ring-violet-500 focus:ring-violet-500 dark:placeholder-gray-400 outline-none transition-all ease-in-out duration-300 rounded-lg"
placeholder="Start searching..."
value={searchQuery}
onChange={handleSearchChange}
required
/>
</div>
<input
type="text"
id="simple-search"
className="block p-2.5 pl-10 w-full bg-transparent text-sm text-gray-900 dark:text-gray-200 border border-solid border-gray-400 dark:border-gray-600 focus:border-violet-500 dark:focus:border-violet-500 dark:focus:ring-violet-500 focus:ring-violet-500 dark:placeholder-gray-300 outline-none transition-all ease-in-out duration-300 rounded-lg"
placeholder="Search"
onChange={handleSearch}
required
/>
<button type="submit" className="ml-2 px-4 py-2.5 bg-violet-500 text-white rounded-md border border-dashed border-transparent hover:border-violet-400 hover:bg-transparent hover:text-violet-400 dark:hover:text-violet-400">
<SearchIcon className="w-5 h-5" />
</button>
</div>
</>
{errorMessage && (
<p className="text-red-500">{errorMessage}</p>
)}
</form>
);
};
4 changes: 2 additions & 2 deletions components/SideNavbar/SideNavbarBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export const SideNavbarBody: FC<{}> = () => {
return (
<div
className={classNames(
`bg-base-200 h-full w-full overflow-x-hidden whitespace-nowrap transition-all duration-300 ease-in dark:bg-gray-900 dark:text-gray-300`,
`bg-base-200 h-full w-full overflow-x-hidden whitespace-nowrap transition-all transition-none ease-in dark:bg-gray-900 dark:text-gray-300`,
theme === 'light' ? 'scrollColorLight' : 'scrollColorDark'
)}
>
<div className="bg-base-200 transiton-all w-full p-4 duration-300 ease-in dark:bg-gray-900">
<div className="bg-base-200 transiton-all w-full p-4 transition-none ease-in dark:bg-gray-900">
<Searchbar setSearch={setSearch} />
</div>
<SideNavbarCategoryList
Expand Down
Loading

0 comments on commit 29ec091

Please sign in to comment.