pinakes-ui: format all rsx blocks

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I21e7b73da193609c5d15b7f19d9668f96a6a6964
This commit is contained in:
raf 2026-02-10 12:51:53 +03:00
commit 26db7279d6
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
4 changed files with 128 additions and 85 deletions

View file

@ -1372,44 +1372,64 @@ pub fn App() -> Element {
selected_media.set(Some(media));
auto_play_media.set(false);
}
// Extract file name from path
// Extract file name from path
// Check if already importing - if so, add to queue
// Extract directory name from path
// Check if already importing - if so, add to queue
// Get preview files if available for per-file progress
// Use parallel import with per-batch progress
// Show first file in batch as current
// Process batch in parallel
// Update progress after batch
// Fallback: use server-side directory import (no per-file progress)
// Check if already importing - if so, add to queue
// Update progress from scan status
// Check if already importing - if so, add to queue
// Process files in parallel batches for better performance
// Show first file in batch as current
// Process batch in parallel
// Update progress after batch
// Extended import state
// Load tags for the media
// Check if already importing - if so, add to queue
// Extract directory name from path
// Check if already importing - if so, add to queue
// Get preview files if available for per-file progress
// Use parallel import with per-batch progress
// Show first file in batch as current
// Process batch in parallel
// Update progress after batch
// Fallback: use server-side directory import (no per-file progress)
// Check if already importing - if so, add to queue
// Update progress from scan status
// Check if already importing - if so, add to queue
// Process files in parallel batches for better performance
// Show first file in batch as current
// Process batch in parallel
// Update progress after batch
// Extended import state
Err(e) => {
// Load tags for the media
show_toast(format!("Failed to load linked note: {e}"), true)
}
}
@ -1646,22 +1666,6 @@ pub fn App() -> Element {
move |(path, tag_ids, new_tags, col_id): ImportEvent| {
let file_name = path.rsplit('/').next().unwrap_or(&path).to_string();
if *import_in_progress.read() {
import_queue.write().push(file_name);

View file

@ -437,12 +437,7 @@ fn ForceDirectedGraph(
div { class: "control-group",
label { "Simulation Status" }
span {
style: if *simulation_active.read() {
"color: #4ade80;"
} else {
"color: #94a3b8;"
},
span { style: if *simulation_active.read() { "color: #4ade80;" } else { "color: #94a3b8;" },
if *simulation_active.read() {
"Running"
} else {
@ -500,11 +495,13 @@ fn ForceDirectedGraph(
if let Some(ref node_id) = *dragged_node.read() {
let mut nodes = physics_nodes.write();
if let Some(node) = nodes.iter_mut().find(|n| &n.id == node_id) {
let dx = (evt.page_coordinates().x - *drag_start_x.read()) / current_zoom * 2.0;
let dy = (evt.page_coordinates().y - *drag_start_y.read()) / current_zoom * 2.0;
let dx = (evt.page_coordinates().x - *drag_start_x.read()) / current_zoom
* 2.0;
// Reset velocity when dragging
let dy = (evt.page_coordinates().y - *drag_start_y.read()) / current_zoom
* 2.0;
node.x += dx;
node.y += dy;
// Reset velocity when dragging
node.vx = 0.0;
node.vy = 0.0;
drag_start_x.set(evt.page_coordinates().x);
@ -561,7 +558,11 @@ fn ForceDirectedGraph(
ref_x: "9",
ref_y: "3.5",
orient: "auto",
polygon { points: "0 0, 10 3.5, 0 7", fill: "#666", fill_opacity: "0.6" }
polygon {
points: "0 0, 10 3.5, 0 7",
fill: "#666",
fill_opacity: "0.6",
}
}
}
@ -599,6 +600,7 @@ fn ForceDirectedGraph(
drag_start_y.set(evt.page_coordinates().y);
},
circle {
cx: "{node.x}",
cy: "{node.y}",

View file

@ -98,32 +98,38 @@ pub fn Statistics(
}
}
if !s.media_by_type.is_empty() {
{
let max_count = s.media_by_type.iter().map(|i| i.count).max().unwrap_or(1) as f64;
let max_count = s.media_by_type.iter().map(|i| i.count).max().unwrap_or(1)
as f64;
rsx! {
div { class: "stats-section",
h4 { class: "section-title",
Icon { icon: FaChartBar, width: 16, height: 16, style: "margin-right: 8px; vertical-align: middle;" }
Icon {
icon: FaChartBar,
width: 16,
height: 16,
style: "margin-right: 8px; vertical-align: middle;",
}
"Media by Type"
}
div { class: "chart-bars",
for item in s.media_by_type.iter() {
{
let percentage = (item.count as f64 / max_count) * 100.0;
let name = item.name.clone();
let count = item.count;
rsx! {
div { key: "{name}", class: "bar-item",
div { class: "bar-label", "{name}" }
div { class: "bar-track",
div {
class: "bar-fill bar-primary",
style: "width: {percentage}%",
{
let percentage = (item.count as f64 / max_count) * 100.0;
let name = item.name.clone();
let count = item.count;
rsx! {
div { key: "{name}", class: "bar-item",
div { class: "bar-label", "{name}" }
div { class: "bar-track",
div { class: "bar-fill bar-primary", style: "width: {percentage}%" }
}
div { class: "bar-value", "{count}" }
}
div { class: "bar-value", "{count}" }
}
}
}
@ -131,17 +137,22 @@ pub fn Statistics(
}
}
}
}
}
if !s.storage_by_type.is_empty() {
{
let max_size = s.storage_by_type.iter().map(|i| i.count).max().unwrap_or(1) as f64;
let max_size = s.storage_by_type.iter().map(|i| i.count).max().unwrap_or(1)
as f64;
rsx! {
div { class: "stats-section",
h4 { class: "section-title",
Icon { icon: FaDatabase, width: 16, height: 16, style: "margin-right: 8px; vertical-align: middle;" }
Icon {
icon: FaDatabase,
width: 16,
height: 16,
style: "margin-right: 8px; vertical-align: middle;",
}
"Storage by Type"
}
div { class: "chart-bars",
@ -154,10 +165,7 @@ pub fn Statistics(
div { key: "{name}", class: "bar-item",
div { class: "bar-label", "{name}" }
div { class: "bar-track",
div {
class: "bar-fill bar-success",
style: "width: {percentage}%",
}
div { class: "bar-fill bar-success", style: "width: {percentage}%" }
}
div { class: "bar-value", "{size_str}" }
}
@ -173,7 +181,12 @@ pub fn Statistics(
if !s.top_tags.is_empty() {
div { class: "stats-section",
h4 { class: "section-title",
Icon { icon: FaTags, width: 16, height: 16, style: "margin-right: 8px; vertical-align: middle;" }
Icon {
icon: FaTags,
width: 16,
height: 16,
style: "margin-right: 8px; vertical-align: middle;",
}
"Top Tags"
}
div { class: "tag-list",
@ -190,13 +203,23 @@ pub fn Statistics(
if !s.top_collections.is_empty() {
div { class: "stats-section",
h4 { class: "section-title",
Icon { icon: FaCircle, width: 16, height: 16, style: "margin-right: 8px; vertical-align: middle;" }
Icon {
icon: FaCircle,
width: 16,
height: 16,
style: "margin-right: 8px; vertical-align: middle;",
}
"Top Collections"
}
div { class: "collection-list",
for item in s.top_collections.iter() {
div { class: "collection-item",
Icon { icon: FaFolder, width: 16, height: 16, class: "collection-icon" }
Icon {
icon: FaFolder,
width: 16,
height: 16,
class: "collection-icon",
}
span { class: "collection-name", "{item.name}" }
span { class: "collection-count", "{item.count}" }
}
@ -207,7 +230,12 @@ pub fn Statistics(
div { class: "stats-section",
h4 { class: "section-title",
Icon { icon: FaClock, width: 16, height: 16, style: "margin-right: 8px; vertical-align: middle;" }
Icon {
icon: FaClock,
width: 16,
height: 16,
style: "margin-right: 8px; vertical-align: middle;",
}
"Date Range"
}
div { class: "date-range",

View file

@ -44,7 +44,9 @@ pub fn Tasks(
Icon { icon: FaCalendar, width: 48, height: 48 }
}
p { "No scheduled tasks configured." }
p { class: "text-muted", "Tasks will appear here once configured on the server." }
p { class: "text-muted",
"Tasks will appear here once configured on the server."
}
}
} else {
div { class: "tasks-grid",
@ -53,26 +55,35 @@ pub fn Tasks(
let task_id_toggle = task.id.clone();
let task_id_run = task.id.clone();
let last_run = task.last_run.clone().unwrap_or_else(|| "Never".to_string());
let next_run = task.next_run.clone().unwrap_or_else(|| "Not scheduled".to_string());
let last_status = task.last_status.clone().unwrap_or_else(|| "No runs yet".to_string());
let next_run = task
// Header with status and actions
// Task info grid
// Actions
.next_run
.clone()
.unwrap_or_else(|| "Not scheduled".to_string());
let last_status = task
.last_status
.clone()
.unwrap_or_else(|| "No runs yet".to_string());
let is_enabled = task.enabled;
let task_name = task.name.clone();
let schedule = task.schedule.clone();
rsx! {
div {
class: if is_enabled { "task-card task-card-enabled" } else { "task-card task-card-disabled" },
div { class: if is_enabled { "task-card task-card-enabled" } else { "task-card task-card-disabled" },
// Header with status and actions
div { class: "task-card-header",
div { class: "task-header-left",
div { class: "task-name", "{task_name}" }
div { class: "task-schedule",
span { class: "schedule-icon",
Icon { icon: FaClock, width: 14, height: 14 }
div { class: "task-name", "{task_name}" }
div { class: "task-schedule",
span { class: "schedule-icon",
Icon { icon: FaClock, width: 14, height: 14 }
}
"{schedule}"
}
"{schedule}"
}
}
div { class: "task-status-badge",
if is_enabled {
@ -89,7 +100,6 @@ pub fn Tasks(
}
}
// Task info grid
div { class: "task-info-grid",
div { class: "task-info-item",
div { class: "task-info-icon",
@ -120,7 +130,6 @@ pub fn Tasks(
}
}
// Actions
div { class: "task-card-actions",
button {
class: if is_enabled { "btn btn-sm btn-secondary" } else { "btn btn-sm btn-primary" },