Onboarding for new libraries and new users

This commit is contained in:
Jared Turner 2020-06-07 18:40:31 +01:00
parent aaf0a3c6af
commit fa85d9834f
2 changed files with 123 additions and 78 deletions

View File

@ -69,6 +69,13 @@ class MainRouter < Router
continue_reading = @context.library.get_continue_reading_entries username
recently_added = @context.library.get_recently_added_entries username
new_user = true
titles = @context.library.titles
titles.each { |t| new_user = false if t.load_percentage(username) > 0 }
empty_library = true
empty_library = false if titles.size > 0
layout "home"
rescue e
@context.error e

View File

@ -1,3 +1,39 @@
<%- if new_user && empty_library -%>
<div class="uk-container uk-text-center">
<i class="fas fa-plus" style="font-size: 80px;"></i>
<h2>Add your first manga</h2>
<p style="margin-bottom: 40px;">We can't find any files yet. Add some to your library and they'll appear here.</p>
<dl class="uk-description-list">
<dt style="font-weight: 500;">Current library path</dt>
<dd><code><%= @context.config.library_path %></code></dd>
<dt style="font-weight: 500;">Want to change your library path?</dt>
<dd>Update <code>config.yml</code> located at: <code>/can/I/access/config_path/from/view?</code></dd>
<dt style="font-weight: 500;">Can't see your files yet?</dt>
<dd>You must wait <%= @context.config.scan_interval %> minutes for the library scan to complete, or restart Mango.</dd>
</dl>
</div>
<%- elsif new_user && empty_library == false -%>
<div class="uk-container uk-text-center">
<i class="fas fa-book-open" style="font-size: 80px;"></i>
<h2>Read your first manga</h2>
<p>Once you start reading, Mango will remember where you left off
and show your entries here.</p>
<a href="/library" class="uk-button uk-button-default">View library</a>
</div>
<%- elsif new_user == false && empty_library == false -%>
<%- if continue_reading.empty? && recently_added.empty? -%>
<div class="uk-container uk-text-center">
<img src="/img/banner.png" style="max-width: 400px; padding: 0 20px;">
<p>A self-hosted manga server and reader</p>
<a href="/library" class="uk-button uk-button-default">View library</a>
</div>
<%- end -%>
<%- unless continue_reading.empty? -%>
<h2 class="uk-title home-headings">Continue Reading</h2>
<div id="item-container-continue" class="uk-child-width-1-4@m uk-child-width-1-2" uk-grid>
@ -85,6 +121,8 @@
</div>
</div>
<%- end -%>
<% content_for "script" do %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery.dotdotdot/4.0.11/dotdotdot.js"></script>
<script src="/js/dots.js"></script>