convert settings over (#835)

This commit is contained in:
Echo 2026-01-25 15:38:10 -05:00 committed by GitHub
parent 2960a720d5
commit 10d4d35b79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 50 deletions

View file

@ -1,5 +1,5 @@
<% if @user.api_keys.any? %>
<pre class="bg-gray-800 rounded-lg text-sm text-gray-200 whitespace-pre-wrap break-all">
<pre class="text-sm text-white whitespace-pre-wrap break-all">
# put this in your ~/.wakatime.cfg file
[settings]

View file

@ -41,7 +41,7 @@
{ include_blank: "Select a country" },
{ class: "w-full px-3 py-2 h-10 bg-darkless rounded text-white focus:border-primary focus:ring-1 focus:ring-primary" } %>
</div>
<p class="text-xs text-gray-400">Your country flag will be displayed on your profile and leaderboards.</p>
<p class="text-xs text-secondary">Your country flag will be displayed on your profile and leaderboards.</p>
<div>
<%= f.label :timezone, "Timezone", class: "block text-sm font-medium text-gray-200 mb-2" %>
<%= f.select :timezone,
@ -49,7 +49,7 @@
{ include_blank: @user.timezone.blank? },
{ class: "w-full px-3 py-2 h-10 bg-darkless rounded text-white focus:border-primary focus:ring-1 focus:ring-primary" } %>
</div>
<p class="text-xs text-gray-400">This affects how your activity graph and other time-based features are displayed.</p>
<p class="text-xs text-secondary">This affects how your activity graph and other time-based features are displayed.</p>
<%= f.submit "Save Settings", class: "w-full px-4 py-2 bg-primary text-white hover:bg-primary/50 font-medium rounded transition-colors duration-200 cursor-pointer" %>
<% end %>
</div>
@ -97,12 +97,12 @@
<p class="mt-1 text-xs text-red-400"><%= @user.errors[:username].to_sentence %></p>
<% end %>
</div>
<p class="text-xs text-gray-400">
<p class="text-xs text-secondary">
Choose a name to use in Hackatime. Only letters, numbers, "-" and "_" are allowed, max <%= User::USERNAME_MAX_LENGTH %> characters.
</p>
<% if @user.username.present? %>
<p class="text-md text-gray-400">
Your profile is currently live at <%= link_to "hackati.me/#{@user.username}", "https://hackati.me/#{@user.username}", target: "_blank", class: "text-primary hover:underline" %>
<p class="text-md text-green">
Your profile is currently live at <%= link_to "hackati.me/#{@user.username}", "https://hackati.me/#{@user.username}", target: "_blank", class: "underline" %>
</p>
<% end %>
<%= f.submit "Save Settings", class: "w-full px-4 py-2 bg-primary text-white hover:bg-primary/50 font-medium rounded transition-colors duration-200 cursor-pointer" %>
@ -123,14 +123,14 @@
<p class="text-gray-300 text-sm mb-3">When you're hacking on a project, Hackatime can update your Slack status so you can show it off!</p>
<% unless @can_enable_slack_status %>
<%= link_to "Re-authorize with Slack", slack_auth_path,
class: "inline-flex items-center gap-2 px-3 py-2 bg-gray-700 hover:bg-gray-600 text-gray-200 text-sm font-medium rounded transition-colors duration-200 mb-3" %>
class: "inline-flex items-center gap-2 px-3 py-2 bg-darkless hover:bg-dark text-gray-200 text-sm font-medium rounded transition-colors duration-200 mb-3" %>
<% end %>
<%= form_with model: @user,
url: @is_own_settings ? my_settings_path : settings_user_path(@user),
method: :patch, local: false do |f| %>
<div class="flex items-center gap-3">
<%= f.check_box :uses_slack_status,
class: "w-4 h-4 text-primary border-gray-600 rounded focus:ring-primary bg-gray-800" %>
class: "w-4 h-4 text-primary border-darkless rounded focus:ring-primary bg-darkless" %>
<%= f.label :uses_slack_status, "Update my Slack status automatically",
class: "text-sm text-gray-200" %>
</div>
@ -138,13 +138,13 @@
<% end %>
</div>
<div class="border-t border-gray-700 pt-4">
<div class="border-t border-darkless pt-4">
<h3 class="text-lg font-medium text-white mb-2" id="user_slack_notifications">Channel Notifications</h3>
<% if @enabled_sailors_logs.any? %>
<p class="text-gray-300 text-sm mb-2">You have notifications enabled for the following channels:</p>
<ul class="space-y-1 mb-3">
<% @enabled_sailors_logs.each do |sl| %>
<li class="text-xs text-gray-300 px-2 py-1 bg-gray-800 rounded">
<li class="text-xs text-gray-300 px-2 py-1 bg-darkless rounded">
<%= render "shared/slack_channel_mention", channel_id: sl.slack_channel_id %>
</li>
<% end %>
@ -152,8 +152,8 @@
<% else %>
<p class="text-gray-300 text-sm mb-3">You have no notifications enabled.</p>
<% end %>
<p class="text-xs text-gray-400">
You can enable notifications for specific channels by running <code class="px-1 py-0.5 bg-gray-800 rounded text-gray-200">/sailorslog on</code> in the Slack channel.
<p class="text-xs text-secondary">
You can enable notifications for specific channels by running <code class="px-1 py-0.5 bg-darkless rounded text-gray-200">/sailorslog on</code> in the Slack channel.
</p>
</div>
</div>
@ -172,15 +172,15 @@
class: "space-y-4" do |f| %>
<div class="flex items-center gap-3">
<%= f.check_box :allow_public_stats_lookup,
class: "w-4 h-4 text-primary border-gray-600 rounded focus:ring-primary bg-gray-800" %>
class: "w-4 h-4 text-primary border-darkless rounded focus:ring-primary bg-darkless" %>
<%= f.label :allow_public_stats_lookup, "Allow public stats lookup",
class: "text-sm text-gray-200" %>
</div>
<p class="text-xs text-gray-400">When enabled, others can view your coding statistics through public APIs. Many Hack Club YSWS programs use this to track your progress. Disabling this can prevent you from participating in some programs.</p>
<p class="text-xs text-secondary">When enabled, others can view your coding statistics through public APIs. Many Hack Club YSWS programs use this to track your progress. Disabling this can prevent you from participating in some programs.</p>
<%= f.submit "Save Settings", class: "w-full px-4 py-2 bg-primary text-white hover:bg-primary/50 font-medium rounded transition-colors duration-200 cursor-pointer" %>
<% end %>
<div class="border-t border-gray-700 pt-4 mt-4 space-y-3">
<div class="border-t border-darkless pt-4 mt-4 space-y-3">
<div class="flex items-center gap-3">
<div class="p-2 bg-primary/10 rounded">
<span class="text-2xl">🗑️</span>
@ -241,13 +241,13 @@
<h3 class="text-lg font-medium text-white">GitHub Account</h3>
<p class="text-gray-300 text-sm">This is used to show your active projects on the leaderboard & current hacking activity on the dashboard.</p>
<% if @user.github_uid.present? %>
<div class="flex items-center gap-2 p-3 bg-gray-800 border border-gray-600 rounded">
<div class="flex items-center gap-2 p-3 bg-darkless border border-darkless rounded">
<span class="text-green-400">✅</span>
<span class="text-gray-200 text-sm">Connected: <%= link_to "@#{h(@user.github_username)}", "https://github.com/#{h(@user.github_username)}", target: "_blank", class: "text-primary hover:text-primary/80 underline" %></span>
</div>
<div class="flex items-center gap-2">
<%= link_to "Relink GitHub Account", github_auth_path, data: { turbo: "false" }, class: "inline-flex items-center gap-2 px-3 py-2 bg-primary text-white hover:bg-primary/50 text-sm font-medium rounded transition-colors duration-200 cursor-pointer" %>
<%= button_to "Unlink", github_unlink_path, method: :delete, data: { turbo_confirm: "Are you sure you want to unlink your GitHub account? This will remove your GitHub connection and you may need to re-link to use GitHub-dependent features." }, class: "inline-flex items-center gap-2 px-3 py-2 bg-gray-700 hover:bg-gray-600 text-white hover:text-white/80 text-sm font-medium rounded transition-colors duration-200 cursor-pointer" %>
<%= button_to "Unlink", github_unlink_path, method: :delete, data: { turbo_confirm: "Are you sure you want to unlink your GitHub account? This will remove your GitHub connection and you may need to re-link to use GitHub-dependent features." }, class: "inline-flex items-center gap-2 px-3 py-2 bg-darkless hover:bg-darkless/50 text-white hover:text-white/80 text-sm font-medium rounded transition-colors duration-200 cursor-pointer" %>
</div>
<% else %>
<%= link_to "Link GitHub Account", github_auth_path, data: { turbo: "false" },
@ -262,9 +262,9 @@
<div class="space-y-2">
<% @user.email_addresses.each do |email| %>
<div class="flex gap-2 items-center">
<div class="flex items-center gap-2 p-2 bg-gray-800 border border-gray-600 rounded grow">
<div class="flex items-center gap-2 p-2 bg-darkless border border-darkless rounded grow">
<span class="text-gray-300 text-sm"><%= email.email %></span>
<span class="text-xs px-2 py-1 bg-gray-700 text-gray-200 rounded">
<span class="text-xs px-2 py-1 bg-dark text-secondary rounded">
<%= email.source&.humanize || "Unknown" %>
</span>
</div>
@ -280,13 +280,13 @@
<% end %>
</div>
<% else %>
<p class="text-gray-400 text-sm">No email addresses found.</p>
<p class="text-secondary text-sm">No email addresses found.</p>
<% end %>
<%= form_tag add_email_auth_path, data: { turbo: false }, class: "space-y-2" do %>
<%= email_field_tag :email, nil,
placeholder: "Add another email address",
required: true,
class: "w-full px-3 py-2 bg-gray-800 border border-gray-600 rounded text-white focus:border-primary focus:ring-1 focus:ring-primary text-sm" %>
class: "w-full px-3 py-2 bg-darkless border border-darkless rounded text-white focus:border-primary focus:ring-1 focus:ring-primary text-sm" %>
<%= submit_tag "Add Email", class: "w-full px-3 py-2 bg-primary hover:bg-primary/80 text-white text-sm font-medium rounded transition-colors duration-200 cursor-pointer" %>
<% end %>
</div>
@ -310,7 +310,7 @@
<div>
<label class="block text-sm font-medium text-gray-200 mb-2">Theme</label>
<select name="theme" id="theme-select" onchange="up1(this.value)"
class="w-full px-3 py-2 bg-gray-800 border border-gray-600 rounded text-white focus:border-primary focus:ring-1 focus:ring-primary">
class="w-full px-3 py-2 h-10 bg-darkless border border-darkless rounded text-white focus:border-primary focus:ring-1 focus:ring-primary">
<% GithubReadmeStats.themes.each do |theme| %>
<option value="<%= theme %>"><%= theme.humanize %></option>
<% end %>
@ -318,27 +318,27 @@
</div>
<% gh_badge = GithubReadmeStats.new(current_user.id, "darcula") %>
<div class="p-4 bg-gray-800 border border-gray-600 rounded">
<div class="p-4 bg-darkless border border-darkless rounded">
<img id="badge-preview" src="<%= gh_badge.generate_badge_url %>" data-url="<%= gh_badge.generate_badge_url %>" class="mb-3 rounded">
<pre id="badge-url" class="text-xs text-gray-300 bg-gray-900 p-2 rounded overflow-x-auto"><%= gh_badge.generate_badge_url %></pre>
<pre id="badge-url" class="text-xs text-white bg-darker p-2 rounded overflow-x-auto"><%= gh_badge.generate_badge_url %></pre>
</div>
</div>
</div>
<% if @projects.any? && @user.slack_uid.present? %>
<div class="border-t border-gray-700 pt-4">
<div class="border-t border-darkless pt-4">
<h3 class="text-lg font-medium text-white mb-2">Project Stats Badge</h3>
<div class="space-y-2">
<label class="block text-sm font-medium text-gray-200">Project</label>
<select name="project" id="project-select" onchange="up2(this.value)"
class="w-full px-3 py-2 bg-gray-800 border border-gray-600 rounded text-white focus:border-primary focus:ring-1 focus:ring-primary">
class="w-full px-3 py-2 h-10 bg-darkless border border-darkless rounded text-white focus:border-primary focus:ring-1 focus:ring-primary">
<% @projects.each do |project| %>
<option value="<%= h(project) %>"><%= h(project) %></option>
<% end %>
</select>
<div class="mt-3 p-4 bg-gray-800 border border-gray-600 rounded">
<div class="mt-3 p-4 bg-darkless border border-darkless rounded">
<img id="project-badge-preview" src="<%= @work_time_stats_url %>" class="mb-3 rounded">
<pre id="project-badge-url" class="text-xs text-gray-300 bg-gray-900 p-2 rounded overflow-x-auto"><%= @work_time_stats_url %></pre>
<pre id="project-badge-url" class="text-xs text-gray-300 bg-darker p-2 rounded overflow-x-auto"><%= @work_time_stats_url %></pre>
</div>
</div>
</div>
@ -376,15 +376,15 @@
</div>
<p class="text-gray-300 text-sm mb-4">Your Wakatime configuration file for tracking coding time.</p>
<div class="bg-gray-800 border border-gray-600 rounded p-4 overflow-x-auto">
<div class="bg-darkless border border-darkless rounded p-4 overflow-x-auto">
<%= render "wakatime_config_display" %>
</div>
<p class="text-xs text-gray-400 mt-2">
<p class="text-xs text-secondary mt-2">
This configuration file is automatically generated and updated when you make changes to your settings.
</p>
</div>
<div class="border-t border-gray-700 pt-6">
<div class="border-t border-darkless pt-6">
<div class="flex items-center gap-3 mb-4">
<div class="p-2 bg-primary/10 rounded">
<span class="text-2xl">🚚</span>
@ -400,7 +400,7 @@
<div class="mt-4 space-y-2">
<h3 class="text-sm font-medium text-white">Migration Status</h3>
<% @heartbeats_migration_jobs.each do |job| %>
<div class="p-2 bg-gray-800 border border-gray-600 rounded text-xs text-gray-300">
<div class="p-2 bg-darkless border border-darkless rounded text-xs text-gray-300">
Job ID: <%= job.id %> - Status: <%= job.status %>
</div>
<% end %>
@ -420,16 +420,16 @@
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div>
<div class="p-4 bg-gray-800 border border-gray-600 rounded mb-4 overflow-x-auto">
<div class="p-4 bg-darkless border border-darkless rounded mb-4 overflow-x-auto">
<pre class="text-sm text-gray-200 whitespace-pre-wrap break-all"><code>{{ wakatimeDoubleCategoryBar "💾 Languages:" wakatimeData.Languages "💼 Projects:" wakatimeData.Projects 5 }}</code></pre>
</div>
<p class="text-gray-300 text-sm mb-2">Add this to your GitHub profile README template to display your top languages and projects.</p>
<p class="text-xs text-gray-400">See the <a href="https://github.com/taciturnaxolotl/markscribe#your-wakatime-languages-formated-as-a-bar" target="_blank" class="text-primary hover:text-primary/80 underline">markscribe documentation</a> for more template options.</p>
<p class="text-xs text-secondary">See the <a href="https://github.com/taciturnaxolotl/markscribe#your-wakatime-languages-formated-as-a-bar" target="_blank" class="text-primary hover:text-primary/80 underline">markscribe documentation</a> for more template options.</p>
</div>
<div>
<img src="https://cdn.fluff.pw/slackcdn/524e293aa09bc5f9115c0c29c18fb4bc.png"
alt="Example of markscribe output showing coding language and project statistics"
class="w-full rounded border border-gray-600">
class="w-full rounded border border-darkless">
</div>
</div>
</div>
@ -464,19 +464,19 @@
<div class="space-y-3">
<h3 class="text-lg font-medium text-white">Your Data Overview</h3>
<div class="grid grid-cols-1 gap-4">
<div class="bg-gray-800 border border-gray-600 rounded p-4">
<div class="bg-darkless border border-darkless rounded p-4">
<div class="text-center">
<div class="text-2xl font-bold text-primary mb-1"><%= number_with_delimiter(@user.heartbeats.count) %></div>
<div class="text-sm text-gray-300">Total Heartbeats</div>
</div>
</div>
<div class="bg-gray-800 border border-gray-600 rounded p-4">
<div class="bg-darkless border border-darkless rounded p-4">
<div class="text-center">
<div class="text-2xl font-bold text-orange mb-1"><%= @user.heartbeats.duration_simple %></div>
<div class="text-sm text-gray-300">Total Coding Time</div>
</div>
</div>
<div class="bg-gray-800 border border-gray-600 rounded p-4">
<div class="bg-darkless border border-darkless rounded p-4">
<div class="text-center">
<div class="text-2xl font-bold text-primary mb-1"><%= @user.heartbeats.where("time >= ?", 7.days.ago.to_f).count %></div>
<div class="text-sm text-gray-300">Heartbeats in the Last 7 Days</div>
@ -488,7 +488,7 @@
<div class="space-y-4">
<h3 class="text-lg font-medium text-white">Export Options</h3>
<div class="bg-gray-800 border border-gray-600 rounded p-4">
<div class="bg-darkless border border-darkless rounded p-4">
<div class="flex items-center gap-2 mb-3">
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10" />
@ -508,7 +508,7 @@
<% end %>
<%= link_to "#",
class: "w-full bg-gray-500 hover:bg-gray-600 text-white px-4 py-2 rounded font-medium transition-colors inline-flex items-center justify-center gap-2",
class: "w-full bg-secondary hover:bg-dark text-white px-4 py-2 rounded font-medium transition-colors inline-flex items-center justify-center gap-2",
data: {
controller: "heartbeat-export",
action: "click->heartbeat-export#handleExport"
@ -520,14 +520,14 @@
<% end %>
</div>
<div class="mt-3 text-xs text-gray-400">
<div class="mt-3 text-xs text-secondary">
<p><strong>All Heartbeats:</strong> Downloads your complete coding history, from the very start to your last heartbeat</p>
<p><strong>Date Range:</strong> Choose specific dates to export</p>
</div>
</div>
<% dev_tool do %>
<div class="p-6 bg-gray-800 border border-gray-600 rounded">
<div class="p-6 bg-darkless border border-darkless rounded">
<div class="flex items-center gap-3 mb-3">
<div class="p-2 bg-green-600/10 rounded">
<svg class="w-4 h-4 text-green-400" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
@ -543,7 +543,7 @@
<label class="block text-sm font-medium text-gray-300 mb-2">Select JSON File</label>
<%= form.file_field :heartbeat_file,
accept: ".json,application/json",
class: "w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded text-white file:mr-4 file:py-2 file:px-4 file:rounded file:border-0 file:text-sm file:font-semibold file:bg-primary file:text-white hover:file:bg-red transition-colors",
class: "w-full px-3 py-2 bg-darkless border border-darkless rounded text-white file:mr-4 file:py-2 file:px-4 file:rounded file:border-0 file:text-sm file:font-semibold file:bg-primary file:text-white hover:file:bg-red transition-colors",
required: true %>
</div>
@ -573,9 +573,9 @@
<% grid_cols = current_user.wakatime_mirrors.size > 1 ? "md:grid-cols-2" : "" %>
<div class="grid grid-cols-1 <%= grid_cols %> gap-4 mb-4">
<% current_user.wakatime_mirrors.each do |mirror| %>
<div class="p-4 bg-gray-800 border border-gray-600 rounded">
<div class="p-4 bg-darkless border border-darkless rounded">
<h3 class="text-white font-medium"><%= mirror.endpoint_url %></h3>
<p class="text-gray-400 text-sm">
<p class="text-secondary text-sm">
Last synced: <%= mirror.last_synced_at ? time_ago_in_words(mirror.last_synced_at) + " ago" : "Never" %>
</p>
</div>
@ -587,11 +587,11 @@
<div class="grid grid-cols-1 gap-4">
<div>
<%= f.label :endpoint_url, class: "block text-sm font-medium text-gray-200 mb-2" %>
<%= f.url_field :endpoint_url, value: "https://wakatime.com/api/v1", class: "w-full px-3 py-2 bg-gray-800 border border-gray-600 rounded text-white focus:border-primary focus:ring-1 focus:ring-primary" %>
<%= f.url_field :endpoint_url, value: "https://wakatime.com/api/v1", class: "w-full px-3 py-2 bg-darkless border border-darkless rounded text-white focus:border-primary focus:ring-1 focus:ring-primary" %>
</div>
<div>
<%= f.label :encrypted_api_key, "WakaTime API Key", class: "block text-sm font-medium text-gray-200 mb-2" %>
<%= f.password_field :encrypted_api_key, placeholder: "Enter your WakaTime API key", class: "w-full px-3 py-2 bg-gray-800 border border-gray-600 rounded text-white focus:border-primary focus:ring-1 focus:ring-primary" %>
<%= f.password_field :encrypted_api_key, placeholder: "Enter your WakaTime API key", class: "w-full px-3 py-2 bg-darkless border border-darkless rounded text-white focus:border-primary focus:ring-1 focus:ring-primary" %>
</div>
</div>
<%= f.submit "Add Mirror", class: "px-4 py-2 bg-primary text-white font-medium rounded transition-colors duration-200" %>
@ -611,7 +611,7 @@
buttons: [
{
text: "Cancel",
class: "border border-gray-600 text-gray-300 hover:bg-darkless",
class: "border border-darkless text-gray-300 hover:bg-darkless",
action: "click->modal#close"
},
{
@ -631,7 +631,7 @@
buttons: [
{
text: "Close",
class: "border border-gray-600 text-gray-300 hover:bg-darkless",
class: "border border-darkless text-gray-300 hover:bg-darkless",
action: "click->modal#close"
},
{
@ -654,7 +654,7 @@
buttons: [
{
text: "Cancel",
class: "border border-gray-600 text-gray-300 hover:bg-darkless",
class: "border border-darkless text-gray-300 hover:bg-darkless",
action: "click->modal#close"
},
{