summaryrefslogtreecommitdiff
path: root/gnosis-dashboard.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-23 18:00:37 +0300
committerThanos Apollo <[email protected]>2024-07-23 18:36:16 +0300
commit2f90fc6d6471697ed3750ed3f1941e7c2607e06e (patch)
treedfe2d005e87d51a32b120f33d9b6e0185dbf9ae0 /gnosis-dashboard.el
parent383fef6289d74ad819976b4ba18ce820bcf71ce7 (diff)
New function: dashboard-test.
* This function is meant to replace the current dashboard implementation, combined with a transient buffer.
Diffstat (limited to 'gnosis-dashboard.el')
-rw-r--r--gnosis-dashboard.el42
1 files changed, 42 insertions, 0 deletions
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)