]> _ Git - fluidbook-toolbox.git/commitdiff
Adding uncommitted code. WIP #5316
authorStephen Cameron <stephen@cubedesigners.com>
Tue, 13 Dec 2022 21:10:57 +0000 (22:10 +0100)
committerStephen Cameron <stephen@cubedesigners.com>
Tue, 13 Dec 2022 21:10:57 +0000 (22:10 +0100)
resources/views/fluidbook_stats/loader.blade.php
resources/views/fluidbook_stats/summary.blade.php

index d60607e9b2909929ca65e05f69e6112012fd69e0..fece720eeceb6139210361b37fdc1cf3d9f7687d 100644 (file)
             color: #fff;
             text-decoration: none;
         }
+        .period_disabled {
+            opacity: 0.5;
+            cursor: not-allowed;
+        }
 
         .summary {
             display: grid;
         function showStatsLoader() {
             document.getElementById('stats_wrapper').style.display = 'none';
             document.getElementById('stats_loader').style.display = 'flex';
+            window.scrollTo(0,0);
         }
 
         function showStatsError() {
index 8b1c7ddc9cc7ad8fc680016996ac8bc139a3a4fc..5cf97e4dbf4f79aceeb89062347b533aa10c5373 100644 (file)
@@ -3,7 +3,7 @@
 
 <h2 class="mt-4">
     {{ __('Statistics') }}
-    <span class="heading-subtitle">{{ $fluidbook->name }}</span>
+    <span class="heading-subtitle">{{ $fluidbook_settings->title }}</span>
 </h2>
 
 <div data-daterangepicker class="mb-4" style="cursor: pointer" title="{{ __('Statistics Period - click to choose a new date range') }}">
@@ -19,7 +19,7 @@
 
 <dl class="summary">
     <dt>{{ __('Fluidbook Name') }}</dt>
-    <dd>{{ $fluidbook->name }}</dd>
+    <dd>{{ $fluidbook_settings->title }}</dd>
 
     <dt>{{ __('Creation Date') }}</dt>
     <dd>
@@ -36,6 +36,7 @@
     <dt>{{ __('Page Count') }}</dt>
     <dd>{{ $page_count }}</dd>
 
+    {{-- Summary of totals --}}
     @if($period_details->isNotEmpty())
         @foreach ($table_map['summary'] as $summary_key => $summary_heading)
             @php
 
 @if($period_details->isNotEmpty())
 
+    {{-- Period (segmentation) override controls [ Day / Week / Month / Year ] --}}
     <div class="chart-header mt-5">
         <h2>{!! $chart_heading !!}</h2>
         <div class="periods">
             @foreach($period_map as $period_key => $period_title)
-                @if($period_key === $period)
-                    <span>{{ $period_title['singular'] }}</span>
+                @php
+                    // When in the month or year display modes, it makes no sense to offer the month and year segmentations
+                    $period_not_available = ($mode === 'month' && in_array($period_key, ['month', 'year'])) || ($mode === 'year' && $period_key === 'year');
+                @endphp
+                @if($period_key === $period || $period_not_available)
+                    <span @if($period_not_available)class="period_disabled"@endif>{{ $period_title['singular'] }}</span>
                 @else
                     <a href="{{ route('stats', compact('fluidbook_id', 'hash') + ['date' => $date ?? '-', 'period_override' => $period_key]) }}" onclick="showStatsLoader()">
                         {{ $period_title['singular'] }}
@@ -70,7 +76,7 @@
     {{-- Chart --}}
     <canvas id="stats_chart"></canvas>
 
-    {{-- Stats for each period entry (year, month or day) --}}
+    {{-- Stats for each period entry (year, month, week or day) --}}
     <table class="sortable stats-details mt-5">
         <thead>
             <tr>
                     <tbody>
                     @foreach($countries as $country)
                         <tr>
-                            <td class="whitespace-nowrap">
+                            <td class="whitespace-nowrap" data-sort-value="{{ $country['label'] }}">
                                 <img src="{{ $country['flag'] }}" alt="{{ $country['label'] }}" style="width: 1.5em; margin-right: 0.75em;">
                                 {{ $country['label'] }}
                             </td>
 {{-- Charting library --}}
 <script>
     //=== Chart Setup
-    const labels = {!! json_encode($labels) !!};
+    const labels = {!! json_encode(array_keys($tooltip_labels)) !!};
     const tooltip_labels = {!! json_encode($tooltip_labels) !!};
     const data = {
         labels: labels,