mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-17 18:21:26 +02:00
Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import type { DialogProps } from '../components/core/Dialog';
|
||||
import { showDialog } from '../lib/dialog';
|
||||
import type { PromptProps } from './Prompt';
|
||||
import { Prompt } from './Prompt';
|
||||
import {useDialog} from "./useDialog";
|
||||
|
||||
type Props = Pick<DialogProps, 'title' | 'description'> &
|
||||
Omit<PromptProps, 'onClose' | 'onCancel' | 'onResult'> & { id: string };
|
||||
|
||||
export function usePrompt() {
|
||||
const dialog = useDialog();
|
||||
return ({ id, title, description, ...props }: Props) =>
|
||||
new Promise((resolve: PromptProps['onResult']) => {
|
||||
dialog.show({
|
||||
showDialog({
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
|
||||
Reference in New Issue
Block a user