AGPL-3.0-only, a source link in the app, and everything on dev since #5 #6

Merged
bvandeusen merged 214 commits from dev into main 2026-10-21 21:40:00 -04:00
2 changed files with 44 additions and 20 deletions
Showing only changes of commit 4a810df0a9 - Show all commits
@@ -287,13 +287,9 @@ private fun OverflowMenu(
}
DropdownMenu(expanded = open, onDismissRequest = close) {
if (note.trashed) {
MenuItem(R.string.editor_restore, close) { onAction(EditorAction.Restore) }
MenuItem(R.string.editor_delete_forever, close, onConfirmDelete)
TrashedNoteItems(close, onAction, onConfirmDelete)
} else {
MenuItem(
if (note.pinned) R.string.editor_unpin else R.string.editor_pin,
close,
) { onAction(EditorAction.SetPinned(!note.pinned)) }
PinItem(note, close, onAction)
if (owner) {
MenuItem(R.string.editor_labels, close) { onPicker(Picker.LABELS) }
}
@@ -301,10 +297,7 @@ private fun OverflowMenu(
if (owner && note.id != DRAFT_ID) {
MenuItem(R.string.editor_share, close, onShare)
}
MenuItem(
if (note.archived) R.string.editor_unarchive else R.string.editor_archive,
close,
) { onAction(EditorAction.SetArchived(!note.archived)) }
ArchiveItem(note, close, onAction)
if (owner) {
MenuItem(R.string.editor_trash, close) { onAction(EditorAction.Trash) }
}
@@ -313,6 +306,44 @@ private fun OverflowMenu(
}
}
// The rows a note's menu shares between the editor's overflow and the board's
// long-press menu: two ways to the same acts, worded the same way.
/** A trashed note's two ways out: back, or gone for good (which asks first). */
@Composable
internal fun TrashedNoteItems(
close: () -> Unit,
onAction: (EditorAction) -> Unit,
onConfirmDelete: () -> Unit,
) {
MenuItem(R.string.editor_restore, close) { onAction(EditorAction.Restore) }
MenuItem(R.string.editor_delete_forever, close, onConfirmDelete)
}
@Composable
internal fun PinItem(
note: Note,
close: () -> Unit,
onAction: (EditorAction) -> Unit,
) {
MenuItem(
if (note.pinned) R.string.editor_unpin else R.string.editor_pin,
close,
) { onAction(EditorAction.SetPinned(!note.pinned)) }
}
@Composable
internal fun ArchiveItem(
note: Note,
close: () -> Unit,
onAction: (EditorAction) -> Unit,
) {
MenuItem(
if (note.archived) R.string.editor_unarchive else R.string.editor_archive,
close,
) { onAction(EditorAction.SetArchived(!note.archived)) }
}
/**
* The note's labels, each removable.
*
@@ -224,17 +224,10 @@ private fun NoteMenu(
val owner = note.access == NoteAccess.OWNER
DropdownMenu(expanded = expanded && (owner || !note.trashed), onDismissRequest = onDismiss) {
if (note.trashed) {
MenuItem(R.string.editor_restore, onDismiss) { onAction(EditorAction.Restore) }
MenuItem(R.string.editor_delete_forever, onDismiss, onConfirmDelete)
TrashedNoteItems(onDismiss, onAction, onConfirmDelete)
} else {
MenuItem(
if (note.pinned) R.string.editor_unpin else R.string.editor_pin,
onDismiss,
) { onAction(EditorAction.SetPinned(!note.pinned)) }
MenuItem(
if (note.archived) R.string.editor_unarchive else R.string.editor_archive,
onDismiss,
) { onAction(EditorAction.SetArchived(!note.archived)) }
PinItem(note, onDismiss, onAction)
ArchiveItem(note, onDismiss, onAction)
if (owner) {
MenuItem(R.string.editor_trash, onDismiss) { onAction(EditorAction.Trash) }
}