diff --git a/app/controllers/document_analyses_controller.rb b/app/controllers/document_analyses_controller.rb index 1e4c6e27..3c34ce60 100644 --- a/app/controllers/document_analyses_controller.rb +++ b/app/controllers/document_analyses_controller.rb @@ -1,14 +1,45 @@ class DocumentAnalysesController < ApplicationController - before_action :authenticate_user!, except: [:index] - before_action :set_document, except: [:index] - before_action :authorize_user_for_document, except: [:index] - before_action :set_document_analysis, except: [:index] + before_action :authenticate_user!, except: [:index, :landing] + before_action :set_document, except: [:index, :landing, :hub] + before_action :authorize_user_for_document, except: [:index, :landing, :hub] + before_action :set_document_analysis, except: [:index, :landing, :hub] before_action :set_navbar_color before_action :set_sidenav_expansion # before_action :set_navbar_actions - layout 'tailwind', only: [:index] + layout 'tailwind', only: [:index, :landing, :hub] + + # Document analysis landing page for logged out users + def landing + redirect_to hub_path if user_signed_in? + + # Set SEO metadata + set_meta_tags title: "Document Analysis - Notebook.ai", + description: "Analyze your writing for readability, style, sentiment, and more with Notebook.ai's AI-powered document analysis tools.", + keywords: "document analysis, writing analysis, readability, style analysis, sentiment analysis, AI writing tools" + end + + # Document analysis hub for logged in users + def hub + redirect_to landing_path unless user_signed_in? + + # Get the user's recent documents + @recent_documents = current_user.documents.order(updated_at: :desc).limit(5) if user_signed_in? + + # Get the user's recent analyses + @recent_analyses = DocumentAnalysis.joins(:document) + .where(documents: { user_id: current_user.id }) + .where.not(completed_at: nil) + .order(completed_at: :desc) + .limit(5) if user_signed_in? + + # Get overall analysis stats + @total_analyses_count = DocumentAnalysis.joins(:document) + .where(documents: { user_id: current_user.id }) + .where.not(completed_at: nil) + .count if user_signed_in? + end def index @document_analyses = DocumentAnalysis.all diff --git a/app/views/document_analyses/hub.html.erb b/app/views/document_analyses/hub.html.erb new file mode 100644 index 00000000..69a8df91 --- /dev/null +++ b/app/views/document_analyses/hub.html.erb @@ -0,0 +1,557 @@ +<% + page_title = "Analysis Dashboard" + page_description = "Monitor, run, and review your document analyses" + + set_meta_tags title: page_title, + description: page_description +%> + + +
Analyze, track, and improve your writing
+You haven't created any documents yet.
+| Document | +Metrics | +Status | +Date | ++ View + | +
|---|---|---|---|---|
|
+
+
+
+ analytics
+
+
+
+
+ <%= analysis.document.title %>
+
+
+ <%= pluralize(analysis.word_count || 0, 'word') %>
+
+ |
+
+
+ <% if analysis.flesch_kincaid_grade %>
+
+ Grade: <%= analysis.flesch_kincaid_grade.round(1) %>
+
+ <% end %>
+ <% if analysis.sentiment_score %>
+
+ Sentiment: <%= analysis.sentiment_score.round(2) %>
+
+ <% end %>
+
+ |
+ + + Complete + + | ++ <%= time_ago_in_words(analysis.completed_at) %> ago + | ++ <%= link_to "View", analysis_document_path(analysis.document), class: "text-indigo-600 hover:text-indigo-900" %> + | +
|
+
+ analytics
+
+ <% if @recent_documents.present? && @recent_documents.any? %>
+ <%= link_to "Analyze your first document", queue_analysis_document_path(@recent_documents.first), method: :get, class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700" %>
+ <% end %>
+ No analyses have been run yet. + |
+ ||||
Average sentence length in "<%= @recent_analyses.first.document.title %>" is 24 words. Consider breaking longer sentences to improve readability.
++ Details +
+Your vocabulary diversity score has improved by 15% over the last three documents.
++ View trend +
+Passive voice usage detected in 18% of sentences. Consider using active voice for more engaging writing.
++ View examples +
+Readability Score Trend
+Based on your last 7 analyzed documents
+Word Count Trend
+Word count progression over time
+Readability Analysis
+Flesch-Kincaid, SMOG, more
+Style Analysis
+Passive voice, adverbs, more
+Sentiment Analysis
+Emotional tone detection
+Active voice sentences are clearer and more engaging. Replace "The ball was thrown" with "He threw the ball."
+Mix short and longer sentences to create rhythm in your writing. Aim for an average of 15-20 words per sentence.
+Remove unnecessary words like "very," "really," and "actually" to strengthen your prose.
+Unlock the full potential of your writing with AI-powered analysis tools that help you create more engaging, readable, and consistent content.
+Get detailed insights into your writing that help you create better content.
+Understand how accessible your writing is to different audiences with detailed readability metrics.
+ +Reading Level Scores
+Syllable Distribution
+Sentence Length Analysis
+Get detailed insights into your writing style, including word choice, grammar patterns, and more.
+ +Parts of Speech Analysis
+Word Frequency
+Cliché Detection
+Understand the emotional tone of your writing with advanced sentiment analysis tools.
+ +Emotion Detection
+Sentiment Visualization
+Tone Consistency
+++++ ++ "Notebook.ai's document analysis tools have transformed my writing process. I can now quickly identify areas to improve and ensure my tone is consistent throughout my novels." +
+
We're exploring cutting-edge features that could transform how writers understand and improve their craft.
+Visualize the intricate web of character interactions throughout your narrative with stunning interactive graphs.
+Map the emotional journey of your stories and compare them to classic narrative structures.
+Discover your unique writing fingerprint and track how your style evolves across different works.
+AI-powered checks to ensure your fictional world maintains internal consistency throughout your writing.
+Generate visual staging suggestions and cinematic concepts based on your scene descriptions.
+Analyze how your writing might be received by readers from different cultural backgrounds.
+These cutting-edge features represent our vision for the future of AI-assisted writing.
Help us shape this future by joining Notebook.ai today.
Create a free account to get started with AI-powered document analysis and unlock your writing potential.
+ Sign up now +