From 2f90fc6d6471697ed3750ed3f1941e7c2607e06e Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 23 Jul 2024 18:00:37 +0300 Subject: New function: dashboard-test. * This function is meant to replace the current dashboard implementation, combined with a transient buffer. --- gnosis-dashboard.el | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el index 4569ac7..b664e6d 100644 --- a/gnosis-dashboard.el +++ b/gnosis-dashboard.el @@ -139,6 +139,48 @@ Optionally, use REMOVE-SPACES when using multiple months." (goto-char point) (end-of-line) (gnosis-dashboard-reviews-graph (gnosis-dashboard-month-reviews 9) 46))) + +;; TODO: Create a dashboard utilizing widgets +(defun gnosis-dashboard-test () + "Test function to create an editable field and a search button." + (interactive) + (let ((buffer-name "*Gnosis Dashboard*")) + (when (get-buffer buffer-name) + (kill-buffer buffer-name)) ;; Kill the existing buffer if it exists + (let ((buffer (get-buffer-create buffer-name))) + (with-current-buffer buffer + (widget-insert "\n" + (gnosis-center-string + (format "%s" (propertize "Gnosis Dashboard" 'face 'gnosis-dashboard-header-face)))) + (gnosis-insert-separator) + (widget-insert (gnosis-center-string (propertize "Stats:" 'face 'outline-3)) "\n") + (widget-insert (gnosis-center-string + (format "Reviewed today: %s | New: %s" + (propertize + (number-to-string (gnosis-get-date-total-notes)) + 'face + 'font-lock-variable-use-face) + (propertize + (number-to-string (gnosis-get-date-new-notes)) + 'face + 'font-lock-keyword-face)))) + (insert "\n") + (widget-insert (gnosis-center-string + (format "Daily Average: %s" + (propertize (number-to-string (gnosis-dashboard-output-average-rev)) + 'face 'font-lock-type-face)))) + (insert "\n") + (widget-insert (gnosis-center-string + (format "Due notes: %s" + (propertize + (number-to-string (length (gnosis-review-get-due-notes))) + 'face 'error)))) + (insert "\n\n") + (gnosis-dashboard-month-overview) + (use-local-map widget-keymap) + (widget-setup)) + (pop-to-buffer-same-window buffer)))) + (defun gnosis-dashboard-output-note (id) "Output contents for note with ID, formatted for gnosis dashboard." (cl-loop for item in (append (gnosis-select '[main options answer tags type] 'notes `(= id ,id) t) -- cgit v1.2.3