Skip to content

Commit

Permalink
Merge branch 'main' into opblog
Browse files Browse the repository at this point in the history
  • Loading branch information
S-ishita authored Aug 2, 2023
2 parents a53891b + d5e31de commit 4e1da94
Show file tree
Hide file tree
Showing 27 changed files with 434 additions and 143 deletions.
80 changes: 80 additions & 0 deletions .github/labeler-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
filters:
- label: 'goal: new-feature'
regexs:
- /\bfeat\b/
- /feature/i
events: [pull_request]
targets: [title]

- label: 'documentation'
regexs:
- /docs/i
events: [pull_request]
targets: [title]

- label: 'bug'
regexs:
- /bug/i
events: [pull_request]
targets: [title]
- label: 'bug'
regexs:
- /fix/i
events: [pull_request]
targets: [title]

- label: 'chore'
regexs:
- /category/i
events: [pull_request]
targets: [title]
- label: 'goal: new-category'
regexs:
- /category/i
events: [pull_request]
targets: [title]

- label: 'chore'
regexs:
- /\blink\b/
- /link/i
events: [pull_request]
targets: [title]
- label: 'goal: new-link'
regexs:
- /\blink\b/
- /link/i
events: [pull_request]
targets: [title]

- label: 'chore'
regexs:
- /description/i
events: [pull_request]
targets: [title]

- label: 'chore'
regexs:
- /chore/i
events: [pull_request]
targets: [title]

- label: 'goal: build'
regexs:
- /build/i
events: [pull_request]
targets: [title]

- label: 'goal: refactor'
regexs:
- /\brefactor\b/
- /refactor/i
events: [pull_request]
targets: [title]

- label: 'accessibility'
regexs:
- /\baccessibility\b/
- /accessibility/i
events: [issues, pull_request] # default
targets: [title, comment] # default
24 changes: 24 additions & 0 deletions .github/workflows/add-labels-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# reference: https://github.com/hoho4190/issue-pr-labeler
name: PR Labeler

on:
pull_request_target:
types:
- opened
- reopened

jobs:
main:
runs-on: ubuntu-latest

permissions:
contents: read # to read configuration yml file
pull-requests: write # to add labels to pull requests

steps:
- name: Run PR Labeler
uses: hoho4190/issue-pr-labeler@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file-name: labeler-config.yml
# disable-bot: true # this will prevent issues, PRs created by bots
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ Thank you for taking the time to contribute to our project. Please take a moment

> For example, if you are adding a subcategory using the file `online-code-editors.json`, add `online-code-editors` to the `export type` statement in the appropriate style.
- If you are adding a subcategory, go to `components/TopBar/CategoryDescriptions.ts` and add the subcategory name used when exporting the name in `database/index.ts`, along with a proper description in the correct format.
- If you are adding a subcategory, go to `components/TopBar/CategoryDescriptions.ts` and add the subcategory name used when exporting the name in `database/index.ts`, along with a concise description in the correct format.

> For example, if you export the subcategory name as `onlineCodeEditors` in `database/index.ts`, add the same name to `CategoryDescriptions.ts` using the following style:
> subcategoryName: 'description of this subcategory'
- You can check out similar examples [here](components/TopBar/CategoryDescriptions.ts). It's essential to add a description when submitting a pull request to add a subcategory; to merge it in the codebase.

### Appending new Links 🔗

> ✨ You can also create [issue(s)](https://github.com/rupali-codes/LinksHub/issues/new/choose) to suggest new links, and someone else will take care of them.
Expand Down Expand Up @@ -178,4 +180,4 @@ When adding _YouTube_ channel link, please specify _the language_ of the channel
## Remarks ✅
- If something is missing here, or you feel something is not well described, either create a PR, [raise an issue](https://github.com/rupali-codes/LinksHub/issues), or [do a code review of the person’s PR](https://www.freecodecamp.org/news/code-review-tips/) (ensure that your review conforms to the [Code of Conduct](https://github.com/CBID2/LinksHub-my-version-/blob/main/CODE_OF_CONDUCT.md))
- If something is missing here, or you feel something is not well described, either create a PR, [raise an issue](https://github.com/rupali-codes/LinksHub/issues), or [do a code review of the person’s PR](https://www.freecodecamp.org/news/code-review-tips/) (ensure that your review conforms to the [Code of Conduct](https://github.com/CBID2/LinksHub-my-version-/blob/main/CODE_OF_CONDUCT.md))
4 changes: 2 additions & 2 deletions components/Cards/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, useState, useRef, useEffect } from 'react'
import { BsBoxArrowUpRight } from 'react-icons/bs'
import { CopyToClipboard } from 'components/CopyToClipboard'
import { Share } from 'components/Share';
import { Share } from 'components/Share'
import type { IData } from 'types'

interface CardProps {
Expand Down Expand Up @@ -34,7 +34,7 @@ const Card: FC<CardProps> = ({ data }) => {
</h2>
<div className="flex items-center gap-1">
<CopyToClipboard url={url} />
<Share url={url} title={name} />
<Share url={`${url}?ref=LinksHub`} title={name} />
</div>
</header>
<div className="h-[7rem]">
Expand Down
40 changes: 29 additions & 11 deletions components/CopyToClipboard/CopyToClipboard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import useCopyToClipboard from 'hooks/useCopyToClipboard'
import React from 'react'
import React, { useState } from 'react'
import { FaRegCopy } from 'react-icons/fa'

type CopyToClipboardProps = {
Expand All @@ -8,23 +8,41 @@ type CopyToClipboardProps = {

export const CopyToClipboard = ({ url }: CopyToClipboardProps): JSX.Element => {
const [copyToClipboard, { success }] = useCopyToClipboard()
const [isHovering, setIsHovering] = useState(false)

function handleCopy(e: React.MouseEvent<SVGElement, MouseEvent>) {
e.stopPropagation()
copyToClipboard(url)
}

return (
<div className="dropdown dropdown-left dropdown-hover">
<FaRegCopy
size={'1.3rem'}
className="text-theme-primary cursor-pointer"
title="Copy link"
onClick={(e) => handleCopy(e)}
/>
<p className="dropdown-content bg-theme-secondary text-white text-sm rounded-lg px-3 py-1 cursor-default">
{success ? 'Copied!' : 'Copy'}
</p>
<div
className="dropdown dropdown-left dropdown-hover"
onMouseEnter={() => setIsHovering(true)}
onMouseLeave={() => setIsHovering(false)}
>
<div style={{ position: 'relative' }}>
<FaRegCopy
size={'1.3rem'}
className="text-theme-primary cursor-pointer"
title="Copy link"
onClick={(e) => handleCopy(e)}
/>
{isHovering && (
<p
className="bg-theme-secondary text-white text-sm rounded-lg px-3 py-1 cursor-default"
style={{
position: 'absolute',
top: '-2rem', // Adjust this value to position the text above the icon
left: '50%',
transform: 'translateX(-50%)',
zIndex: 1,
}}
>
{success ? 'Copied!' : 'Copy'}
</p>
)}
</div>
</div>
)
}
Expand Down
4 changes: 1 addition & 3 deletions components/ForkButton/GitHubForkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export const GitHubForkButton: FC<{ repo: string }> = ({ repo }) => {
rel="noopener noreferrer"
aria-label={`Fork ${repo} on GitHub`}
>
<div
className="inline-flex items-center py-1 text-sm font-semibold bg-transparent text-theme-secondary rounded-sm transition-colors transition duration-300 ease-in-out hover:text-text-secondary transition duration-300 ease-in-out dark:hover:text-text-primary dark:text-theme-primary"
>
<div className="inline-flex items-center py-1 text-sm font-semibold bg-transparent text-theme-secondary rounded-sm hover:text-text-secondary transition duration-300 ease-in-out dark:hover:text-text-primary dark:text-theme-primary">
<FaCodeBranch className="mr-1" />
<span className="font-semibold">Fork</span>
<span className="ml-2">{forkCount}</span>
Expand Down
3 changes: 2 additions & 1 deletion components/Searchbar/Searchbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { subcategoryArray } from '../../types'
interface SearchbarProps {
setSearch: (search: string) => void
}

export const Searchbar: React.FC<SearchbarProps> = ({ setSearch }) => {
const router = useRouter()
const query = router.query.query
Expand Down Expand Up @@ -75,6 +75,7 @@ export const Searchbar: React.FC<SearchbarProps> = ({ setSearch }) => {
placeholder="Quick search..."
value={searchQuery}
onChange={handleSearchChange}
autoComplete="off"
required
/>
<button
Expand Down
58 changes: 40 additions & 18 deletions components/Share/Share.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,65 @@
import React from 'react';
import { FaShareAlt } from 'react-icons/fa';
import React, { useState } from 'react'
import { FaShareAlt } from 'react-icons/fa'

type ShareProps = {
url: string;
title: string;
};
url: string
title: string
}

export const Share: React.FC<ShareProps> = ({ url, title }) => {
const [showShareOptions, setShowShareOptions] = useState(false)

async function handleShare() {
if (navigator.share) {
try {
await navigator.share({
title: title,
url: url,
});
console.log('Share was successful.');
})
console.log('Share was successful.')
} catch (error) {
console.error('Error sharing:', error);
console.error('Error sharing:', error)
}
} else {
console.log('Web Share API not supported on this browser.');
// Fallback behavior when Web Share API is not supported (e.g., open a new tab with the URL)
window.open(url, '_blank');
console.log('Web Share API not supported on this browser.')
// Fallback behavior when Web Share API is not supported (e.g., open a new tab with the URL)
window.open(url, '_blank')
}
}

return (
<div className="dropdown dropdown-left dropdown-hover">
<div
style={{
position: 'relative',
display: 'inline-block',
}}
onMouseEnter={() => setShowShareOptions(true)}
onMouseLeave={() => setShowShareOptions(false)}
>
<FaShareAlt
size={'1.2rem'}
className="text-theme-primary cursor-pointer"
title="Share link"
onClick={handleShare}
/>
<p className="dropdown-content bg-theme-secondary text-white text-sm rounded-lg px-3 py-1 cursor-default">
Share
</p>
{showShareOptions && (
<p
className="bg-theme-secondary text-white text-sm rounded-lg px-3 py-1"
style={{
position: 'absolute',
top: '100%',
left: '50%',
transform: 'translateX(-50%)',
zIndex: 1,
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
cursor: 'default',
}}
>
Share
</p>
)}
</div>
);
};
)
}

export default Share;
export default Share
2 changes: 1 addition & 1 deletion components/StarButton/GitHubStarButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const GitHubStarButton: FC<{ repo: string }> = ({ repo }) => {
rel="noopener noreferrer"
aria-label={`Star ${repo} on GitHub`}
>
<div className="inline-flex items-center py-1 text-sm font-semibold bg-transparent text-theme-secondary rounded-sm transition-colors transition duration-300 ease-in-out hover:text-text-secondary transition duration-300 ease-in-out dark:hover:text-text-primary dark:text-theme-primary">
<div className="inline-flex items-center py-1 text-sm font-semibold bg-transparent text-theme-secondary rounded-sm hover:text-text-secondary transition duration-300 ease-in-out dark:hover:text-text-primary dark:text-theme-primary">
<FaRegStar className="mr-1" />
<span>Star</span>
<span className="ml-2">{starCount}</span>
Expand Down
9 changes: 9 additions & 0 deletions database/IOT/raspberry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "An Introduction to Raspberry Pi microcontroller",
"description": "The Raspberry Pi is a low-cost, credit-card-sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse. It also enables people of all ages to explore computing and learn programming languages like Scratch and Python.",
"url": "https://www.raspberrypi.org/",
"category": "internet of things",
"subcategory": "raspberrypi"
}
]
9 changes: 9 additions & 0 deletions database/cloud_computing_platforms/aws.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "Amazon Web Services",
"description": "Gain free, hands-on experience with the AWS platform, products, and services. AWS Activate provides eligible startups with a host of resources, including free AWS credits to spend on AWS services, and AWS Support. ",
"url": "https://docs.aws.amazon.com/index.html",
"category": "cloud computing",
"subcategory": "aws"
}
]
9 changes: 9 additions & 0 deletions database/cloud_computing_platforms/azure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "Microsoft Azure",
"description": "Learn how to build and manage powerful applications using Microsoft Azure cloud services. Get documentation, example code, tutorials, and more.",
"url": "https://learn.microsoft.com/en-us/azure/?product=popular",
"category": "cloud computing",
"subcategory": "azure"
}
]
9 changes: 9 additions & 0 deletions database/cloud_computing_platforms/gcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "Google Cloud Platform",
"description": "Find guides, code samples, architectural diagrams, best practices, tutorials, API references, and more to learn how to build on Google Cloud.",
"url": "https://cloud.google.com/docs/",
"category": "cloud computing",
"subcategory": "gcp"
}
]
9 changes: 9 additions & 0 deletions database/cloud_computing_platforms/ibm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "IBM Cloud",
"description": "The IBM Cloud platform is composed of multiple components that work together to provide a consistent and dependable cloud experience.",
"url": "https://cloud.ibm.com/docs",
"category": "cloud computing",
"subcategory": "ibm"
}
]
9 changes: 9 additions & 0 deletions database/cloud_computing_platforms/oracle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "Oracle Cloud",
"description": "Looking for comprehensive documentation, tutorials, or videos so you can learn about Oracle Cloud Services? You can find all of these resources here in the Oracle Help Center.",
"url": "https://docs.oracle.com/en/cloud/get-started/index.html",
"category": "cloud computing",
"subcategory": "oracle"
}
]
Loading

0 comments on commit 4e1da94

Please sign in to comment.