Skip to content
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

feat(component): new hook to open confirm modal #6342

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

CatsJuice
Copy link
Member

@CatsJuice CatsJuice commented Mar 27, 2024

new exports from @affine/component:

import { ConfirmModalProvider, useConfirmModal } from "@affine/component"

Open confirm modal with hook:

const Component = () => {
  const { openConfirmModal } = useConformModal();
    
  const open = () => {
    openConfirmModal({
      // props of ConfirmModal
      /**
       * will show loading state when confirm clicked, and close after onConfirm finished
       */
      onConfirm: async () => {
        await new Promise((r) => setTimeout(r, 2000));
      },
    });
  }
  return <Button onClick={open}>Open</Button>
}

Copy link

graphite-app bot commented Mar 27, 2024

Your org has enabled the Graphite merge queue for merging into canary

You must have a Graphite account in order to use the merge queue. Sign up using this link.

You can enable merging using labels in your Graphite merge queue settings.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @CatsJuice and the rest of your teammates on Graphite Graphite

Copy link

nx-cloud bot commented Mar 27, 2024

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 62.41%. Comparing base (39facba) to head (d412635).

Files Patch % Lines
.../frontend/component/src/ui/modal/confirm-modal.tsx 12.50% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           canary    #6342      +/-   ##
==========================================
- Coverage   62.54%   62.41%   -0.14%     
==========================================
  Files         510      510              
  Lines       23602    23626      +24     
  Branches     2225     2226       +1     
==========================================
- Hits        14762    14746      -16     
- Misses       8578     8618      +40     
  Partials      262      262              
Flag Coverage Δ
server-test 73.91% <ø> (-0.12%) ⬇️
unittest 38.76% <12.50%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@CatsJuice CatsJuice marked this pull request as ready for review March 27, 2024 09:14
Copy link

graphite-app bot commented Mar 27, 2024

Merge activity

new exports from `@affine/component`:
```ts
import { ConfirmModalProvider, useConfirmModal } from "@affine/component"
```

Open confirm modal with hook:

```ts
const Component = () => {
  const { openConfirmModal } = useConformModal();

  const open = () => {
    openConfirmModal({
      // props of ConfirmModal
      /**
       * will show loading state when confirm clicked, and close after onConfirm finished
       */
      onConfirm: async () => {
        await new Promise((r) => setTimeout(r, 2000));
      },
    });
  }
  return <Button onClick={open}>Open</Button>
}
```
@EYHN EYHN force-pushed the catsjuice/feat/show-confirm-modal-with-hook branch from a03b750 to d412635 Compare March 27, 2024 13:30
@graphite-app graphite-app bot merged commit d412635 into canary Mar 27, 2024
36 of 40 checks passed
@graphite-app graphite-app bot deleted the catsjuice/feat/show-confirm-modal-with-hook branch March 27, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants