-
Notifications
You must be signed in to change notification settings - Fork 1
#96 feat implemented #98
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
55f3650
feat(#96): implmented the clear clipboard action in clipboard widget
developerEhsan e84b976
Merge branch 'master' into development
developerEhsan ba2a754
1.1.6-0
developerEhsan a500e2e
Update src/renderer/src/components/modals/clear-clipboard-alert.tsx
developerEhsan 6058522
chore(ui): changed description & title and clear-clipboard-alert
developerEhsan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/renderer/src/components/modals/clear-clipboard-alert.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { mutationKeys } from '@renderer/constants/mutation-keys' | ||
| import { useMutation, useQueryClient } from '@tanstack/react-query' | ||
| import React from 'react' | ||
| import { | ||
| AlertDialog, | ||
| AlertDialogAction, | ||
| AlertDialogCancel, | ||
| AlertDialogContent, | ||
| AlertDialogDescription, | ||
| AlertDialogFooter, | ||
| AlertDialogHeader, | ||
| AlertDialogTitle | ||
| } from '../ui/alert-dialog' | ||
| import { modalStore } from '@renderer/store/modal-store' | ||
| import { queryKeys } from '@renderer/constants/query-keys' | ||
| import { toast } from '@renderer/hooks/use-toast' | ||
| import { copyWidgetStore } from '@renderer/store/copy-widget-store' | ||
|
|
||
| export function ClearClipboardAlert(): React.JSX.Element { | ||
| const { activeModal, closeModal } = modalStore() | ||
| const { searchQuery } = copyWidgetStore() | ||
| const queryClient = useQueryClient() | ||
| const { mutate } = useMutation({ | ||
| mutationKey: [mutationKeys['clear-clipboard']], | ||
| mutationFn: () => window.api.clearClipboard(), | ||
| onError(error) { | ||
| toast({ | ||
| title: 'Failed to Clear Clipboard ❌ ', | ||
| description: error.message, | ||
| variant: 'destructive' | ||
| }) | ||
| }, | ||
| onSettled() { | ||
| queryClient.invalidateQueries({ queryKey: [queryKeys['clipboard-data'], searchQuery] }) | ||
| toast({ | ||
| title: 'Clipboard successfully Cleared' | ||
| }) | ||
| } | ||
| }) | ||
|
|
||
| return ( | ||
| <AlertDialog open={activeModal === 'clear-clipboard-dialog'} onOpenChange={() => closeModal()}> | ||
| <AlertDialogContent> | ||
| <AlertDialogHeader> | ||
| <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle> | ||
| <AlertDialogDescription> | ||
| This action cannot be undone. This will permanently delete your account and remove your | ||
| data from our servers. | ||
| </AlertDialogDescription> | ||
| </AlertDialogHeader> | ||
| <AlertDialogFooter> | ||
| <AlertDialogCancel>Cancel</AlertDialogCancel> | ||
| <AlertDialogAction onClick={() => mutate()}>Continue</AlertDialogAction> | ||
| </AlertDialogFooter> | ||
| </AlertDialogContent> | ||
| </AlertDialog> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| import React from 'react' | ||
| import { CreateNoteModal } from './create-note-modal' | ||
| import { ClearClipboardAlert } from './clear-clipboard-alert' | ||
|
|
||
| export function ModalsProvider(): React.JSX.Element { | ||
| return <CreateNoteModal /> | ||
| return ( | ||
| <> | ||
| <ClearClipboardAlert /> | ||
| </> | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.