pinakes-ui: format all rsx blocks
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I21e7b73da193609c5d15b7f19d9668f96a6a6964
This commit is contained in:
parent
b4ffd56460
commit
26db7279d6
4 changed files with 128 additions and 85 deletions
|
|
@ -1407,9 +1407,29 @@ pub fn App() -> Element {
|
||||||
|
|
||||||
// Extended import state
|
// Extended import state
|
||||||
|
|
||||||
Err(e) => {
|
|
||||||
|
|
||||||
// Load tags for the media
|
// Load tags for the media
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Err(e) => {
|
||||||
|
|
||||||
|
|
||||||
show_toast(format!("Failed to load linked note: {e}"), true)
|
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| {
|
move |(path, tag_ids, new_tags, col_id): ImportEvent| {
|
||||||
let file_name = path.rsplit('/').next().unwrap_or(&path).to_string();
|
let file_name = path.rsplit('/').next().unwrap_or(&path).to_string();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if *import_in_progress.read() {
|
if *import_in_progress.read() {
|
||||||
|
|
||||||
import_queue.write().push(file_name);
|
import_queue.write().push(file_name);
|
||||||
|
|
|
||||||
|
|
@ -437,12 +437,7 @@ fn ForceDirectedGraph(
|
||||||
|
|
||||||
div { class: "control-group",
|
div { class: "control-group",
|
||||||
label { "Simulation Status" }
|
label { "Simulation Status" }
|
||||||
span {
|
span { style: if *simulation_active.read() { "color: #4ade80;" } else { "color: #94a3b8;" },
|
||||||
style: if *simulation_active.read() {
|
|
||||||
"color: #4ade80;"
|
|
||||||
} else {
|
|
||||||
"color: #94a3b8;"
|
|
||||||
},
|
|
||||||
if *simulation_active.read() {
|
if *simulation_active.read() {
|
||||||
"Running"
|
"Running"
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -500,11 +495,13 @@ fn ForceDirectedGraph(
|
||||||
if let Some(ref node_id) = *dragged_node.read() {
|
if let Some(ref node_id) = *dragged_node.read() {
|
||||||
let mut nodes = physics_nodes.write();
|
let mut nodes = physics_nodes.write();
|
||||||
if let Some(node) = nodes.iter_mut().find(|n| &n.id == node_id) {
|
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 dx = (evt.page_coordinates().x - *drag_start_x.read()) / current_zoom
|
||||||
let dy = (evt.page_coordinates().y - *drag_start_y.read()) / current_zoom * 2.0;
|
* 2.0;
|
||||||
|
// Reset velocity when dragging
|
||||||
|
let dy = (evt.page_coordinates().y - *drag_start_y.read()) / current_zoom
|
||||||
|
* 2.0;
|
||||||
node.x += dx;
|
node.x += dx;
|
||||||
node.y += dy;
|
node.y += dy;
|
||||||
// Reset velocity when dragging
|
|
||||||
node.vx = 0.0;
|
node.vx = 0.0;
|
||||||
node.vy = 0.0;
|
node.vy = 0.0;
|
||||||
drag_start_x.set(evt.page_coordinates().x);
|
drag_start_x.set(evt.page_coordinates().x);
|
||||||
|
|
@ -561,7 +558,11 @@ fn ForceDirectedGraph(
|
||||||
ref_x: "9",
|
ref_x: "9",
|
||||||
ref_y: "3.5",
|
ref_y: "3.5",
|
||||||
orient: "auto",
|
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);
|
drag_start_y.set(evt.page_coordinates().y);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
circle {
|
circle {
|
||||||
cx: "{node.x}",
|
cx: "{node.x}",
|
||||||
cy: "{node.y}",
|
cy: "{node.y}",
|
||||||
|
|
|
||||||
|
|
@ -98,14 +98,22 @@ pub fn Statistics(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if !s.media_by_type.is_empty() {
|
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! {
|
rsx! {
|
||||||
div { class: "stats-section",
|
div { class: "stats-section",
|
||||||
h4 { class: "section-title",
|
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"
|
"Media by Type"
|
||||||
}
|
}
|
||||||
div { class: "chart-bars",
|
div { class: "chart-bars",
|
||||||
|
|
@ -118,10 +126,7 @@ pub fn Statistics(
|
||||||
div { key: "{name}", class: "bar-item",
|
div { key: "{name}", class: "bar-item",
|
||||||
div { class: "bar-label", "{name}" }
|
div { class: "bar-label", "{name}" }
|
||||||
div { class: "bar-track",
|
div { class: "bar-track",
|
||||||
div {
|
div { class: "bar-fill bar-primary", style: "width: {percentage}%" }
|
||||||
class: "bar-fill bar-primary",
|
|
||||||
style: "width: {percentage}%",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
div { class: "bar-value", "{count}" }
|
div { class: "bar-value", "{count}" }
|
||||||
}
|
}
|
||||||
|
|
@ -136,12 +141,18 @@ pub fn Statistics(
|
||||||
|
|
||||||
if !s.storage_by_type.is_empty() {
|
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! {
|
rsx! {
|
||||||
div { class: "stats-section",
|
div { class: "stats-section",
|
||||||
h4 { class: "section-title",
|
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"
|
"Storage by Type"
|
||||||
}
|
}
|
||||||
div { class: "chart-bars",
|
div { class: "chart-bars",
|
||||||
|
|
@ -154,10 +165,7 @@ pub fn Statistics(
|
||||||
div { key: "{name}", class: "bar-item",
|
div { key: "{name}", class: "bar-item",
|
||||||
div { class: "bar-label", "{name}" }
|
div { class: "bar-label", "{name}" }
|
||||||
div { class: "bar-track",
|
div { class: "bar-track",
|
||||||
div {
|
div { class: "bar-fill bar-success", style: "width: {percentage}%" }
|
||||||
class: "bar-fill bar-success",
|
|
||||||
style: "width: {percentage}%",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
div { class: "bar-value", "{size_str}" }
|
div { class: "bar-value", "{size_str}" }
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +181,12 @@ pub fn Statistics(
|
||||||
if !s.top_tags.is_empty() {
|
if !s.top_tags.is_empty() {
|
||||||
div { class: "stats-section",
|
div { class: "stats-section",
|
||||||
h4 { class: "section-title",
|
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"
|
"Top Tags"
|
||||||
}
|
}
|
||||||
div { class: "tag-list",
|
div { class: "tag-list",
|
||||||
|
|
@ -190,13 +203,23 @@ pub fn Statistics(
|
||||||
if !s.top_collections.is_empty() {
|
if !s.top_collections.is_empty() {
|
||||||
div { class: "stats-section",
|
div { class: "stats-section",
|
||||||
h4 { class: "section-title",
|
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"
|
"Top Collections"
|
||||||
}
|
}
|
||||||
div { class: "collection-list",
|
div { class: "collection-list",
|
||||||
for item in s.top_collections.iter() {
|
for item in s.top_collections.iter() {
|
||||||
div { class: "collection-item",
|
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-name", "{item.name}" }
|
||||||
span { class: "collection-count", "{item.count}" }
|
span { class: "collection-count", "{item.count}" }
|
||||||
}
|
}
|
||||||
|
|
@ -207,7 +230,12 @@ pub fn Statistics(
|
||||||
|
|
||||||
div { class: "stats-section",
|
div { class: "stats-section",
|
||||||
h4 { class: "section-title",
|
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"
|
"Date Range"
|
||||||
}
|
}
|
||||||
div { class: "date-range",
|
div { class: "date-range",
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ pub fn Tasks(
|
||||||
Icon { icon: FaCalendar, width: 48, height: 48 }
|
Icon { icon: FaCalendar, width: 48, height: 48 }
|
||||||
}
|
}
|
||||||
p { "No scheduled tasks configured." }
|
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 {
|
} else {
|
||||||
div { class: "tasks-grid",
|
div { class: "tasks-grid",
|
||||||
|
|
@ -53,17 +55,26 @@ pub fn Tasks(
|
||||||
let task_id_toggle = task.id.clone();
|
let task_id_toggle = task.id.clone();
|
||||||
let task_id_run = task.id.clone();
|
let task_id_run = task.id.clone();
|
||||||
let last_run = task.last_run.clone().unwrap_or_else(|| "Never".to_string());
|
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 next_run = task
|
||||||
let last_status = task.last_status.clone().unwrap_or_else(|| "No runs yet".to_string());
|
|
||||||
|
// 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 is_enabled = task.enabled;
|
||||||
let task_name = task.name.clone();
|
let task_name = task.name.clone();
|
||||||
let schedule = task.schedule.clone();
|
let schedule = task.schedule.clone();
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div { class: if is_enabled { "task-card task-card-enabled" } else { "task-card task-card-disabled" },
|
||||||
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-card-header",
|
||||||
div { class: "task-header-left",
|
div { class: "task-header-left",
|
||||||
div { class: "task-name", "{task_name}" }
|
div { class: "task-name", "{task_name}" }
|
||||||
|
|
@ -89,7 +100,6 @@ pub fn Tasks(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task info grid
|
|
||||||
div { class: "task-info-grid",
|
div { class: "task-info-grid",
|
||||||
div { class: "task-info-item",
|
div { class: "task-info-item",
|
||||||
div { class: "task-info-icon",
|
div { class: "task-info-icon",
|
||||||
|
|
@ -120,7 +130,6 @@ pub fn Tasks(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
|
||||||
div { class: "task-card-actions",
|
div { class: "task-card-actions",
|
||||||
button {
|
button {
|
||||||
class: if is_enabled { "btn btn-sm btn-secondary" } else { "btn btn-sm btn-primary" },
|
class: if is_enabled { "btn btn-sm btn-secondary" } else { "btn btn-sm btn-primary" },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue