CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 2s
CI & Build / Python lint (push) Successful in 2s
Android / Core and FFI clippy and tests (push) Skipped
Android / Kotlin + Rust (APK) (push) Skipped
Android / Build the server image (push) Skipped
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
CI & Build / Web typecheck and unit tests (push) Successful in 10s
CI & Build / Python tests (push) Successful in 13s
CI & Build / integration (push) Successful in 1m40s
CI & Build / Build & push image (push) Successful in 35s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Successful in 2m20s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 2m36s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 3m21s
Desktop (Tauri) / Update manifest (push) Successful in 3s
Milestone 546 "Bring the repo to the comment standard (rule 32) and compose defaults (rule 198)", step #6222 "Comment standard sweep: web client (frontend/)". Comments, docstrings and template notes across frontend/ now say what the code does and the non-obvious why as present-tense facts. Issue, task, note, milestone and family-idea references are gone, along with narration of what used to happen: the titles index's wiki-link origin and its once-per-session load (#5165), the card-controls overlap a phone showed (task 2697), the M7 and M10.9 labels, and the card unification behind the reminders lens (task 1913). Hazards stay as facts, among them LEAVE_MS matching the editor's leave duration, the Android client twin that must not be widened, and keeping leavers in flow in the multi-column masonry. 62 files, comments only: a comment-stripping diff of every changed file against HEAD is identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.1 KiB
TypeScript
80 lines
2.1 KiB
TypeScript
import { defineStore } from "pinia";
|
|
import { ref } from "vue";
|
|
|
|
interface ToastAction {
|
|
label: string;
|
|
run: () => void;
|
|
}
|
|
|
|
interface Toast {
|
|
id: number;
|
|
message: string;
|
|
action?: ToastAction;
|
|
}
|
|
|
|
// Cross-component UI signals that don't belong to any single view (e.g. a
|
|
// global shortcut in the app shell asking the board to act).
|
|
export const useUiStore = defineStore("ui", () => {
|
|
// Bumped to ask the board to open the compose modal; composeSeed is the initial
|
|
// body (a single char for type-to-compose, or "" for the + button / `c`).
|
|
const composeTick = ref(0);
|
|
const composeSeed = ref("");
|
|
function requestCompose(seed = "") {
|
|
composeSeed.value = seed;
|
|
composeTick.value++;
|
|
}
|
|
// The board publishes whether a card is keyboard-focused (browse mode), so the
|
|
// global handler knows NOT to type-to-compose while browsing cards.
|
|
const boardCardFocused = ref(false);
|
|
|
|
// Transient undo toast (e.g. after trash/archive).
|
|
const toast = ref<Toast | null>(null);
|
|
let toastTimer: ReturnType<typeof setTimeout> | undefined;
|
|
let toastSeq = 0;
|
|
|
|
function showToast(message: string, action?: ToastAction) {
|
|
toastSeq += 1;
|
|
const id = toastSeq;
|
|
toast.value = { id, message, action };
|
|
clearTimeout(toastTimer);
|
|
toastTimer = setTimeout(() => {
|
|
if (toast.value?.id === id) toast.value = null;
|
|
}, 5000);
|
|
}
|
|
|
|
function dismissToast() {
|
|
clearTimeout(toastTimer);
|
|
toast.value = null;
|
|
}
|
|
|
|
function runToastAction() {
|
|
const run = toast.value?.action?.run;
|
|
dismissToast();
|
|
run?.();
|
|
}
|
|
|
|
// The note whose Share dialog is open, or null. One dialog for the app,
|
|
// mounted by the shell, so the card and the editor open the same one.
|
|
const shareNoteId = ref<string | null>(null);
|
|
function openShare(id: string) {
|
|
shareNoteId.value = id;
|
|
}
|
|
function closeShare() {
|
|
shareNoteId.value = null;
|
|
}
|
|
|
|
return {
|
|
shareNoteId,
|
|
openShare,
|
|
closeShare,
|
|
composeTick,
|
|
composeSeed,
|
|
requestCompose,
|
|
boardCardFocused,
|
|
toast,
|
|
showToast,
|
|
dismissToast,
|
|
runToastAction,
|
|
};
|
|
});
|