Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
41 changes: 22 additions & 19 deletions src/components/NoteSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function NoteSearch() {

const [activeTag, setActiveTag] = useState<string | null>(null)
const [tagActionMenuIndex, setTagActionMenuIndex] = useState(0)
const [tagMenuPos, setTagMenuPos] = useState({ x: 0, y: 0 })

if (!showNoteSearch) return null

Expand All @@ -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()) ||
Expand All @@ -40,10 +49,7 @@ export function NoteSearch() {

const allTags = new Set<string>()
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()

Expand Down Expand Up @@ -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}?`,
Expand All @@ -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)
Expand Down Expand Up @@ -214,9 +218,9 @@ export function NoteSearch() {
<div
className="tag-action-menu"
style={{
position: 'absolute',
top: 50,
left: 16,
position: 'fixed',
top: tagMenuPos.y,
left: tagMenuPos.x,
zIndex: 1000,
background: 'var(--bg-color)',
border: '1px solid var(--border-color)',
Expand Down Expand Up @@ -256,9 +260,8 @@ export function NoteSearch() {
e.stopPropagation()
const tag = activeTag
setActiveTag(null)
const notesToDelete = notes.filter((n) =>
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}?`,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -361,6 +363,7 @@ export function NoteSearch() {
e.stopPropagation()
setActiveTag(tag)
setTagActionMenuIndex(0)
setTagMenuPos({ x: e.clientX, y: e.clientY })
setShowNoteActionMenu(false)
}}
>
Expand Down
3 changes: 1 addition & 2 deletions src/components/RemindersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ export const RemindersPage: React.FC<RemindersPageProps> = ({
}
})

// 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
Expand Down
Loading