diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71efbab..ca1a255 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,17 @@ jobs: MAIN_TAURI_VERSION=$(git show origin/main:src-tauri/tauri.conf.json | grep '"version"' | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g') CURR_TAURI_VERSION=$(grep '"version"' src-tauri/tauri.conf.json | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g') - if [ "$MAIN_VERSION" != "$CURR_VERSION" ] || [ "$MAIN_TAURI_VERSION" != "$CURR_TAURI_VERSION" ]; then - echo "Version bumped. Checking for New Features note..." + if [ "$MAIN_VERSION" != "$CURR_VERSION" ]; then + echo "package.json version bumped. Checking for New Features note..." if [ ! -f "notes/New Features in v${CURR_VERSION}.md" ]; then - echo "Error: Missing notes/New Features in v${CURR_VERSION}.md" + echo "Error: Missing notes/New Features in v${CURR_VERSION}.md for package.json version" + exit 1 + fi + fi + if [ "$MAIN_TAURI_VERSION" != "$CURR_TAURI_VERSION" ]; then + echo "tauri.conf.json version bumped. Checking for New Features note..." + if [ ! -f "notes/New Features in v${CURR_TAURI_VERSION}.md" ]; then + echo "Error: Missing notes/New Features in v${CURR_TAURI_VERSION}.md for tauri.conf.json version" exit 1 fi fi diff --git a/package-lock.json b/package-lock.json index de0df29..5aaa462 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,6 @@ "name": "papercache", "version": "0.5.2", "dependencies": { - "@codemirror/autocomplete": "^6.20.3", "@tauri-apps/api": "^2.11.1", "@tauri-apps/plugin-autostart": "^2.5.1", "@tauri-apps/plugin-dialog": "^2.7.1", diff --git a/package.json b/package.json index c17eb84..b86fc55 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ ] }, "dependencies": { - "@codemirror/autocomplete": "^6.20.3", "@tauri-apps/api": "^2.11.1", "@tauri-apps/plugin-autostart": "^2.5.1", "@tauri-apps/plugin-dialog": "^2.7.1", diff --git a/src/components/NoteSearch.tsx b/src/components/NoteSearch.tsx index a3656e4..a38b0f5 100644 --- a/src/components/NoteSearch.tsx +++ b/src/components/NoteSearch.tsx @@ -22,6 +22,7 @@ export function NoteSearch() { const [activeTag, setActiveTag] = useState(null) const [tagActionMenuIndex, setTagActionMenuIndex] = useState(0) + const [tagMenuPos, setTagMenuPos] = useState({ x: 0, y: 0 }) if (!showNoteSearch) return null @@ -31,6 +32,14 @@ export function NoteSearch() { return isAuto ? n.content.split('\n')[0].trim() || 'New Note' : fileName } + const getNoteTags = (n: Note): string[] => { + const matches = n.content.match(/![a-zA-Z0-9_-]+/g) + return matches || [] + } + + const tagMatch = (tag: string) => (n: Note) => + getNoteTags(n).some((t) => t.toLowerCase() === tag.toLowerCase()) + const filteredNotes = notes.filter( (n) => n.content.toLowerCase().includes(noteSearchQuery.toLowerCase()) || @@ -40,10 +49,7 @@ export function NoteSearch() { const allTags = new Set() notes.forEach((n) => { - const matches = n.content.match(/![a-zA-Z0-9_-]+/g) - if (matches) { - matches.forEach((m) => allTags.add(m.toLowerCase())) - } + getNoteTags(n).forEach((m) => allTags.add(m.toLowerCase())) }) const tagArray = Array.from(allTags).sort() @@ -71,11 +77,11 @@ export function NoteSearch() { e.preventDefault() const tag = activeTag setActiveTag(null) + if (!tag) return + const matchNotes = notes.filter(tagMatch(tag)) if (tagActionMenuIndex === 0) { const doDelete = async () => { - const notesToDelete = notes.filter((n) => - n.content.toLowerCase().includes(tag.toLowerCase()) - ) + const notesToDelete = matchNotes await window.electronAPI.setDialogOpen(true) const confirmed = await confirm( `Delete ${notesToDelete.length} notes containing tag ${tag}?`, @@ -101,9 +107,7 @@ export function NoteSearch() { doDelete() } else if (tagActionMenuIndex === 1) { const doExport = async () => { - const notesToExport = notes.filter((n) => - n.content.toLowerCase().includes(tag.toLowerCase()) - ) + const notesToExport = matchNotes const combinedContent = notesToExport .map((n) => { const title = getNoteTitle(n) @@ -214,9 +218,9 @@ export function NoteSearch() {
- n.content.toLowerCase().includes(tag.toLowerCase()) - ) + if (!tag) return + const notesToDelete = notes.filter(tagMatch(tag)) await window.electronAPI.setDialogOpen(true) const confirmed = await confirm( `Delete ${notesToDelete.length} notes containing tag ${tag}?`, @@ -305,9 +308,8 @@ export function NoteSearch() { e.stopPropagation() const tag = activeTag setActiveTag(null) - const notesToExport = notes.filter((n) => - n.content.toLowerCase().includes(tag.toLowerCase()) - ) + if (!tag) return + const notesToExport = notes.filter(tagMatch(tag)) const combinedContent = notesToExport .map((n) => { const title = getNoteTitle(n) @@ -361,6 +363,7 @@ export function NoteSearch() { e.stopPropagation() setActiveTag(tag) setTagActionMenuIndex(0) + setTagMenuPos({ x: e.clientX, y: e.clientY }) setShowNoteActionMenu(false) }} > diff --git a/src/components/RemindersPage.tsx b/src/components/RemindersPage.tsx index d3371c8..8d63db2 100644 --- a/src/components/RemindersPage.tsx +++ b/src/components/RemindersPage.tsx @@ -56,9 +56,8 @@ export const RemindersPage: React.FC = ({ } }) - // Sort: Overdue first, then soonest, then no target, then done + // Sort: Overdue first, then soonest, then no target reminders.sort((a, b) => { - if (a.done !== b.done) return a.done ? 1 : -1 if (a.targetMs && b.targetMs) return a.targetMs - b.targetMs if (a.targetMs) return -1 if (b.targetMs) return 1