-
Notifications
You must be signed in to change notification settings - Fork 11
feat(legacy): 💄 add recommendation for our AI course #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
2709f18
15e2300
91aca19
9e73393
c4e8558
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,68 @@ | ||||||||||||
| import { useRouter } from 'next/router' | ||||||||||||
| import { useState, useEffect } from 'react' | ||||||||||||
| import * as Dialog from '@radix-ui/react-dialog' | ||||||||||||
| import { XMarkIcon } from '@heroicons/react/24/outline' | ||||||||||||
| import { Button } from './Button' | ||||||||||||
|
|
||||||||||||
| const MODAL_COOKIE_KEY = 'global_modal_closed' | ||||||||||||
|
|
||||||||||||
| export function GlobalModal() { | ||||||||||||
| const [isOpen, setIsOpen] = useState(false) | ||||||||||||
| const router = useRouter() | ||||||||||||
|
|
||||||||||||
| useEffect(() => { | ||||||||||||
| const hasClosedModal = document.cookie | ||||||||||||
| .split('; ') | ||||||||||||
| .find(row => row.startsWith(MODAL_COOKIE_KEY)) | ||||||||||||
| ?.split('=')[1] | ||||||||||||
|
|
||||||||||||
| if (!hasClosedModal) { | ||||||||||||
| setIsOpen(true) | ||||||||||||
| } | ||||||||||||
| }, []) | ||||||||||||
|
|
||||||||||||
| useEffect(() => { | ||||||||||||
| if (router.asPath.startsWith("/kurz-ai")) { | ||||||||||||
| setTimeout(handleClose, 500) | ||||||||||||
| } | ||||||||||||
| }, [router.asPath]) | ||||||||||||
|
|
||||||||||||
| const handleChange = (isOpen: boolean) => { | ||||||||||||
| if (isOpen) { | ||||||||||||
| setIsOpen(isOpen) | ||||||||||||
| } else { | ||||||||||||
| handleClose() | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| const handleClose = () => { | ||||||||||||
| // Set cookie to expire in 1 year | ||||||||||||
| document.cookie = `${MODAL_COOKIE_KEY}=true; path=/; max-age=${60 * 60 * 24 * 365}; SameSite=Lax` | ||||||||||||
| setIsOpen(false) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| return ( | ||||||||||||
| <Dialog.Root open={isOpen} onOpenChange={handleChange}> | ||||||||||||
| <Dialog.Portal> | ||||||||||||
| <Dialog.Overlay className="fixed inset-0 backdrop-blur-md" /> | ||||||||||||
| <Dialog.Content className="fixed left-1/2 top-1/2 w-full xl:w-1/2 h-fit -translate-x-1/2 -translate-y-1/2 bg-background p-6 shadow-lg"> | ||||||||||||
| <Dialog.Close asChild onClick={handleClose}> | ||||||||||||
| <button type="button" className='z-50 absolute top-0 right-0 flex flex-col items-center justify-center p-3 duration-500 outline-none cursor-pointer lg:p-6 hover:opacity-30'> | ||||||||||||
| <XMarkIcon className='block h-10 w-10' aria-hidden='true' /> | ||||||||||||
| </button> | ||||||||||||
| </Dialog.Close> | ||||||||||||
| <Dialog.Title className="text-lg font-semibold"> | ||||||||||||
| AI Kurz | ||||||||||||
| </Dialog.Title> | ||||||||||||
|
||||||||||||
| </Dialog.Title> | |
| </Dialog.Title> | |
| <Dialog.Description className="sr-only"> | |
| Podívejte se na naše video o AI kurzu a přihlaste se | |
| </Dialog.Description> |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frameBorder attribute is deprecated in HTML5. Use the CSS border property instead or remove this attribute as modern browsers default to no border for iframes.
Replace frameBorder="0" with inline style or CSS class:
<iframe className='w-full aspect-video border-0' ... />| <iframe className='w-full aspect-video' src="https://www.youtube.com/embed/ZXB3XTZRtdk" title="Pozvánka na AI kurz" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen /> | |
| <iframe className='w-full aspect-video border-0' src="https://www.youtube.com/embed/ZXB3XTZRtdk" title="Pozvánka na AI kurz" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen /> |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <p> element should not contain an <iframe> as its child. According to HTML semantics, <p> elements should only contain phrasing content (inline elements), not embedded content like iframes.
Remove the <p> wrapper:
<div className="mt-4">
<iframe className='w-full aspect-video' src="https://www.youtube.com/embed/ZXB3XTZRtdk" title="Pozvánka na AI kurz" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen />
</div>| <p className="text-gray-600"> | |
| <iframe className='w-full aspect-video' src="https://www.youtube.com/embed/ZXB3XTZRtdk" title="Pozvánka na AI kurz" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen /> | |
| </p> | |
| <iframe className='w-full aspect-video' src="https://www.youtube.com/embed/ZXB3XTZRtdk" title="Pozvánka na AI kurz" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
useEffecthas multiple issues:setTimeout- can cause memory leaks and unexpected behaviorhandleClosein dependency array - can lead to stale closuresFix both issues:
Alternatively, wrap
handleClosewithuseCallbackand include it in the dependency array.