Jake Vanderwerf
2026-05-11 ac444cba221832c012c0435fdc8339fe9f37febb
inc/helpers/ui.php
@@ -20,18 +20,16 @@
    ?>
    <aside id="queue" class="left col start btw main" aria-expanded="false" >
        <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('arrows-clockwise', ['title'=> 'Check now']) ?>
                </button>
            </div>
        <div class="m-actions row start nowrap">
         <button class="refresh row" title="Check now">
            <?= jvbIcon('arrows-clockwise', ['title'=> 'Check now']) ?>
            <span class="countdown row indicator" title="Will refresh again...">5</span>
         </button>
            <div class="popup row"><span></span></div>
        </div>
      <div class="header col start">
         <h3>Queue Status</h3>
         <h2>Queue Status</h2>
         <nav class="filters">
            <?php
            $filters = [
@@ -49,7 +47,7 @@
               $active = ($i === 0) ? ' active': '';
               ?>
               <input type="radio" id="qfilter-<?=$filter?>" name="qfilter" class="btn filter<?=$active?>" data-filter="<?=$filter?>">
               <label for="qfilter-<?=$filter?>" data-count="0"><span class="count row"></span><?=$title?></label>
               <label for="qfilter-<?=$filter?>" data-count="0"><span class="count indicator row"></span><?=$title?></label>
               <?php
               $i++;
            }
@@ -57,14 +55,14 @@
            ?>
         </nav>
      </div>
      <div class="qitems col a-start nowrap">
      <div class="qitems item-grid col a-start nowrap">
      </div>
      <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" >
   <button class="qtoggle sticky" title="Show Queue" aria-controls="queue" >
      <?= jvbIcon('floppy-disk') ?>
      <span class="screen-reader-text"></span>
      <span class="indicator"></span>
@@ -101,7 +99,7 @@
      <button></button>
   </template>
   <template class="emptyQueue">
      <div class="empty-queue row">Everything is up to date.</div>
      <div class="empty queue row">Everything is up to date.</div>
   </template>
    <?php
}
@@ -377,12 +375,11 @@
      $active = ($i === 0) ? ' active' : '';
      $selected = ($i === 0) ? 'true' : 'false';
      $hidden = (array_key_exists('hidden', $config)) ? ' hidden' : '';
      $header .= '<button type="button" class="button tab'.$active.'" data-tab="'.$slug.'" role="tab" aria-selected="'.$selected.'"'.$hidden.'>
         <h2 class="row">';
      $header .= '<button type="button" class="button tab'.$active.'" data-tab="'.$slug.'" role="tab" aria-selected="'.$selected.'"'.$hidden.'>';
         if (array_key_exists('icon', $config)) {
            $header .= jvbIcon($config['icon']);
         }
         $header .= $config['title'].'</h2>
         $header .= $config['title'].'
      </button>';
      //Content
@@ -391,8 +388,12 @@
      if ($i !== 0) {
         $content .= ' hidden';
      }
      $content .= '>
         <h2>'.$config['title'].'</h2>';
      $content .= '>';
      if (array_key_exists('header', $config)) {
         $content .= $config['header'];
      } else {
         $content .= '<h2>'.$config['title'].'</h2>';
         if ( array_key_exists('description', $config)) {
            if (!is_array($config['description'])) {
               $content .= jvb_filter_content( $config['description']);
@@ -406,6 +407,9 @@
            }
         }
      }
      $content .= $config['content'].'
      </div>';
@@ -468,3 +472,22 @@
         <p class="message">'.$message.'</p>
      </div>';
}
function jvbDarkModeToggle():string
{
   $checked = (is_user_logged_in() && current_user_can('prefers_dark_theme', true)) ? ' checked' : '';
   $title = ($checked == '') ? 'Toggle Dark Mode' : 'Toggle Light Mode';
   $showThemeSwitch = (bool)apply_filters('jvb_show_theme_switch', true);
   $themeSwitch = sprintf(
'<label title="%s" id="theme-switch" class="switch" for="theme-switcher">
         <input class="theme-switch row" id="theme-switcher" name="theme-switcher" type="checkbox"%s data-setting="theme" data-theme role="switch" name="dark-mode" aria-label="Toggle dark mode">
         <span class="slider">%s%s</span>
      </label>',
      $title,
      $checked,
      jvbIcon('sun-dim', ['title'=> 'Light Mode']),
      jvbIcon('moon', ['title'=>'Dark Mode'])
   );
   return ($showThemeSwitch) ? $themeSwitch : '';
}