OneLauncher-Cracked/packages/oneclient_app/src/components/spinner.rs
Maciek 0ab544f265
feat: custom cluster instances (#859)
* feat: added adding new instances of a cluster with 'start from scratch' option enabling user to create a vanilla/modded cluster; fixed couple pre-existing bugs that wouldn't let other loaders boot up

* feat: fully implemented cluster creation modal design

* chore: refactoring

* feat: expanded the tags section on customization step; found that fabric doesnt work with 1.8.9

* feat: added gallery covers handling for new cluster instances

* feat: added 'redirecting' from fabric to orinthe on versions pre-1.14

* feat: added java-version-override

* feat: added loader types migrations (right now they dont migrate mods because there are no bundles)

* chore: wider loader dropdown for multiloader cluster (if it will be used in the future)

* chore: fixed more issues with isolated and shared dir, with migrations and instances naming

* chore: refactor; taken the loader version dropdown from version picker view back to loader selector

* chore: deleted Quilt from UI

---------

Co-authored-by: LynithDev <61880709+LynithDev@users.noreply.github.com>
2026-09-29 19:08:21 +02:00

53 lines
1.2 KiB
Rust

use freya::animation::{AnimNum, Function, OnCreation, OnFinish, use_animation};
use freya::prelude::*;
use super::{Icon, IconType};
use crate::theme::colors;
const SPIN_TIME: u64 = 900;
#[derive(PartialEq)]
pub struct Spinner {
size: f32,
}
impl Spinner {
pub fn new(size: f32) -> Self {
Self { size }
}
}
impl Component for Spinner {
fn render(&self) -> impl IntoElement {
let spin = use_animation(|conf| {
conf.on_creation(OnCreation::Run);
conf.on_finish(OnFinish::restart());
AnimNum::new(0., 360.)
.time(SPIN_TIME)
.function(Function::Linear)
});
rect().rotate(spin.get().value()).child(
Icon::new(IconType::Loading02)
.size(self.size)
.color(colors::fg_secondary()),
)
}
}
pub fn centered_spinner(message: &str) -> Element {
rect()
.vertical()
.width(Size::fill())
.height(Size::fill())
.center()
.spacing(12.)
.child(Spinner::new(22.))
.child(
label()
.text(message.to_string())
.font_size(13.)
.color(colors::fg_secondary()),
)
.into_element()
}