From 0e4b986e81f8132a44e61fa8df18860301cc3468 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 01 Jan 2026 20:31:10 +0000
Subject: [PATCH] =JakeVan preliminary additions

---
 inc/helpers/ui.php |   94 ++++++++++++++++++++++++++++++----------------
 1 files changed, 61 insertions(+), 33 deletions(-)

diff --git a/inc/helpers/ui.php b/inc/helpers/ui.php
index 1831a33..bbd289a 100644
--- a/inc/helpers/ui.php
+++ b/inc/helpers/ui.php
@@ -1,6 +1,7 @@
 <?php
 
 use JVBase\utility\Features;
+use JVBase\utility\Image;
 
 if (!defined('ABSPATH')) {
 	exit;
@@ -16,12 +17,12 @@
     }
 
     ?>
-    <aside id="queue" class="left col start btw" aria-expanded="false" hidden>
+    <aside id="queue" class="left col start btw main" aria-expanded="false" hidden>
         <div class="status-actions row start nowrap">
 			<div class="refresh row btw">
                 <span class="countdown row" title="Will refresh again...">5</span>
                 <button class="refreshNow row" title="Check now">
-                    <?= jvbIcon('refresh', ['title'=> 'Check now']) ?>
+                    <?= jvbIcon('arrows-clockwise', ['title'=> 'Check now']) ?>
                 </button>
             </div>
             <div class="popup row"><span></span></div>
@@ -53,16 +54,15 @@
 				?>
 			</nav>
 		</div>
-		<div class="qitems col">
-			<!-- Operations will be listed here -->
+		<div class="qitems col a-start nowrap">
 		</div>
-		<div class="queue-actions row btw">
+		<div class="queue-actions row btw nowrap">
 			<button class="dismiss-all">Clear Completed</button>
 			<button class="retry-all">Retry Failed</button>
 		</div>
     </aside>
 	<button class="qtoggle row" title="Show Queue" aria-controls="queue" hidden>
-		<?= jvbIcon('save') ?>
+		<?= jvbIcon('floppy-disk') ?>
 		<span class="screen-reader-text"></span>
 		<span class="indicator"></span>
 		<span class="count row"></span>
@@ -111,7 +111,7 @@
         ?>
         <li>
             <a href="<?=get_home_url(null, '/dash/')?>" title="Behind the Scenes">
-                <?= jvbIcon('dashboard', ['title' => 'Behind the Scenes'])?>
+                <?= jvbIcon('door', ['title' => 'Behind the Scenes'])?>
                 <span class="screen-reader-text">Go Behind the Scenes</span>
             </a>
         </li>
@@ -152,7 +152,11 @@
  */
 function jvbHelpMenu():string
 {
+	if (!Features::forSite()->has('helpMenu')) {
+		return '';
+	}
     $out = get_option(BASE.'help_menu');
+
     if ($out === false) {
         $open = '<li><a href="';
         $mid = '">';
@@ -179,7 +183,7 @@
         }
 
         $out = '<li class="has-submenu">
-                <button class="toggle quick-help" type="button" title="Toggle Quick Help Menu" aria-expanded="false" aria-controls="quick-help" aria-label="Toggle Quick Help Menu">'.jvbIcon('help', ['title'=> 'Quick Help']).'</button>
+                <button class="toggle quick-help" type="button" title="Toggle Quick Help Menu" aria-expanded="false" aria-controls="quick-help" aria-label="Toggle Quick Help Menu">'.jvbIcon('question', ['title'=> 'Quick Help']).'</button>
                 <ul class="submenu">
                     '.$links.'
                 </ul>
@@ -189,9 +193,9 @@
     }
 
     if (is_user_logged_in()) {
-        $out .= '<li><a href="'.wp_logout_url(get_home_url()).'" title="Logout">'.jvbIcon('logout').'<span class="screen-reader-text">Logout</span></a></li>';
+        $out .= '<li><a href="'.wp_logout_url(get_home_url()).'" title="Logout">'.jvbIcon('sign-out').'<span class="screen-reader-text">Logout</span></a></li>';
     } else {
-        $out .= '<li><a href="'.wp_login_url(null, true).'" title="Login">'.jvbIcon('login').'<span class="screen-reader-text">Login</span></a></li>';
+        $out .= '<li><a href="'.wp_login_url(null, true).'" title="Login">'.jvbIcon('sign-in').'<span class="screen-reader-text">Login</span></a></li>';
     }
     return $out;
 }
@@ -212,7 +216,7 @@
     aria-label="Clear search"
     onclick="this.previousElementSibling.value = \'\'; this.previousElementSibling.focus();"
   >'.jvbIcon('x', ['title'=> 'Clear Search']).'</button>
-  <button type="button" title="Search" class="toggle search" aria-label="Toggles search input visually" onclick="this.parentNode.classList.toggle(\'open\');this.previousElementSibling.previousElementSibling.focus();">'.jvbIcon('search').'</button>
+  <button type="button" title="Search" class="toggle search" aria-label="Toggles search input visually" onclick="this.parentNode.classList.toggle(\'open\');this.previousElementSibling.previousElementSibling.focus();">'.jvbIcon('magnifying-glass').'</button>
 </div>';
 }
 
@@ -221,8 +225,8 @@
 function jvbModalActions()
 {
     return '<div class="m-actions row">
-        <button type="button" class="cancel">'.jvbIcon('close').'<span class="screen-reader-text">Cancel</span></button>
-        <button type="submit" class="save">'.jvbIcon('save').'<span class="screen-reader-text">Save</span></button>
+        <button type="button" class="cancel">'.jvbIcon('x').'<span class="screen-reader-text">Cancel</span></button>
+        <button type="submit" class="save">'.jvbIcon('floppy-disk').'<span class="screen-reader-text">Save</span></button>
     </div>';
 }
 
@@ -244,19 +248,17 @@
  *
  * @return string
  */
-function jvbFormatImage(int|string $imgID, string $start = 'tiny', string $end = 'large'):string
+function jvbFormatImage(int $imgID, string $start = 'tiny', string $end = 'large', bool $addLink = true, ?string $postSlug = null):string
 {
-    $block = new \JVBase\blocks\CustomBlocks();
-    if ($imgID === '' || $imgID === 0) {
-        $imgID = $block->imageID($imgID);
-    }
-    if ($imgID === '' || $imgID === 0 || $imgID === false) {
-        return '';
-    }
+    $image = new Image();
+    return $image->formatImage($imgID, $start, $end, $addLink, $postSlug);
+}
 
-	$imgID = (int)$imgID;
-
-    return $block->formatImage($imgID, $start, $end);
+function jvbImageCaption(int $imgID, string $start = 'tiny', string $end = 'large', bool $addLink = true, ?string $postSlug = null):string
+{
+	$caption = wp_get_attachment_caption($imgID);
+	$caption = ($caption && $caption !== '') ? '<figcaption>'.apply_filters('the_content', $caption).'</figcaption>' : '';
+	return '<figure>'.jvbFormatImage($imgID, $start, $end, $addLink, $postSlug).$caption.'</figure>';
 }
 
 /**
@@ -264,8 +266,6 @@
  * @return void
  */
 add_action('wp_footer', 'jvbToastContainer');
-
-
 function jvbToastContainer():void
 {
     ?>
@@ -277,7 +277,7 @@
             <div class="toast-content row btw">
                 <p></p>
                 <button type="button" class="close-toast" aria-label="Close">
-                    <?= jvbIcon('close') ?>
+                    <?= jvbIcon('x') ?>
                 </button>
             </div>
         </div>
@@ -303,13 +303,13 @@
     <nav id="<?=$id?>" class="on-this-page index">
         <label>Jump to:
             <button type="button" aria-label="Show Index" title="Show Index" class="toggle" aria-expanded="false">
-                <?= jvbIcon('add') ?>
+                <?= jvbIcon('plus-square') ?>
             </button>
         </label>
         <ul>
             <li>
                 <a href="#top" title="Back to Top">
-                    <?= jvbIcon('up') ?>
+                    <?= jvbIcon('caret-circle-up') ?>
                 </a>
             </li>
             <?php
@@ -331,11 +331,12 @@
 add_action('wp_footer', 'jvbLoadingScreen');
 function jvbLoadingScreen():string
 {
+	$icon = apply_filters('jvbLoadingIcon', 'drop-simple');
 	return '<dialog class="loading">
 		<div class="col">
 			<div class="spinner"></div>
 			<div class="status col">
-				<div class="icon">'.apply_filters('jvbLoadingIcon', jvbIcon('tattoo')).'</div>
+				<div class="icon">'.jvbIcon($icon).'</div>
 				<h3>Loading</h3>
 				<p class="typeText">Please wait...</p>
 			</div>
@@ -371,6 +372,10 @@
 	$i = 0;
 
 	foreach ($tabs as $slug => $config) {
+		if (!array_key_exists('content', $config) || empty($config['content'])) {
+			error_log('No content for tab: '.$slug);
+			continue;
+		}
 		//Header
 		$active = ($i === 0) ? ' active' : '';
 		$selected = ($i === 0) ? 'true' : 'false';
@@ -391,7 +396,7 @@
 		}
 		$content .= '>
 			<h2>'.$config['title'].'</h2>';
-			if ( $config['description']) {
+			if ( array_key_exists('description', $config)) {
 				if (!is_array($config['description'])) {
 					$content .= apply_filters('the_content', $config['description']);
 				} else {
@@ -427,10 +432,33 @@
 		<div class="bar">
 			<div class="fill"></div>
 		</div>
-		<div class="details row btw">
-			<?=$inside?>
+		<div class="row btw">
+			<i class="icon"></i>
+			<div class="details">
+				<?=$inside?>
+			</div>
 		</div>
 	</div>
 	<?php
 }
 
+function jvbFormStatus(string $message = '') {
+	return '<div class="restore-form col" hidden>
+			<h3>Looks like we left things hanging...</h3>
+			<p>We\'ve filled in the fields with what you put last time.</p>
+			<div class="actions">
+				<button type="button" data-action="clear-form">
+					'.jvbIcon('arrows-clockwise').'
+					<span>Start Over</span>
+				</button>
+				<button type="button" data-action="dismiss-restore">
+					'.jvbIcon('x').'
+					<span>Dismiss</span>
+				</button>
+			</div>
+		</div>
+		<div class="fstatus row" hidden>
+			<div class="spinner"></div>
+			<p class="message">'.$message.'</p>
+		</div>';
+}

--
Gitblit v1.10.0