|
4 | 4 | <main class="mt-16 mx-auto max-w-7xl px-4 sm:mt-24"> |
5 | 5 | <div class="text-center"> |
6 | 6 | <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"> |
7 | | - <span class="<%= Universe.text_color %>"><%= @toc_scope.name %></span> |
| 7 | + <span class="<%= Universe.text_color %>"><%= @universe.name %></span> |
8 | 8 | </h1> |
9 | 9 | <h2 class="text-gray-400 tracking-wider"> |
10 | 10 | a universe by |
11 | 11 | <%= link_to @toc_user.display_name, @toc_user, class: User.text_color %> |
12 | 12 | </h2> |
13 | | - <p class="mt-3 max-w-md mx-auto text-base text-gray-500 sm:text-lg md:mt-5 md:text-xl md:max-w-3xl"> |
14 | | - scope description |
15 | | - </p> |
| 13 | + <% if @universe.description.present? %> |
| 14 | + <p class="mt-3 max-w-md mx-auto text-base text-gray-500 sm:text-lg md:mt-5 md:text-xl md:max-w-3xl"> |
| 15 | + <%= @universe.description %> |
| 16 | + </p> |
| 17 | + <% end %> |
16 | 18 | </div> |
17 | 19 | </main> |
18 | | - |
19 | | - <div class="mt-8"> |
20 | | - <div class="max-w-7xl mx-auto px-4 sm:px-6"> |
21 | | - <nav class="relative flex items-center justify-between sm:h-10 md:justify-center" aria-label="Global"> |
22 | | - <div class="hidden md:flex md:space-x-10"> |
23 | | - <a href="#" class="font-medium text-gray-500 hover:text-gray-900 hover:bg-white rounded-lg hover:border-gray-200 border-transparent border px-4">Worldbuilding</a> |
24 | | - <a href="#" class="font-medium text-gray-500 hover:text-gray-900 hover:bg-white rounded-lg hover:border-gray-200 border-transparent border px-4">Documents</a> |
25 | | - </div> |
26 | | - </nav> |
27 | | - </div> |
28 | | - </div> |
29 | 20 |
|
30 | 21 | </div> |
31 | 22 | </div> |
|
43 | 34 | <div class="mt-12 lg:mt-0 lg:col-span-2"> |
44 | 35 | <dl> |
45 | 36 | <% @starred_pages.each do |page| %> |
46 | | - <%= link_to polymorphic_path(page['page_type'].downcase, id: page['id']), class: 'block px-4 py-3 hover:bg-white rounded-lg hover:border-gray-200 border-transparent border' do %> |
47 | | - <dt class="text-lg leading-6 font-medium <%= content_class_from_name(page['page_type']).text_color %>"> |
48 | | - <i class="material-icons float-left mr-2"><%= content_class_from_name(page['page_type']).icon %></i> |
49 | | - <%= page['name'] %> |
| 37 | + <%= link_to polymorphic_path(page.page_type.downcase, id: page.id), class: 'block px-4 py-3 hover:bg-white rounded-lg hover:border-gray-200 border-transparent border' do %> |
| 38 | + <dt class="text-lg leading-6 font-medium <%= content_class_from_name(page.page_type).text_color %>"> |
| 39 | + <i class="material-icons float-left mr-2"><%= content_class_from_name(page.page_type).icon %></i> |
| 40 | + <%= page.name %> |
50 | 41 | </dt> |
51 | | - <!-- |
52 | | - <dd class="mt-2 text-base text-gray-500"> |
53 | | - Description |
54 | | - </dd> |
55 | | - --> |
56 | 42 | <% end %> |
57 | 43 | <% end %> |
58 | 44 | </dl> |
|
62 | 48 | </div> |
63 | 49 | <% end %> |
64 | 50 |
|
65 | | -<div class=""> |
| 51 | +<div data-controller="toc-filter"> |
66 | 52 | <div class="max-w-7xl mx-auto py-16 px-4 sm:px-6 lg:py-20 lg:px-8"> |
67 | 53 | <div class="lg:grid lg:grid-cols-3 lg:gap-8"> |
68 | 54 | <div class="lg:pr-32"> |
69 | 55 | <h2 class="text-3xl font-extrabold text-gray-900">All pages</h2> |
70 | 56 | <p class="mt-8 text-lg text-gray-500"> |
71 | | - Filter by page type... |
| 57 | + Filter by page type |
72 | 58 | </p> |
73 | 59 |
|
74 | 60 | <ul role="list" class="border border-gray-200 rounded-md divide-y divide-gray-200 mt-2 bg-white"> |
| 61 | + <li class="pl-3 pr-4 py-3 flex items-center justify-between text-sm rounded-full hover:bg-notebook-blue hover:text-white group cursor-pointer" |
| 62 | + data-action="click->toc-filter#showAll" |
| 63 | + data-toc-filter-target="allFilter"> |
| 64 | + <div class="w-0 flex-1 flex items-center"> |
| 65 | + <i class="material-icons float-left bg-white p-1 h-8 w-8 rounded-full text-gray-400">select_all</i> |
| 66 | + <span class="ml-2 flex-1 w-0 truncate font-medium">All types</span> |
| 67 | + </div> |
| 68 | + <div class="ml-4 flex-shrink-0"> |
| 69 | + <span class="bg-gray-100 rounded px-1 text-xs group-hover:bg-notebook-blue"> |
| 70 | + <%= @total_pages %> |
| 71 | + </span> |
| 72 | + </div> |
| 73 | + </li> |
75 | 74 | <% @page_type_counts.each do |page_type, count| %> |
76 | | - <%= link_to '#' do %> |
77 | | - <li class="pl-3 pr-4 py-3 flex items-center justify-between text-sm rounded-full hover:bg-notebook-blue hover:text-white group"> |
78 | | - <div class="w-0 flex-1 flex items-center"> |
79 | | - <i class="material-icons float-left <%= content_class_from_name(page_type).text_color %> bg-white p-1 h-8 w-8 rounded-full"><%= content_class_from_name(page_type).icon %></i> |
80 | | - <span class="ml-2 flex-1 w-0 truncate"><%= page_type.pluralize %></span> |
81 | | - </div> |
82 | | - <div class="ml-4 flex-shrink-0"> |
83 | | - <span class="bg-gray-100 rounded px-1 text-xs group-hover:bg-notebook-blue"> |
84 | | - <%= count %> |
85 | | - </span> |
86 | | - </div> |
87 | | - </li> |
88 | | - <% end %> |
| 75 | + <li class="pl-3 pr-4 py-3 flex items-center justify-between text-sm rounded-full hover:bg-notebook-blue hover:text-white group cursor-pointer" |
| 76 | + data-action="click->toc-filter#filter" |
| 77 | + data-page-type="<%= page_type %>"> |
| 78 | + <div class="w-0 flex-1 flex items-center"> |
| 79 | + <i class="material-icons float-left <%= content_class_from_name(page_type).text_color %> bg-white p-1 h-8 w-8 rounded-full"><%= content_class_from_name(page_type).icon %></i> |
| 80 | + <span class="ml-2 flex-1 w-0 truncate"><%= page_type.pluralize %></span> |
| 81 | + </div> |
| 82 | + <div class="ml-4 flex-shrink-0"> |
| 83 | + <span class="bg-gray-100 rounded px-1 text-xs group-hover:bg-notebook-blue"> |
| 84 | + <%= count %> |
| 85 | + </span> |
| 86 | + </div> |
| 87 | + </li> |
89 | 88 | <% end %> |
90 | 89 | </ul> |
91 | 90 |
|
92 | 91 | </div> |
93 | 92 | <div class="mt-12 lg:mt-0 lg:col-span-2"> |
94 | 93 | <dl> |
95 | 94 | <% @other_pages.each do |page| %> |
96 | | - <%= link_to polymorphic_path(page['page_type'].downcase, id: page['id']), class: 'block px-4 py-3 hover:bg-white rounded-lg hover:border-gray-200 border-transparent border' do %> |
97 | | - <dt class="text-lg leading-6 font-medium <%= content_class_from_name(page['page_type']).text_color %>"> |
98 | | - <i class="material-icons float-left mr-2"><%= content_class_from_name(page['page_type']).icon %></i> |
99 | | - <%= page['name'] %> |
| 95 | + <%= link_to polymorphic_path(page.page_type.downcase, id: page.id), |
| 96 | + class: 'block px-4 py-3 hover:bg-white rounded-lg hover:border-gray-200 border-transparent border', |
| 97 | + data: { toc_filter_target: 'page', page_type: page.page_type } do %> |
| 98 | + <dt class="text-lg leading-6 font-medium <%= content_class_from_name(page.page_type).text_color %>"> |
| 99 | + <i class="material-icons float-left mr-2"><%= content_class_from_name(page.page_type).icon %></i> |
| 100 | + <%= page.name %> |
100 | 101 | </dt> |
101 | | - <!-- |
102 | | - <dd class="mt-2 text-base text-gray-500"> |
103 | | - Description |
104 | | - </dd> |
105 | | - --> |
106 | 102 | <% end %> |
107 | 103 | <% end %> |
108 | 104 | </dl> |
|
111 | 107 | </div> |
112 | 108 | </div> |
113 | 109 |
|
114 | | -<div class="bg-white"> |
115 | | - <div class="max-w-7xl mx-auto py-24 px-4 sm:px-6 lg:py-32 lg:px-8 lg:flex lg:items-center"> |
116 | | - <div class="lg:w-0 lg:flex-1"> |
117 | | - <h2 class="text-3xl font-extrabold text-gray-900 sm:text-4xl">Follow this universe</h2> |
118 | | - <p class="mt-3 max-w-3xl text-lg text-gray-500"> |
119 | | - Stay connected and be notified as this world grows! |
120 | | - </p> |
121 | | - </div> |
122 | | - <div class="mt-8 lg:mt-0 lg:ml-8"> |
123 | | - <form class="sm:flex"> |
124 | | - <label for="email-address" class="sr-only">Email address</label> |
125 | | - <input id="email-address" name="email-address" type="email" autocomplete="email" required class="w-full px-5 py-3 border border-gray-300 shadow-sm placeholder-gray-400 focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:max-w-xs rounded-md" placeholder="Enter your email"> |
126 | | - <div class="mt-3 rounded-md shadow sm:mt-0 sm:ml-3 sm:flex-shrink-0"> |
127 | | - <button type="submit" class="w-full flex items-center justify-center py-3 px-5 border border-transparent text-base font-medium rounded-md text-white bg-notebook-blue hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Notify me</button> |
128 | | - </div> |
129 | | - </form> |
130 | | - <p class="mt-3 text-sm text-gray-500"> |
131 | | - Your email address won't be shared with <%= @toc_user.display_name %>. |
132 | | - </p> |
133 | | - </div> |
134 | | - </div> |
135 | | -</div> |
136 | | - |
137 | | -<section class="container mx-auto"> |
| 110 | +<section class="container mx-auto pb-16"> |
138 | 111 | <div> |
139 | 112 | <dl class="mt-5 grid grid-cols-1 gap-5 sm:grid-cols-3 text-center"> |
140 | 113 | <div class="px-4 py-5 bg-white shadow rounded-lg overflow-hidden sm:p-6"> |
141 | 114 | <dt class="text-sm font-medium text-gray-500 truncate">Total Pages</dt> |
142 | 115 | <dd |
143 | 116 | data-controller="animated-number" |
144 | 117 | data-animated-number-start-value="0" |
145 | | - data-animated-number-end-value="5192" |
| 118 | + data-animated-number-end-value="<%= @total_pages %>" |
146 | 119 | data-animated-number-duration-value="700" |
147 | 120 | class="mt-1 text-3xl font-semibold text-gray-900" |
148 | 121 | ></dd> |
|
153 | 126 | <dd |
154 | 127 | data-controller="animated-number" |
155 | 128 | data-animated-number-start-value="0" |
156 | | - data-animated-number-end-value="85192" |
| 129 | + data-animated-number-end-value="<%= @total_words %>" |
157 | 130 | data-animated-number-duration-value="800" |
158 | 131 | class="mt-1 text-3xl font-semibold text-gray-900" |
159 | 132 | ></dd> |
160 | 133 | </div> |
161 | 134 |
|
162 | 135 | <div class="px-4 py-5 bg-white shadow rounded-lg overflow-hidden sm:p-6"> |
163 | | - <dt class="text-sm font-medium text-gray-500 truncate">Something</dt> |
164 | | - <dd class="mt-1 text-3xl font-semibold text-gray-900">24.57%</dd> |
| 136 | + <dt class="text-sm font-medium text-gray-500 truncate">Page Types</dt> |
| 137 | + <dd |
| 138 | + data-controller="animated-number" |
| 139 | + data-animated-number-start-value="0" |
| 140 | + data-animated-number-end-value="<%= @content_type_count %>" |
| 141 | + data-animated-number-duration-value="500" |
| 142 | + class="mt-1 text-3xl font-semibold text-gray-900" |
| 143 | + ></dd> |
165 | 144 | </div> |
166 | 145 | </dl> |
167 | 146 | </div> |
|
0 commit comments