add toast for selections we don't recognise (#6370)

* ad toast for selections we don't recognise

* remove log
This commit is contained in:
Kurt Hutten
2025-04-17 21:32:13 +10:00
committed by GitHub
parent 938a2bae13
commit 0f1cff316c
3 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,49 @@
import toast from 'react-hot-toast'
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
export function ToastUnsupportedSelection({
toastId,
}: {
toastId: string
}) {
const githubIssueUrl = 'https://github.com/KittyCAD/modeling-app/issues/6368'
return (
<div className="inset-0 z-50 grid place-content-center rounded bg-chalkboard-10 dark:bg-chalkboard-90 shadow-md p-3">
<section>
<p className="text-sm text-chalkboard-70 dark:text-chalkboard-30">
Some faces and edges are not currently selectable.{' '}
<a
href={githubIssueUrl}
onClick={openExternalBrowserIfDesktop(githubIssueUrl)}
className="underline"
>
The team is working on it
</a>
.
</p>
</section>
</div>
)
}
/**
* Show a toast notification for when users try to select unsupported faces/edges
* @example
* // In your component or handler:
* import { showUnsupportedSelectionToast } from '@src/components/ToastUnsupportedSelection'
*
* // When user tries to select an unsupported face/edge
* showUnsupportedSelectionToast()
*/
export function showUnsupportedSelectionToast() {
const toastId = toast.custom(
(t) => <ToastUnsupportedSelection toastId={t.id} />,
{
duration: 4_000,
}
)
return toastId
}