Skip to content

Commit

Permalink
Merge branch 'migrate-ts' into ag-ts-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
devilkiller-ag authored Mar 18, 2024
2 parents 01f8f95 + 133eaa3 commit 07c20db
Show file tree
Hide file tree
Showing 44 changed files with 1,770 additions and 187 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/notify-triager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Notify Triagers

on:
pull_request_target:
types: [opened, reopened, synchronize, edited, ready_for_review]

jobs:
Notify-triagers:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/[email protected]

- name: Check PR Changes for .md files
id: md-pr-changes
uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0
with:
files: |
**.md
- name: Check PR Changes for non-.md files
id: non-md-pr-changes
uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # version 42.1.0 https://github.com/tj-actions/changed-files/releases/tag/v42.1.0
with:
files: |
!**.md
- name: Extract Doc Triage Maintainers
id: doc-triager
run: |
docTriagers=$(grep '^#' CODEOWNERS | tail -n 2 | head -n 1)
echo "docTriagers: $docTriagers"
prefix="#docTriagers: "
docTriagers=${docTriagers#$prefix}
echo "docTriagers=$docTriagers" >> $GITHUB_ENV
- name: Extract Code Triage Maintainers
id: code-triager
run: |
codeTriagers=$(grep '^#' CODEOWNERS | tail -n 1)
echo "codeTriagers: $codeTriagers"
prefix="#codeTriagers: "
codeTriagers=${codeTriagers#$prefix}
echo "codeTriagers=$codeTriagers" >> $GITHUB_ENV
- name: Add Reviewers for code files
if: steps.non-md-pr-changes.outputs.any_changed == 'true'
run: |
IFS=' ' read -r -a codeTriagers <<< "${{ env.codeTriagers }}"
reviewers=$(printf ', "%s"' "${codeTriagers[@]}")
reviewers=[${reviewers:2}]
curl \
-X POST \
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d "{
\"reviewers\": $reviewers
}"
- name: Add Reviewers for doc files
if: steps.md-pr-changes.outputs.any_changed == 'true'
run: |
IFS=' ' read -r -a docTriagers <<< "${{ env.docTriagers }}"
reviewers=$(printf ', "%s"' "${docTriagers[@]}")
reviewers=[${reviewers:2}]
curl \
-X POST \
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d "{
\"reviewers\": $reviewers
}"
6 changes: 4 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
# For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/.

# The default owners are automatically added as reviewers when you open a pull request unless different owners are specified in the file.
* @derberg @akshatnema @magicmatatjahu @anshgoyalevil @sambhavgupta0705 @mayaleeeee @asyncapi-bot-eve
* @derberg @akshatnema @magicmatatjahu @anshgoyalevil @mayaleeeee @asyncapi-bot-eve

# All .md files
*.md @alequetzalli @octonawish-akcodes @BhaswatiRoy @TRohit20 @VaishnaviNandakumar @Arya-Gupta @J0SAL @asyncapi-bot-eve
*.md @alequetzalli @asyncapi-bot-eve

pages/blog/*.md @thulieblack @alequetzalli
pages/community/*.md @thulieblack @alequetzalli

README.md @alequetzalli @derberg @akshatnema @magicmatatjahu @mayaleeeee @asyncapi-bot-eve
#docTriagers: TRohit20 octonawish-akcodes BhaswatiRoy VaishnaviNandakumar Arya-Gupta J0SAL
#codeTriagers: sambhavgupta0705
2 changes: 1 addition & 1 deletion components/AlgoliaSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export default function AlgoliaSearch({ children } : { children: React.ReactNode
return (
<>
<Head>
<link rel='preconnect' href={`https://${APP_ID}-dsn.algolia.net`} crossOrigin='true' />
<link rel='preconnect' href={`https://${APP_ID}-dsn.algolia.net`} crossOrigin='anonymous' />
</Head>
<SearchContext.Provider value={{ isOpen, onOpen, onClose, onInput }}>
{children}
Expand Down
62 changes: 62 additions & 0 deletions components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { useEffect, useRef } from 'react';

interface IModalProps {
title: string;
children: React.ReactNode;
onModalClose?: () => void;
}

/**
* @description Modal component.
* @param {string} props.title - The title of the modal.
* @param {React.ReactNode} props.children - The content of the modal.
* @param {function} props.onModalClose=()=>{} - Function to handle modal close event.
*/
export default function Modal({
title,
children,
onModalClose = () => {}
}: IModalProps) {
const modalRef = useRef<HTMLDivElement>(null);

// Focus the modal when it mounts
useEffect(() => {
if (modalRef.current) modalRef.current.focus();
}, []);

/**
* @description Handles the backdrop click event.
* @param {React.MouseEvent<HTMLDivElement>} e - The event object.
*/
function backdropClickHandler(e: React.MouseEvent<HTMLDivElement>) {
if (modalRef.current && (modalRef.current === e.target || !modalRef.current.contains(e.target as Node))) {
onModalClose();
}
}

/**
* @description Handles the key up event.
* @param {React.KeyboardEvent<HTMLDivElement>} e - The event object.
*/
function onKeyUpHandler(e: React.KeyboardEvent<HTMLDivElement>) {
if (e.key === 'Escape') onModalClose();
}

return (
<div ref={modalRef} tabIndex={-1} className='fixed inset-0 z-30 my-auto mt-2 flex min-h-full items-end justify-center bg-black/30 p-4 text-center backdrop-blur sm:items-center sm:p-0' onClick={backdropClickHandler} onKeyUp={onKeyUpHandler}>
<div className='relative m-auto overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:w-full sm:max-w-4xl sm:p-6'>
<div className='mb-6 flex justify-between'>
<h1 className='mr-4 truncate text-lg font-bold'>{title}</h1>
<button onClick={() => onModalClose()} data-testid='Modal-close'>
<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' strokeWidth={1.5} stroke='currentColor' className='size-6'>
<path strokeLinecap='round' strokeLinejoin='round' d='M6 18L18 6M6 6l12 12' />
</svg>
</button>
</div>
<div className='max-h-[65vh] w-full overflow-auto lg:max-h-[70vh]'>
{children}
</div>
</div>
</div>
);
}
59 changes: 59 additions & 0 deletions components/SupportUs/SupportItemsList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
interface ISupportItemType {
href: string;
imgSrc: string;
imgTitle: string;
imgClass: string;
section: number;
};

export const items : ISupportItemType[] = [
{
href: 'https://slack.com/media-kit',
imgSrc: '/img/supportus/slack.webp',
imgTitle: 'Slack - Free Standard Subscription.',
imgClass: 'inline-block px-4 sm:h-10',
section: 1
},
{
href: 'https://toast.ninja/',
imgSrc: '/img/supportus/toast.webp',
imgTitle: 'Toast - Free services.',
imgClass: 'inline-block px-4 sm:h-10',
section: 1
},
{
href: 'https://www.netlify.com/',
imgSrc: '/img/supportus/netlify.webp',
imgTitle: 'Netlify - Free website deployment.',
imgClass: 'inline-block px-4 sm:h-10',
section: 1
},
{
href: 'https://sonarcloud.io/',
imgSrc: '/img/supportus/sonarcloud.webp',
imgTitle: 'Sonarcloud - Free tier for automated project scanning.',
imgClass: 'inline-block px-4 md:h-14',
section: 2
},
{
href: 'https://www.digitalocean.com/press/',
imgSrc: '/img/supportus/digitalocean.webp',
imgTitle: 'DigitalOcean - 500 dollars on cloud services.',
imgClass: 'inline-block px-2 sm:h-8',
section: 2
},
{
href: 'https://restream.io/',
imgSrc: '/img/supportus/restream.webp',
imgTitle: 'Restream - Free professional plan subscription.',
imgClass: 'inline-block px-4 sm:h-6',
section: 2
},
{
href: 'https://sessionize.com/',
imgSrc: '/img/supportus/sessionize.webp',
imgTitle: 'Sessionize-Free community license for AACoT Madrid.',
imgClass: 'inline-block px-4 sm:h-9',
section: 3
}
];
81 changes: 81 additions & 0 deletions components/SupportUs/SupportUs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { items } from './SupportItemsList';

interface SupportUsProps {
className?: string;
showSupportBanner?: boolean;
};

/**
* @description This component displays support items.
* @param {SupportUsProps} props - The props for SupportUs component.
* @param {string} props.className - Additional CSS classes for styling.
* @param {boolean} props.showSupportBanner - Indicates whether support banner should be displayed.
*/
export default function SupportUs({
className = ''
} : SupportUsProps): React.ReactNode {
return (
<div className={ `text-center ${ className }` } data-testid='SupportUs-main'>
<div className='flex flex-wrap items-center justify-center sm:py-2 md:mb-4 md:px-4' data-testid='SupportUs-section'>
{ items
.filter((item) => item.section === 1)
.map((item, index) => (
<a
key={ index }
href={ item.href }
target='_blank'
rel='noopener noreferrer'
className='relative block w-2/3 p-4 text-center sm:w-1/3 sm:p-0 md:w-1/3 lg:w-1/5'
>
<img
className={ item.imgClass }
src={ item.imgSrc }
title={ item.imgTitle }
alt={item.imgTitle}
/>
</a>
)) }
</div>
<div className='mb-4 flex flex-wrap items-center justify-center md:px-2' data-testid='SupportUs-subsection'>
{ items
.filter((item) => item.section === 2)
.map((item, index) => (
<a
key={ index }
href={ item.href }
target='_blank'
rel='noopener noreferrer'
className='relative block w-2/3 p-4 text-center sm:w-1/3 sm:p-0 md:w-1/3 lg:w-1/5'
>
<img
className={ item.imgClass }
src={ item.imgSrc }
title={ item.imgTitle }
alt={item.imgTitle}
/>
</a>
)) }
</div>
<div className='mb-4 flex flex-wrap items-center justify-center md:px-2' data-testid='SupportUs-last-div'>
{ items
.filter((item) => item.section === 3)
.map((item, index) => (
<a
key={ index }
href={ item.href }
target='_blank'
rel='noopener noreferrer'
className='relative block w-2/3 p-4 text-center sm:w-1/3 sm:p-0 md:w-1/3 lg:w-1/5'
>
<img
className={ item.imgClass }
src={ item.imgSrc }
title={ item.imgTitle }
alt={item.imgTitle}
/>
</a>
)) }
</div>
</div>
);
}
Loading

0 comments on commit 07c20db

Please sign in to comment.