Jake Vanderwerf
2025-10-20 e729f920139f0c65902be2d6b2c32466b08375e8
inc/helpers/ui.php
@@ -1,5 +1,7 @@
<?php
use JVBase\utility\Features;
if (!defined('ABSPATH')) {
   exit;
}
@@ -9,11 +11,12 @@
function jvbClientQueue():void
{
    if (!jvbSiteHasDashboard() || !is_user_logged_in()) {
    if (!Features::forSite()->has('dashboard') || !is_user_logged_in()) {
        return;
    }
    ?>
    <aside id="queue" class="col start btw" aria-expanded="false" hidden>
    <aside id="queue" class="left col start btw" 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>
@@ -60,6 +63,7 @@
    </aside>
   <button class="qtoggle row" title="Show Queue" aria-controls="queue" hidden>
      <?= jvbIcon('save') ?>
      <span class="screen-reader-text"></span>
      <span class="indicator"></span>
      <span class="count row"></span>
   </button>
@@ -106,7 +110,7 @@
        ob_start();
        ?>
        <li>
            <a href="<?=get_home_url(2, '/dash/')?>" title="Behind the Scenes">
            <a href="<?=get_home_url(null, '/dash/')?>" title="Behind the Scenes">
                <?= jvbIcon('dashboard', ['title' => 'Behind the Scenes'])?>
                <span class="screen-reader-text">Go Behind the Scenes</span>
            </a>
@@ -119,7 +123,7 @@
                </span>
            </button>
            <ul class="notifications-preview submenu">
                <li id="view-all"><a href="<?=get_home_url(2, '/dash/notifications/')?>" class="view-all">View All Notifications</a></li>
                <li id="view-all"><a href="<?=get_home_url(null, '/dash/notifications/')?>" class="view-all">View All Notifications</a></li>
            </ul>
            <template class="notificationItem">
                <li class="notification-preview">
@@ -168,7 +172,7 @@
                'fields'    => 'ids'
            ));
            if ($page->have_posts()) {
                $end = ($t == 'About') ? '<li><a href="'.get_home_url(2, '/directory/partners/').'" title="View our Partners">Partners</a></li>' : '';
                $end = ($t == 'About') ? '<li><a href="'.get_home_url(null, '/directory/partners/').'" title="View our Partners">Partners</a></li>' : '';
                $links .= $open.get_the_permalink($page->posts[0]).'" title="'.$t.$mid.$t.$close.$end;
            }
            wp_reset_postdata();
@@ -324,6 +328,7 @@
    return ob_get_clean();
}
add_action('wp_footer', 'jvbLoadingScreen');
function jvbLoadingScreen():string
{
   return '<dialog class="loading">
@@ -364,6 +369,7 @@
   $header = '<nav class="tabs row start" role="tablist">';
   $content = '';
   $i = 0;
   foreach ($tabs as $slug => $config) {
      //Header
      $active = ($i === 0) ? ' active' : '';
@@ -386,7 +392,17 @@
      $content .= '>
         <h2>'.$config['title'].'</h2>';
         if ( $config['description']) {
            $content .= apply_filters('the_content', $config['description']);
            if (!is_array($config['description'])) {
               $content .= apply_filters('the_content', $config['description']);
            } else {
//             foreach ($config['description'] as $desc) {
//                $content .= apply_filters('the_content', $desc);
//             }
               $content .= implode('',array_map(function ($paragraph) {
                  return apply_filters('the_content', $paragraph);
               }, $config['description']));
            }
         }
      $content .= $config['content'].'
@@ -403,10 +419,11 @@
   return $out;
}
function jvbRenderProgressBar(string $inside ='')
function jvbRenderProgressBar(string $inside ='', $top = false)
{
   $top = $top ? ' abs top' : '';
   ?>
   <div class="progress">
   <div class="progress<?=$top?>">
      <div class="bar">
         <div class="fill"></div>
      </div>
@@ -417,3 +434,23 @@
   <?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('close').'
               <span>Dismiss</span>
            </button>
         </div>
      </div>
      <div class="fstatus row" hidden>
         <div class="spinner"></div>
         <p class="message">'.$message.'</p>
      </div>';
}