-
Notifications
You must be signed in to change notification settings - Fork 1
Add UI for User Analytics #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Karthikeyantestpress
wants to merge
3
commits into
main
Choose a base branch
from
user-analytics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| {% set _active = analytics_active_tab | default('revenue_and_subscription') %} | ||
|
|
||
| <div | ||
| class="sticky top-16 z-30 -mx-4 -mt-10 border-b border-gray-200 bg-white sm:-mx-6 lg:-mx-8 dark:border-neutral-700 dark:bg-neutral-900"> | ||
| <header class="border-b border-gray-200 px-4 py-4 sm:px-6 lg:px-8 dark:border-neutral-700"> | ||
| <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"> | ||
| <div> | ||
| <h2 class="text-2xl/7 font-bold text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight dark:text-white"> | ||
| Analytics Dashboard</h2> | ||
| </div> | ||
| <div class="flex items-center gap-4"> | ||
| <div class="relative inline-block"> | ||
| <select data-hs-select='{ | ||
| "placeholder": "Date range", | ||
| "toggleTag": "<button type=\"button\" aria-expanded=\"false\" aria-label=\"Date range\"></button>", | ||
| "toggleClasses": "hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative py-2 ps-3 pe-9 flex gap-x-2 text-nowrap w-full cursor-pointer bg-white border border-gray-300 rounded-md text-start text-sm text-gray-900 focus:outline-none focus:ring-1 focus:ring-primary-500 focus:border-primary-500 dark:bg-neutral-800 dark:border-neutral-600 dark:text-neutral-200 dark:focus:ring-primary-500 dark:focus:border-primary-500", | ||
| "dropdownClasses": "mt-2 z-50 min-w-[10rem] max-h-72 p-1 space-y-0.5 bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden overflow-y-auto dark:bg-neutral-800 dark:border-neutral-700 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500", | ||
| "optionClasses": "hs-selected:bg-gray-100 dark:hs-selected:bg-neutral-700 py-2 px-3 w-full text-sm text-gray-800 cursor-pointer hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:text-neutral-200 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700", | ||
| "optionTemplate": "<div class=\"flex justify-between items-center w-full\"><span data-title></span><span class=\"hidden hs-selected:block\"><svg class=\"shrink-0 size-3.5 text-gray-800 dark:text-neutral-200\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"/></svg></span></div>" | ||
| }' id="analytics-date-range" class="hidden"> | ||
| <option value="7">Last 7 Days</option> | ||
| <option value="30" selected>Last 30 Days</option> | ||
| <option value="90">Last 3 Months</option> | ||
| <option value="365">Last Year</option> | ||
| </select> | ||
| <div class="pointer-events-none absolute top-1/2 end-2.5 -translate-y-1/2"> | ||
| <svg class="size-4 text-gray-500 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" | ||
| height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" | ||
| stroke-linejoin="round"> | ||
| <path d="m6 9 6 6 6-6" /> | ||
| </svg> | ||
| </div> | ||
| </div> | ||
| <button type="button" | ||
| class="inline-flex h-9 items-center gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-1 focus:ring-primary-500 focus:ring-offset-1 dark:border-neutral-600 dark:bg-neutral-800 dark:text-neutral-200 dark:hover:bg-neutral-700 dark:focus:ring-primary-500 dark:focus:ring-offset-neutral-900" | ||
| aria-label="Export"> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" | ||
| stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" | ||
| class="shrink-0"> | ||
| <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /> | ||
| <polyline points="7 10 12 15 17 10" /> | ||
| <line x1="12" x2="12" y1="15" y2="3" /> | ||
| </svg> | ||
| Export | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </header> | ||
| <div class="border-b border-gray-200 dark:border-neutral-700"> | ||
| <nav class="-mb-px flex space-x-8 overflow-x-auto px-4 sm:px-6 lg:px-8" aria-label="Analytics tabs" role="tablist"> | ||
| <a href="/flimix/analytics/revenue_and_subscription/" | ||
| class="group inline-flex shrink-0 items-center border-b-2 px-1 py-4 text-sm font-medium focus:outline-none transition-colors {% if _active == 'revenue_and_subscription' %}border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400{% else %}border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300{% endif %}" | ||
| {% if _active=='revenue_and_subscription' %}aria-current="page" {% endif %}> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" | ||
| stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" | ||
| class="mr-2 -ml-0.5 size-4" aria-hidden="true"> | ||
| <line x1="12" x2="12" y1="2" y2="22" /> | ||
| <path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" /> | ||
| </svg> | ||
| Revenue & Subscriptions | ||
| </a> | ||
| <a href="/flimix/analytics/user_analytics/" | ||
| class="group inline-flex shrink-0 items-center border-b-2 px-1 py-4 text-sm font-medium focus:outline-none transition-colors {% if _active == 'user_analytics' %}border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400{% else %}border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300{% endif %}" | ||
| {% if _active=='user_analytics' %}aria-current="page" {% endif %}> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" | ||
| stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" | ||
| class="mr-2 -ml-0.5 size-4" aria-hidden="true"> | ||
| <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /> | ||
| <circle cx="9" cy="7" r="4" /> | ||
| <path d="M22 21v-2a4 4 0 0 0-3-3.87" /> | ||
| <path d="M16 3.13a4 4 0 0 1 0 7.75" /> | ||
| </svg> | ||
| User Analytics | ||
| </a> | ||
| <a href="/flimix/analytics/content_performance/" | ||
| class="group inline-flex shrink-0 items-center border-b-2 px-1 py-4 text-sm font-medium focus:outline-none transition-colors {% if _active == 'content_performance' %}border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400{% else %}border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300{% endif %}" | ||
| {% if _active=='content_performance' %}aria-current="page" {% endif %}> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" | ||
| stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" | ||
| class="mr-2 -ml-0.5 size-4" aria-hidden="true"> | ||
| <polygon points="6 3 20 12 6 21 6 3" /> | ||
| </svg> | ||
| Content Performance | ||
| </a> | ||
| <a href="/flimix/analytics/geographic/" | ||
| class="group inline-flex shrink-0 items-center border-b-2 px-1 py-4 text-sm font-medium focus:outline-none transition-colors {% if _active == 'geographic' %}border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400{% else %}border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300{% endif %}" | ||
| {% if _active=='geographic' %}aria-current="page" {% endif %}> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" | ||
| stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" | ||
| class="mr-2 -ml-0.5 size-4" aria-hidden="true"> | ||
| <circle cx="12" cy="12" r="10" /> | ||
| <path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /> | ||
| <path d="M2 12h20" /> | ||
| </svg> | ||
| Geographic | ||
| </a> | ||
| <a href="/flimix/analytics/platform_and_devices/" | ||
| class="group inline-flex shrink-0 items-center border-b-2 px-1 py-4 text-sm font-medium focus:outline-none transition-colors {% if _active == 'platform_and_devices' %}border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400{% else %}border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300{% endif %}" | ||
| {% if _active=='platform_and_devices' %}aria-current="page" {% endif %}> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" | ||
| stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" | ||
| class="mr-2 -ml-0.5 size-4" aria-hidden="true"> | ||
| <rect width="20" height="14" x="2" y="3" rx="2" /> | ||
| <line x1="8" x2="16" y1="21" y2="21" /> | ||
| <line x1="12" x2="12" y1="17" y2="21" /> | ||
| </svg> | ||
| Platform & Devices | ||
| </a> | ||
| </nav> | ||
| </div> | ||
| </div> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code for the navigation tabs is highly repetitive. Each
<a>tag contains a large, nearly identicalclassattribute with conditional logic. This duplication makes the code difficult to read and maintain. A change to the tab styling would require updating it in five different places. Consider using a Jinja2 macro to generate the tabs. This would centralize the tab structure and styling, reduce duplication, and improve maintainability.