<%= link_to data_vault_path, class: 'text-gray-500 hover:text-gray-700 mr-3', title: "Back to your Data Vault" do %> arrow_back <% end %>

Notebook Analytics

Member since <%= current_user.created_at.strftime("%B %Y") %>

Total Pages

<%= number_with_delimiter @content.values.sum(&:count) %>

auto_stories
<% recent_pages = 0 @content.each do |_, pages| recent_pages += pages.select { |page| page.created_at > 30.days.ago }.count end %> <% if recent_pages > 0 %> <%= recent_pages %> new in the last 30 days <% else %> No new pages in the last 30 days <% end %>

Total Updates

<%= number_with_delimiter current_user.content_change_events.count %>

edit
<% recent_updates = current_user.content_change_events.where('created_at > ?', 30.days.ago).count %> <% if recent_updates > 0 %> <%= recent_updates %> updates in the last 30 days <% else %> No updates in the last 30 days <% end %>

Active Days

<%= number_with_delimiter current_user.content_change_events.group_by_day(:created_at).count %>

calendar_today
<% streak_days = 0 current_date = Date.today while current_user.content_change_events.where('DATE(created_at) = ?', current_date).exists? streak_days += 1 current_date = current_date - 1.day end %> <% if streak_days > 0 %> Current streak: <%= streak_days %> days <% else %> No current streak <% end %>

Most Active Content

<% # Find most active content type based on number of pages most_active_type = nil most_active_count = 0 @content.each do |type, pages| if pages.count > most_active_count most_active_type = type most_active_count = pages.count end end %>

<%= most_active_type.pluralize %>

trending_up
<%= number_with_delimiter most_active_count %> pages of this type

Activity Trends

Track how your worldbuilding activity changes over time

Every field edit counts as one update
<% weekly_data = current_user.content_change_events.where('created_at > ?', DateTime.now - 7.days).group_by_day(:created_at).map { |date, count| [date.split(' ').first, count] } %> <%= area_chart weekly_data, download: true, colors: ["#3b82f6"], points: false %>
Total Updates
<%= number_with_delimiter weekly_data.sum { |_, count| count } %>
Most Active Day
<% most_active = weekly_data.max_by { |_, count| count } %>
<%= most_active ? Date.parse(most_active[0]).strftime("%A") : "N/A" %>
Daily Average
<%= weekly_data.any? ? (weekly_data.sum { |_, count| count }.to_f / weekly_data.size).round : 0 %>

Content Categories

Your content organized by category

<% # Group content types into categories categories = { "Characters" => ["Character", "Person"], "Locations" => ["Location", "Town", "Country", "Landmark", "Building", "Region", "Planet"], "Items" => ["Item", "Creature", "Flora", "Vehicle", "Magic", "Technology"], "Story Elements" => ["Scene", "Group", "Tradition", "Government", "Religion", "Race", "Deity", "Language"], "Other" => [] } category_counts = {} @content.each do |type, pages| found_category = false categories.each do |category, types| if types.include?(type) category_counts[category] ||= 0 category_counts[category] += pages.count found_category = true break end end unless found_category category_counts["Other"] ||= 0 category_counts["Other"] += pages.count end end # Remove empty categories category_counts.delete_if { |_, count| count == 0 } %> <%= pie_chart category_counts, download: true, legend: "right", donut: true %>
<% category_counts.sort_by { |_, count| -count }.each do |category, count| %>
<%= category %>
<%= count %> (<%= (count.to_f / category_counts.values.sum * 100).round %>%)
<% end %>

Top Content Types

Your most frequently created content types

<% # Get top 10 content types by count top_content_types = @content.sort_by { |_, pages| -pages.count }.first(10).to_h %> <%= bar_chart top_content_types.map { |n, l| [n.pluralize(l.count), l.count] }, download: true, colors: ["#3b82f6"] %>
<% top_content_types.each_with_index do |(type, pages), index| %> <% break if index >= 10 %>
<%= index + 1 %>
<%= type.pluralize(pages.count) %>
<%= pages.count %> <%= 'page'.pluralize(pages.count) %>
<% end %>

Content Creation Timeline

When you created different types of content

<% # Get creation timeline data timeline_data = {} @content.each do |type, pages| next if pages.empty? # Group pages by month manually month_groups = pages.group_by { |page| page.created_at.beginning_of_month } month_groups.each do |month_date, month_pages| date_str = month_date.strftime("%Y-%m") timeline_data[date_str] ||= {} timeline_data[date_str][type] = month_pages.count end end # Convert to format needed for line chart chart_data = [] top_5_types = @content.sort_by { |_, pages| -pages.count }.first(5).map(&:first) top_5_types.each do |type| data_points = [] timeline_data.sort_by { |date, _| date }.each do |date, counts| data_points << [date, counts[type] || 0] end chart_data << {name: type, data: data_points} end %> <%= line_chart chart_data, download: true %>

First Content Created

<% first_content = nil first_date = nil @content.each do |type, pages| next if pages.empty? earliest = pages.min_by(&:created_at) if first_date.nil? || earliest.created_at < first_date first_content = earliest first_date = earliest.created_at end end %> <% if first_content %>
Your first page was a <%= first_content.class.name %> named "<%= first_content.name %>" created on <%= first_date.strftime("%B %d, %Y") %>
<% else %>
You haven't created any content yet.
<% end %>

Most Recent Content

<% latest_content = nil latest_date = nil @content.each do |type, pages| next if pages.empty? newest = pages.max_by(&:created_at) if latest_date.nil? || newest.created_at > latest_date latest_content = newest latest_date = newest.created_at end end %> <% if latest_content %>
Your most recent page is a <%= latest_content.class.name %> named "<%= latest_content.name %>" created <%= time_ago_in_words(latest_date) %> ago
<% else %>
You haven't created any content yet.
<% end %>

Achievements & Milestones

Track your progress and unlock achievements as you build your world

<%= link_to achievements_path, class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %> emoji_events View Achievements <% end %>