From f4fb78247c3b4fb049b26f595b0fb72b532fed02 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 12 Dec 2023 18:34:55 +0100 Subject: [PATCH] Add info banners when dashboard content is empty Fixes https://github.com/hydephp/realtime-compiler/issues/21 --- RELEASE_NOTES.md | 2 +- .../resources/dashboard.blade.php | 189 ++++++++++-------- 2 files changed, 105 insertions(+), 86 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 72e7a2f639c..0624889cb02 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,7 +10,7 @@ This serves two purposes: 2. At release time, you can move the Unreleased section changes into a new release version section. ### Added -- for new features. +- Added info banners when dashboard content sections are empty in https://github.com/hydephp/develop/pull/1494 ### Changed - Shortened the path printed to console when using the dashboard to create a page in https://github.com/hydephp/develop/pull/1492 diff --git a/packages/realtime-compiler/resources/dashboard.blade.php b/packages/realtime-compiler/resources/dashboard.blade.php index 610f92ce07e..434ef0e2cd0 100644 --- a/packages/realtime-compiler/resources/dashboard.blade.php +++ b/packages/realtime-compiler/resources/dashboard.blade.php @@ -217,46 +217,58 @@
- - - @foreach(['Page Type', 'Route Key', 'Source File', 'Output File', 'Identifier'] as $header) - - @endforeach - - - @foreach($dashboard->getPageList() as $route) - getFlash('justCreatedPage') === $route->getRouteKey() ? 'justCreatedPage active' : ''])> - - - - - - + @if(empty($dashboard->getPageList())) +
+ Info: + There are no pages yet. + @if($dashboard->isInteractive()) + Why not create one using the button above? + @else + Why not create some? + @endif +
+ @else +
{{ $header }}Actions
- {{ class_basename($route->getPageClass()) }} - - {{ $route->getRouteKey() }} - - {{ $route->getSourcePath() }} - - {{ $route->getOutputPath() }} - - {{ $route->getPageIdentifier() }} - -
- @if($dashboard->isInteractive()) -
- - - - -
- @endif - View -
-
+ + @foreach(['Page Type', 'Route Key', 'Source File', 'Output File', 'Identifier'] as $header) + + @endforeach + - @endforeach -
{{ $header }}Actions
+ @foreach($dashboard->getPageList() as $route) + getFlash('justCreatedPage') === $route->getRouteKey() ? 'justCreatedPage active' : ''])> + + {{ class_basename($route->getPageClass()) }} + + + {{ $route->getRouteKey() }} + + + {{ $route->getSourcePath() }} + + + {{ $route->getOutputPath() }} + + + {{ $route->getPageIdentifier() }} + + +
+ @if($dashboard->isInteractive()) +
+ + + + +
+ @endif + View +
+ + + @endforeach + + @endif
@@ -270,57 +282,64 @@
-
- @foreach(\Hyde\Support\Filesystem\MediaFile::all() as $mediaFile) -
-
- @if(in_array($mediaFile->getExtension(), ['svg', 'png', 'jpg', 'jpeg', 'gif'])) - {{ $mediaFile->getName() }} - @else - - @if($dashboard::isMediaFileProbablyMinified($mediaFile->getContents())) -
{{ $dashboard::highlightMediaLibraryCode($mediaFile->getContents()) }}
- @else -
{{ $dashboard::highlightMediaLibraryCode($mediaFile->getContents()) }}
- @endif -
- @endif -
-
-
-
-
-
-
-

- {{ $mediaFile->getName() }} -

-
- ({{ $dashboard::bytesToHuman($mediaFile->getContentLength()) }}) -
+ @if(empty(\Hyde\Support\Filesystem\MediaFile::all())) +
+ Info: + There are no media files yet. Why not add some? +
+ @else +
+ @foreach(\Hyde\Support\Filesystem\MediaFile::all() as $mediaFile) +
+
+ @if(in_array($mediaFile->getExtension(), ['svg', 'png', 'jpg', 'jpeg', 'gif'])) + {{ $mediaFile->getName() }} + @else + + @if($dashboard::isMediaFileProbablyMinified($mediaFile->getContents())) +
{{ $dashboard::highlightMediaLibraryCode($mediaFile->getContents()) }}
+ @else +
{{ $dashboard::highlightMediaLibraryCode($mediaFile->getContents()) }}
+ @endif +
+ @endif +
+
+
+
-
-
- Fullscreen +
+
+

+ {{ $mediaFile->getName() }} +

+
+ ({{ $dashboard::bytesToHuman($mediaFile->getContentLength()) }}) +
- @if($dashboard->isInteractive()) -
-
- - - - -
+
+ - @endif + @if($dashboard->isInteractive()) +
+
+ + + + +
+
+ @endif +
-
-
-
-
- @endforeach -
+
+
+
+ @endforeach +
+ @endif