mirror of
https://github.com/System-End/hackatime-desktop.git
synced 2026-04-19 16:28:19 +00:00
fix: correct card alignment issues
This commit is contained in:
parent
145b3b9422
commit
59008e3849
3 changed files with 49 additions and 58 deletions
|
|
@ -45,15 +45,32 @@ fn get_expected_config_content(api_key: &str, api_url: &str) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
fn normalize_config_content(content: &str) -> String {
|
||||
fn check_config_has_required_values(content: &str, api_key: &str, api_url: &str) -> bool {
|
||||
let normalized = content.replace("\r\n", "\n");
|
||||
let mut found_api_url = false;
|
||||
let mut found_api_key = false;
|
||||
|
||||
content
|
||||
.replace("\r\n", "\n")
|
||||
.lines()
|
||||
.map(|line| line.trim())
|
||||
.filter(|line| !line.is_empty())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
for line in normalized.lines() {
|
||||
let trimmed = line.trim();
|
||||
|
||||
if trimmed.starts_with("api_url") {
|
||||
if let Some(value) = trimmed.split('=').nth(1) {
|
||||
let value = value.trim();
|
||||
if value == api_url {
|
||||
found_api_url = true;
|
||||
}
|
||||
}
|
||||
} else if trimmed.starts_with("api_key") {
|
||||
if let Some(value) = trimmed.split('=').nth(1) {
|
||||
let value = value.trim();
|
||||
if value == api_key {
|
||||
found_api_key = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
found_api_url && found_api_key
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
|
@ -72,7 +89,7 @@ pub async fn check_wakatime_config(api_key: String, api_url: String) -> Result<W
|
|||
};
|
||||
|
||||
let matches = if let Some(ref actual) = actual_content {
|
||||
normalize_config_content(actual) == normalize_config_content(&expected_content)
|
||||
check_config_has_required_values(actual, &api_key, &api_url)
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
|
@ -136,23 +153,8 @@ pub async fn setup_hackatime_macos_linux(api_key: String, api_url: String) -> Re
|
|||
let config_content = fs::read_to_string(&config_path)
|
||||
.map_err(|e| format!("Failed to read config file: {}", e))?;
|
||||
|
||||
let lines: Vec<&str> = config_content.lines().collect();
|
||||
let mut found_api_url = false;
|
||||
let mut found_api_key = false;
|
||||
let mut found_heartbeat_rate = false;
|
||||
|
||||
for line in lines {
|
||||
if line.starts_with("api_url =") {
|
||||
found_api_url = true;
|
||||
} else if line.starts_with("api_key =") {
|
||||
found_api_key = true;
|
||||
} else if line.starts_with("heartbeat_rate_limit_seconds =") {
|
||||
found_heartbeat_rate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if !found_api_url || !found_api_key || !found_heartbeat_rate {
|
||||
return Err("Config file is missing required fields".to_string());
|
||||
if !check_config_has_required_values(&config_content, &api_key, &api_url) {
|
||||
return Err("Config file is missing required api_url and api_key values".to_string());
|
||||
}
|
||||
|
||||
Ok(format!(
|
||||
|
|
@ -191,23 +193,8 @@ pub async fn setup_hackatime_windows(api_key: String, api_url: String) -> Result
|
|||
let config_content = fs::read_to_string(&config_path)
|
||||
.map_err(|e| format!("Failed to read config file: {}", e))?;
|
||||
|
||||
let lines: Vec<&str> = config_content.lines().collect();
|
||||
let mut found_api_url = false;
|
||||
let mut found_api_key = false;
|
||||
let mut found_heartbeat_rate = false;
|
||||
|
||||
for line in lines {
|
||||
if line.starts_with("api_url =") {
|
||||
found_api_url = true;
|
||||
} else if line.starts_with("api_key =") {
|
||||
found_api_key = true;
|
||||
} else if line.starts_with("heartbeat_rate_limit_seconds =") {
|
||||
found_heartbeat_rate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if !found_api_url || !found_api_key || !found_heartbeat_rate {
|
||||
return Err("Config file is missing required fields".to_string());
|
||||
if !check_config_has_required_values(&config_content, &api_key, &api_url) {
|
||||
return Err("Config file is missing required api_url and api_key values".to_string());
|
||||
}
|
||||
|
||||
Ok(format!(
|
||||
|
|
|
|||
22
src/App.vue
22
src/App.vue
|
|
@ -761,17 +761,21 @@ async function handleInstallNow() {
|
|||
<div v-if="authState.is_authenticated && userStats" class="w-64 min-w-64 flex flex-col responsive-full-width">
|
||||
<div class="card-3d-app h-full">
|
||||
<div class="rounded-[8px] border border-black p-4 card-3d-app-front h-full flex flex-col" style="background-color: #3D2C3E;">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="text-white text-[16px] font-bold italic m-0" style="font-family: 'Outfit', sans-serif;">
|
||||
leaderboard
|
||||
</h2>
|
||||
<div class="flex gap-2 text-[10px]" style="font-family: 'Outfit', sans-serif;">
|
||||
<span class="text-white underline cursor-pointer">friends</span>
|
||||
<span class="text-white cursor-pointer">global</span>
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="text-white text-[16px] font-bold italic m-0" style="font-family: 'Outfit', sans-serif;">
|
||||
leaderboard
|
||||
</h2>
|
||||
<div class="flex gap-2 text-[10px]" style="font-family: 'Outfit', sans-serif;">
|
||||
<span class="text-white underline cursor-pointer">friends</span>
|
||||
<span class="text-white cursor-pointer">global</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-center h-full">
|
||||
<p class="text-white text-[18px] font-semibold opacity-60" style="font-family: 'Outfit', sans-serif;">
|
||||
Coming Soon...
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Leaderboard content would go here -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div class="card-3d">
|
||||
<div class="rounded-[8px] border border-black p-6 card-3d-front h-full flex flex-col" style="background-color: #3D2C3E;">
|
||||
<div class="flex items-start space-x-4 flex-1">
|
||||
<div class="text-3xl">{{ icon }}</div>
|
||||
<div class="flex-1 flex flex-col">
|
||||
<div class="flex items-start space-x-4">
|
||||
<div class="text-3xl flex-shrink-0">{{ icon }}</div>
|
||||
<div class="flex-1 flex flex-col min-w-0">
|
||||
<h3 class="text-lg font-semibold text-text-primary mb-2">{{ title }}</h3>
|
||||
<p class="text-text-secondary mb-3 flex-1">{{ description }}</p>
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="text-2xl font-bold" :style="{ color: color }">{{ value }}</div>
|
||||
<p class="text-text-secondary mb-4 text-sm line-clamp-2">{{ description }}</p>
|
||||
<div class="mt-auto">
|
||||
<div class="text-2xl font-bold mb-1" :style="{ color: color }">{{ value }}</div>
|
||||
<div class="text-sm text-text-secondary">{{ trend }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue