Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
## <small>1.1.6-0 (2025-03-08)</small>

- chore(#53): fixed issue #53 code block is not functioning ([1ae28db](https://github.com/Your-Ehsan/Treo/commit/1ae28db)), closes [#53](https://github.com/Your-Ehsan/Treo/issues/53)
- Create CODE_OF_CONDUCT.md ([e2e1fbe](https://github.com/Your-Ehsan/Treo/commit/e2e1fbe))
- Create FUNDING.yml ([7a9ade4](https://github.com/Your-Ehsan/Treo/commit/7a9ade4))
- Create LICENSE ([624c867](https://github.com/Your-Ehsan/Treo/commit/624c867))
- feat(#94): added delete functionality ([b1ce516](https://github.com/Your-Ehsan/Treo/commit/b1ce516)), closes [#94](https://github.com/Your-Ehsan/Treo/issues/94)
- feat(#95): pin to top feature implemented in clipboard ([33c8d10](https://github.com/Your-Ehsan/Treo/commit/33c8d10)), closes [#95](https://github.com/Your-Ehsan/Treo/issues/95)
- feat(#96): implmented the clear clipboard action in clipboard widget ([55f3650](https://github.com/Your-Ehsan/Treo/commit/55f3650)), closes [#96](https://github.com/Your-Ehsan/Treo/issues/96)
- fix(#51): disable commit message rule fixed ([5746bb0](https://github.com/Your-Ehsan/Treo/commit/5746bb0)), closes [#51](https://github.com/Your-Ehsan/Treo/issues/51)
- fix(#52): add favorite option in notes ([5b564c0](https://github.com/Your-Ehsan/Treo/commit/5b564c0)), closes [#52](https://github.com/Your-Ehsan/Treo/issues/52)
- fix(#64): make description optional while creating note ([ae11cc6](https://github.com/Your-Ehsan/Treo/commit/ae11cc6)), closes [#64](https://github.com/Your-Ehsan/Treo/issues/64)
- Update FUNDING.yml ([e8bf0c4](https://github.com/Your-Ehsan/Treo/commit/e8bf0c4))
- refactor: refactor the clipboard-operations file ([45c68a1](https://github.com/Your-Ehsan/Treo/commit/45c68a1))
- chore: implemented some coderrabbit suggestions ([091987b](https://github.com/Your-Ehsan/Treo/commit/091987b))
- chore(build): build errors resolved & pre-commit hook updated ([75c7b59](https://github.com/Your-Ehsan/Treo/commit/75c7b59))
- chore(deps-dev): bump @tailwindcss/postcss from 4.0.7 to 4.0.8 ([b39f396](https://github.com/Your-Ehsan/Treo/commit/b39f396))
- chore(deps-dev): bump @tailwindcss/postcss from 4.0.8 to 4.0.9 ([a48ec08](https://github.com/Your-Ehsan/Treo/commit/a48ec08))
- chore(deps-dev): bump @tanstack/router-devtools from 1.106.0 to 1.109.2 ([3ce69dc](https://github.com/Your-Ehsan/Treo/commit/3ce69dc))
- chore(deps-dev): bump @tanstack/router-plugin from 1.105.5 to 1.109.2 ([8fa5cb2](https://github.com/Your-Ehsan/Treo/commit/8fa5cb2))
- chore(deps-dev): bump @types/node from 22.13.4 to 22.13.5 ([c178fd9](https://github.com/Your-Ehsan/Treo/commit/c178fd9))
- chore(deps-dev): bump @types/node from 22.13.5 to 22.13.8 ([8a1099e](https://github.com/Your-Ehsan/Treo/commit/8a1099e))
- chore(deps-dev): bump drizzle-kit from 0.30.4 to 0.30.5 ([5166753](https://github.com/Your-Ehsan/Treo/commit/5166753))
- chore(deps-dev): bump electron from 34.2.0 to 34.3.0 ([5d16c4d](https://github.com/Your-Ehsan/Treo/commit/5d16c4d))
- chore(deps-dev): bump eslint from 9.20.1 to 9.21.0 ([5b81c22](https://github.com/Your-Ehsan/Treo/commit/5b81c22))
- chore(deps-dev): bump eslint-plugin-react-hooks from 5.1.0 to 5.2.0 ([25af9e9](https://github.com/Your-Ehsan/Treo/commit/25af9e9))
- chore(deps-dev): bump prettier from 3.5.1 to 3.5.2 ([358260a](https://github.com/Your-Ehsan/Treo/commit/358260a))
- chore(deps-dev): bump tailwindcss from 4.0.7 to 4.0.8 ([74470f8](https://github.com/Your-Ehsan/Treo/commit/74470f8))
- chore(deps-dev): bump tailwindcss from 4.0.8 to 4.0.9 ([af7674a](https://github.com/Your-Ehsan/Treo/commit/af7674a))
- chore(deps-dev): bump vite from 6.1.1 to 6.2.0 ([f6c31b4](https://github.com/Your-Ehsan/Treo/commit/f6c31b4))
- chore(deps): bump @hookform/resolvers from 4.1.0 to 4.1.1 ([e230987](https://github.com/Your-Ehsan/Treo/commit/e230987))
- chore(deps): bump @hookform/resolvers from 4.1.1 to 4.1.2 ([7c37564](https://github.com/Your-Ehsan/Treo/commit/7c37564))
- chore(deps): bump @tanstack/react-query from 5.66.7 to 5.66.8 ([8e20eca](https://github.com/Your-Ehsan/Treo/commit/8e20eca))
- chore(deps): bump @tanstack/react-query from 5.66.8 to 5.66.9 ([2f8125a](https://github.com/Your-Ehsan/Treo/commit/2f8125a))
- chore(deps): bump @tanstack/react-query from 5.66.9 to 5.66.11 ([d1dcb10](https://github.com/Your-Ehsan/Treo/commit/d1dcb10))
- chore(deps): bump @tanstack/react-router from 1.106.0 to 1.109.2 ([3a2be1a](https://github.com/Your-Ehsan/Treo/commit/3a2be1a))
- chore(deps): bump @tanstack/react-router from 1.109.2 to 1.111.3 ([7555757](https://github.com/Your-Ehsan/Treo/commit/7555757))
- chore(deps): bump @tanstack/react-router from 1.111.3 to 1.112.0 ([c490453](https://github.com/Your-Ehsan/Treo/commit/c490453))
- chore(deps): bump actions/labeler from 4 to 5 ([a0b0c89](https://github.com/Your-Ehsan/Treo/commit/a0b0c89))
- chore(deps): bump drizzle-orm from 0.39.3 to 0.40.0 ([08dfcda](https://github.com/Your-Ehsan/Treo/commit/08dfcda))
- chore(deps): bump lucide-react from 0.475.0 to 0.477.0 ([6582018](https://github.com/Your-Ehsan/Treo/commit/6582018))
- chore(deps): bump react-medium-image-zoom from 5.2.13 to 5.2.14 ([30528f1](https://github.com/Your-Ehsan/Treo/commit/30528f1))
- chore(deps): bump tailwind-merge from 3.0.1 to 3.0.2 ([908bc8c](https://github.com/Your-Ehsan/Treo/commit/908bc8c))
- chore(refactor): removed some useless code ([ce8ecdb](https://github.com/Your-Ehsan/Treo/commit/ce8ecdb))
- feat: add dependabot interval to weekly ([56c08f4](https://github.com/Your-Ehsan/Treo/commit/56c08f4))

## <small>1.1.5 (2025-02-20)</small>

- refactor(ui): all unnecessary ui removed ([ab3e3ec](https://github.com/Your-Ehsan/Treo/commit/ab3e3ec))
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "treo",
"version": "1.1.5",
"version": "1.1.6-0",
"description": "An Electron application with React and TypeScript",
"main": "./out/main/index.js",
"author": "your-ehsan",
Expand Down Expand Up @@ -38,6 +38,7 @@
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/utils": "^4.0.0",
"@hookform/resolvers": "^4.1.2",
"@radix-ui/react-alert-dialog": "^1.1.6",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-checkbox": "^1.1.3",
"@radix-ui/react-collapsible": "^1.1.2",
Expand All @@ -52,7 +53,7 @@
"@radix-ui/react-scroll-area": "^1.2.2",
"@radix-ui/react-select": "^2.1.5",
"@radix-ui/react-separator": "^1.1.1",
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-tabs": "^1.1.2",
"@radix-ui/react-toast": "^1.2.5",
Expand Down
32 changes: 31 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
updateNote
} from './utils/notes-operations'
import {
clearClipboard,
deleteClipboardEntry,
searchClipboard,
togglePinnedClipboardEntry
Expand Down Expand Up @@ -137,6 +138,7 @@ app.whenReady().then(() => {
ipcMain.handle('toggle-favorite-note', (_, values) => toggleFavoriteNote(values))
ipcMain.handle('toggle-pinned-clipboard-entry', (_, values) => togglePinnedClipboardEntry(values))
ipcMain.handle('delete-clipboard-entry', (_, values) => deleteClipboardEntry(values))
ipcMain.handle('clear-clipboard', clearClipboard)

let previousContent = clipboard.readText()
async function checkClipboard(): Promise<void> {
Expand Down
15 changes: 14 additions & 1 deletion src/main/utils/clipboard-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { and, between, desc, eq, like, sql } from 'drizzle-orm'
// Function to search clipboard entries with pagination
export async function searchClipboard({
searchTerm,
fromDate = Date.now() - 24 * 60 * 60 * 1000 * 7, // 7 days before
fromDate = Date.now() - 24 * 60 * 60 * 1000 * 30, // 30 days before
toDate = Date.now(),
limit = 10, // Default limit (page size)
page = 1 // Default page number
Expand Down Expand Up @@ -78,3 +78,16 @@ export async function togglePinnedClipboardEntry({
return { error }
}
}

export async function clearClipboard(): Promise<{
result?: string
error?: unknown
}> {
try {
await db.delete(clipboardSchema)
return { result: 'success' }
} catch (error) {
console.error(error)
return { error }
}
}
4 changes: 4 additions & 0 deletions src/preload/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ interface RendererAPI {
result?: string
error?: unknown
}>
clearClipboard: () => Promise<{
result?: string
error?: unknown
}>
}

// Extend the global Window interface to include the Electron API and custom API
Expand Down
3 changes: 2 additions & 1 deletion src/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const api = {
toggleFavoriteNote: (values): Promise<void> => ipcRenderer.invoke('toggle-favorite-note', values),
togglePinnedClipboardEntry: (values): Promise<void> =>
ipcRenderer.invoke('toggle-pinned-clipboard-entry', values),
deleteClipboardEntry: (id): Promise<void> => ipcRenderer.invoke('delete-clipboard-entry', id)
deleteClipboardEntry: (id): Promise<void> => ipcRenderer.invoke('delete-clipboard-entry', id),
clearClipboard: (): Promise<void> => ipcRenderer.invoke('clear-clipboard')
}
// Use `contextBridge` APIs to expose Electron APIs to
// renderer only if context isolation is enabled, otherwise
Expand Down
58 changes: 58 additions & 0 deletions src/renderer/src/components/modals/clear-clipboard-alert.tsx
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>
)
}
8 changes: 6 additions & 2 deletions src/renderer/src/components/modals/index.tsx
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 />
</>
)
}
Loading
Loading