From 765073354cf2c1022bd4ebff912d53f0b047970a Mon Sep 17 00:00:00 2001
From: Adam Piontek <adam@73k.us>
Date: Tue, 3 Aug 2021 20:04:38 -0400
Subject: [PATCH] front page progress

---
 assets/css/_layout-top-navbar-main.scss |  5 +++
 assets/css/_meetings-plugin.scss        | 15 ++++++--
 assets/css/app.scss                     | 50 ++++++++++++++++++++++++-
 assets/js/main.js                       |  9 ++---
 footer.php                              | 43 ---------------------
 front-page.php                          | 25 ++++---------
 functions.php                           | 12 ++++--
 src/setup.php                           |  1 -
 src/sidebars.php                        |  6 +--
 webpack.config.js                       | 12 +-----
 10 files changed, 92 insertions(+), 86 deletions(-)

diff --git a/assets/css/_layout-top-navbar-main.scss b/assets/css/_layout-top-navbar-main.scss
index 17a71f2..2684343 100644
--- a/assets/css/_layout-top-navbar-main.scss
+++ b/assets/css/_layout-top-navbar-main.scss
@@ -21,6 +21,11 @@
     max-width: 960px;
   }
 }
+.container-xl:not(.container-lg) {
+  // @include media-breakpoint-up(xl) {
+    max-width: 1140px !important;
+  // }
+}
 
 /*
  * top navbar css grid layout
diff --git a/assets/css/_meetings-plugin.scss b/assets/css/_meetings-plugin.scss
index afacb77..918736b 100644
--- a/assets/css/_meetings-plugin.scss
+++ b/assets/css/_meetings-plugin.scss
@@ -1,3 +1,4 @@
+/* 12 step meeting list (tsml) general & filter controls */
 #tsml {
   a {
     @extend a;
@@ -80,8 +81,16 @@
 
 }
 
-// for some reason this needs to be outside of the above styling
-#tsml #meetings .results table {
+/* 12 step meeting list (tsml) main table & widget table styling */
+.tsml-widget-upcoming table.tsml_next_meetings tbody tr td {
+  margin-left: .5rem;
+  &:first-of-type {
+    margin-left: 0 !important;
+  }
+}
+.tsml-widget-upcoming h2 { margin-bottom: 1rem; }
+#tsml #meetings .results table,
+.tsml-widget-upcoming table.tsml_next_meetings {
   @extend .table;
   @extend .table-dark;
   @extend .table-striped;
@@ -105,7 +114,7 @@
     }
   }
 }
-      
+
 #tsml .results {
   .alert-warning {
     background-color: #f5e2a7;
diff --git a/assets/css/app.scss b/assets/css/app.scss
index e89d89c..3483fdf 100644
--- a/assets/css/app.scss
+++ b/assets/css/app.scss
@@ -31,7 +31,8 @@ a {
 
 
 /* post styling */
-article.post.sticky {
+article.post.sticky,
+.rpwwt-widget li.rpwwt-sticky {
   border-radius: .25rem !important;
   background-color: shade-color($gray-800, 50%);
   border-bottom: inherit !important;
@@ -258,3 +259,50 @@ select {
 
 /* Meetings plugin styling changes */
 @import "meetings-plugin";
+
+
+/* Front page layout */
+main#fp-main > div.fp-grid {
+  display: grid !important;
+  grid-template-columns: 1fr;
+  grid-column-gap: 2rem;
+  grid-row-gap: 2rem;
+  @include media-breakpoint-up(md) {
+    grid-template-columns: 20rem auto;
+  }
+  > section.tsml-widget-upcoming.widget_tsml_widget_upcoming.widget {
+    @include media-breakpoint-up(md) {
+      grid-column-start: 1;
+      grid-row-start: 1;
+    }
+  }
+  h2.widgettitle {
+    font-size: 1.75rem;
+    font-weight: 300 !important;
+    color: $text-muted;
+    margin-bottom: 0.5rem;
+    @include media-breakpoint-up(sm) {
+      margin-bottom: 1rem;
+    }
+  }
+  .rpwwt-widget {
+    li.rpwwt-sticky {
+      padding: 0.75rem !important;
+    }
+    .rpwwt-post-title {
+      font-size: 1.4rem;
+    }
+    .rpwwt-post-date {
+      color: $text-muted;
+      font-size: smaller;
+    }
+  }
+  .tsml-widget-upcoming.widget_tsml_widget_upcoming.widget p {
+    text-align: right;
+    a {
+      @extend .btn;
+      @extend .btn-primary;
+      font-family: $font-family-handbrush;
+    }
+  }
+}
\ No newline at end of file
diff --git a/assets/js/main.js b/assets/js/main.js
index fe399cb..9abbfdf 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -18,9 +18,8 @@ import 'bootstrap/js/dist/dropdown';
 // import navbar burger code
 import "./_hamburger-helper";
 
-// highlight any code blocks tagged with class 'to-highlight'
+// adjust some content
 document.addEventListener('DOMContentLoaded', (event) => {
-  document.querySelectorAll('code.to-highlight').forEach((el) => {
-    hljs.highlightElement(el);
-  });
-});
\ No newline at end of file
+  let tsmlwidget_morelink = document.querySelector('.tsml-widget-upcoming.widget_tsml_widget_upcoming.widget p a');
+  tsmlwidget_morelink.innerHTML = 'View More Meetings'
+});
diff --git a/footer.php b/footer.php
index a845aab..142dabb 100644
--- a/footer.php
+++ b/footer.php
@@ -13,55 +13,12 @@ namespace WP_RDNYC;
 
 ?>
 
-  <?php
-    // FIRST: if this is frontpage, we just do the sticky bottom right copyright footer
-    if ($args && $args['frontpage']) {
-  ?>
-    
-    <footer class="tek-fixed-footer">
-      <div class="px-2 px-sm-3 text-gray-400">
-        &copy; <?php echo date("Y") ?> Recovery Dharma NYC
-      </div>
-    </footer>
-
-  <?php } else {
-    // Not frontpage? Then show regular footer
-  ?>
-
     <footer class="d-flex flex-column align-items-center mt-2 px-3 py-3">
 
-      <?php
-        // // widget content for blog content footers:
-        // if (!is_page()) :
-      ?>
-
-      <!-- <div id="footer-widgets" class="col-12 col-sm-9 col-md-11 col-lg-10 col-xl-9 col-xxl-8 d-flex flex-column align-items-center">
-        <div class="px-3 pt-3 pb-1">
-          < ?php echo get_search_form(); ?>
-        </div>
-        <div class="d-flex flex-wrap flex-column flex-md-row justify-content-start justify-content-md-center align-items-start">
-
-          < ?php
-            if ( is_active_sidebar( 'footer-widgets' ) ) :
-              dynamic_sidebar( 'footer-widgets' );
-            endif;
-            ?>
-
-        </div>
-      </div> -->
-
-      <?php
-        // endif;
-        // Regular footer content for all but front page:
-        ?>
-
       <span class="text-gray-400 mt-3">&copy; <?php echo date("Y") ?> Recovery Dharma NYC</span>
 
-
     </footer>
 
-  <?php } ?>
-
   <?php wp_footer(); ?>
 
   </body>
diff --git a/front-page.php b/front-page.php
index 3ea9dd9..06d6ef5 100644
--- a/front-page.php
+++ b/front-page.php
@@ -9,28 +9,19 @@
 namespace WP_RDNYC;
 
 get_header(); ?>
-<main class="container-fluid">
-  <div class="d-flex flex-column-reverse flex-lg-row align-items-lg-end mt-sm-3 mt-md-4 pt-md-4 mt-lg-5 pt-lg-5 pb-5" id="tek-front-page">
 
-  <?php
-    if ( have_posts() ) {
-      while ( have_posts() ) {
-        the_post(); ?>
+<main id="fp-main" class="container-xl mt-4 mt-md-6 mt-lg-7 mb-3">
+  <div class="fp-grid">
 
-    <div class="col-auto mt-3 mt-lg-0">
-      <?php echo get_the_post_thumbnail( get_the_ID(), 'large' ); ?>
-    </div>
 
-    <!-- the_content(); -->
-    <div class="col-auto justify-content-start ms-lg-3">
-      <?php the_content(); ?>
-    </div>
+    <?php
+      if ( is_active_sidebar( 'front-page-widgets' ) ) :
+        dynamic_sidebar( 'front-page-widgets' );
+      endif;
+      ?>
 
-  <?php }
-      }
-    ?>
 
   </div>
 </main>
 <?php
-get_footer('', array('frontpage'=>true));
+get_footer();
diff --git a/functions.php b/functions.php
index a47c74b..da68097 100644
--- a/functions.php
+++ b/functions.php
@@ -17,6 +17,12 @@ require_once( WP_RDNYC_DIR . '/custom-functions.php' );
 /**
  * Autoloader for browersync
  */
-require_once( WP_RDNYC_DIR . '/vendor/autoload.php' );
-
-\A7\autoload( __DIR__ . '/src' );
+if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
+  require_once( WP_RDNYC_DIR . '/vendor/autoload.php' );
+  \A7\autoload( __DIR__ . '/src' );
+} else {
+  require_once( WP_RDNYC_DIR . '/src/classes.php' );
+  require_once( WP_RDNYC_DIR . '/src/enqueue.php' );
+  require_once( WP_RDNYC_DIR . '/src/setup.php' );
+  require_once( WP_RDNYC_DIR . '/src/sidebars.php' );
+}
diff --git a/src/setup.php b/src/setup.php
index ea41653..fcff6a9 100644
--- a/src/setup.php
+++ b/src/setup.php
@@ -22,7 +22,6 @@ add_action( 'after_setup_theme', function () {
 	// This theme uses wp_nav_menu() in one location.
 	register_nav_menus( [
 		'navbar-main-menu' => __( 'Navbar Main Menu', 'wp-rdnyc' ),
-		// 'footer'  => __( 'Footer Menu', 'wp-rdnyc' ),
 	] );
 
 	// Switch default core markup for search form, comment form, and comments to output valid HTML5.
diff --git a/src/sidebars.php b/src/sidebars.php
index 0ab6f95..41ad8eb 100644
--- a/src/sidebars.php
+++ b/src/sidebars.php
@@ -16,9 +16,9 @@ add_action( 'widgets_init', function () {
   ] );
 
   register_sidebar( [
-    'name'            => esc_html( 'Footer' ),
-    'id'              => 'footer-widgets',
-    'description'     => 'Blog page footer area for widgets',
+    'name'            => esc_html( 'Front Page' ),
+    'id'              => 'front-page-widgets',
+    'description'     => 'Front page widget area',
     'before_widget'   => '<section id="%1$s" class="%2$s widget">',
     'after_widget'    => '</section>',
   ] );
diff --git a/webpack.config.js b/webpack.config.js
index d6ac03a..8b35651 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -52,16 +52,8 @@ const config = {
         type: 'asset/resource',
         generator: {
           filename: (pathData) => {
-            if (pathData.filename.includes('@mdi')) {
-              return 'images/mdi-[name][ext]';
-            } else if (pathData.filename.includes("bootstrap-icons")) {
+            if (pathData.filename.includes("bootstrap-icons")) {
               return 'images/bsi-[name][ext]';
-            } else if (pathData.filename.includes("heroicons")) {
-              if (pathData.filename.includes("outline")) {
-                return 'images/hio-[name][ext]';
-              } else {
-                return 'images/his-[name][ext]';
-              }
             } else {
               return 'images/svg-[name][ext]';
             }
@@ -183,7 +175,7 @@ function getCSSWhitelistPatterns() {
     /^children(-.*)?$/,
     /^figure$/,
     /^blockquote$/,
-    /^tsml$/,
+    /^tsml(-.*)?$/,
     /^label$/,
     /^input$/,
     /^textarea$/,