* feat: added worlds and datapacks tab * feat: added datapacks in browser; fixed datapacks view loading too long * feat: added icons to datapacks * fix: scope world query invalidation to the world that changed * fix: keep the selected data pack world in one place and guard deletes * chore: share one dialog shell between the world prompt and delete confirm * fix: stop watching every subfolder of saves --------- Co-authored-by: LynithDev <61880709+LynithDev@users.noreply.github.com>
181 lines
7.8 KiB
Rust
181 lines
7.8 KiB
Rust
use freya::prelude::*;
|
|
use freya::router::*;
|
|
|
|
use crate::layout::AppShell;
|
|
use crate::layout::ClusterShell;
|
|
use crate::layout::OnboardingShell;
|
|
use crate::layout::RootLayout;
|
|
use crate::layout::SettingsShell;
|
|
|
|
use crate::view::{
|
|
NotFound, Relocating, Startup,
|
|
app::{
|
|
AccountSkins, Clusters, Debug, Home, Stats,
|
|
browser::{Browser, BrowserPackage},
|
|
cluster::{
|
|
ClusterDataPacks, ClusterLogs, ClusterMods, ClusterOverview, ClusterScreenshots,
|
|
ClusterSettings, ClusterShaders, ClusterTextures, ClusterWorlds, ProcessLogs,
|
|
},
|
|
settings::{
|
|
SettingsAccounts, SettingsApis, SettingsAppearance, SettingsChangelog,
|
|
SettingsDeveloper, SettingsJava, SettingsLanguage, SettingsLauncher, SettingsMinecraft,
|
|
SettingsStorage,
|
|
},
|
|
},
|
|
onboarding::{
|
|
OnboardingAccount, OnboardingBundles, OnboardingLanguage, OnboardingLocation,
|
|
OnboardingMigration, OnboardingPreferences, OnboardingSummary, OnboardingTerms,
|
|
OnboardingWelcome,
|
|
},
|
|
};
|
|
|
|
#[derive(Routable, Debug, Clone, PartialEq)]
|
|
#[rustfmt::skip]
|
|
pub enum Route {
|
|
#[layout(RootLayout)]
|
|
#[route("/")]
|
|
Startup {},
|
|
#[route("/moving")]
|
|
Relocating {},
|
|
|
|
#[layout(OnboardingShell)]
|
|
#[route("/onboarding")]
|
|
OnboardingWelcome {},
|
|
#[route("/onboarding/location")]
|
|
OnboardingLocation {},
|
|
#[route("/onboarding/terms")]
|
|
OnboardingTerms {},
|
|
#[route("/onboarding/migration")]
|
|
OnboardingMigration {},
|
|
#[route("/onboarding/language")]
|
|
OnboardingLanguage {},
|
|
#[route("/onboarding/account")]
|
|
OnboardingAccount {},
|
|
#[route("/onboarding/preferences")]
|
|
OnboardingPreferences {},
|
|
#[route("/onboarding/bundles")]
|
|
OnboardingBundles {},
|
|
#[route("/onboarding/summary")]
|
|
OnboardingSummary {},
|
|
#[end_layout]
|
|
|
|
#[layout(AppShell)]
|
|
#[route("/app")]
|
|
Home {},
|
|
#[route("/app/clusters")]
|
|
Clusters {},
|
|
|
|
#[layout(ClusterShell)]
|
|
#[route("/app/clusters/:cluster_id")]
|
|
ClusterOverview { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/logs")]
|
|
ClusterLogs { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/process")]
|
|
ProcessLogs { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/screenshots")]
|
|
ClusterScreenshots { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/mods")]
|
|
ClusterMods { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/shaders")]
|
|
ClusterShaders { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/textures")]
|
|
ClusterTextures { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/worlds")]
|
|
ClusterWorlds { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/datapacks")]
|
|
ClusterDataPacks { cluster_id: i64 },
|
|
#[route("/app/clusters/:cluster_id/settings")]
|
|
ClusterSettings { cluster_id: i64 },
|
|
#[end_layout]
|
|
|
|
#[route("/app/browser/:cluster_id/:package_type?:pick_cluster")]
|
|
Browser { cluster_id: i64, package_type: String, pick_cluster: bool },
|
|
#[route("/app/browser/:cluster_id/:package_type/package/:package_id")]
|
|
BrowserPackage { cluster_id: i64, package_type: String, package_id: String },
|
|
#[route("/app/account/skins")]
|
|
AccountSkins {},
|
|
#[route("/app/stats")]
|
|
Stats {},
|
|
#[route("/app/debug")]
|
|
Debug {},
|
|
|
|
#[layout(SettingsShell)]
|
|
#[route("/app/settings/appearance")]
|
|
SettingsAppearance {},
|
|
#[route("/app/settings/minecraft")]
|
|
SettingsMinecraft {},
|
|
#[route("/app/settings/accounts")]
|
|
SettingsAccounts {},
|
|
#[route("/app/settings/launcher")]
|
|
SettingsLauncher {},
|
|
#[route("/app/settings/java")]
|
|
SettingsJava {},
|
|
#[route("/app/settings/storage")]
|
|
SettingsStorage {},
|
|
#[route("/app/settings/apis")]
|
|
SettingsApis {},
|
|
#[route("/app/settings/language")]
|
|
SettingsLanguage {},
|
|
#[route("/app/settings/developer")]
|
|
SettingsDeveloper {},
|
|
#[route("/app/settings/changelog")]
|
|
SettingsChangelog {},
|
|
// #[route("/app/settings/feedback")]
|
|
// SettingsFeedback {},
|
|
#[end_layout]
|
|
#[end_layout]
|
|
|
|
#[route("/:..path")]
|
|
NotFound { path: Vec<String> },
|
|
}
|
|
|
|
impl Route {
|
|
pub fn title(&self) -> String {
|
|
match self {
|
|
Route::Startup { .. } => "Startup".to_string(),
|
|
Route::Relocating { .. } => "Moving".to_string(),
|
|
Route::OnboardingWelcome { .. } => "Welcome".to_string(),
|
|
Route::OnboardingLocation { .. } => "Folder".to_string(),
|
|
Route::OnboardingTerms { .. } => "Terms & Privacy".to_string(),
|
|
Route::OnboardingMigration { .. } => "Migration".to_string(),
|
|
Route::OnboardingLanguage { .. } => "Language".to_string(),
|
|
Route::OnboardingAccount { .. } => "Account".to_string(),
|
|
Route::OnboardingPreferences { .. } => "Accessibility".to_string(),
|
|
Route::OnboardingBundles { .. } => "Mods".to_string(),
|
|
Route::OnboardingSummary { .. } => "Summary".to_string(),
|
|
Route::Home { .. } => "Home".to_string(),
|
|
Route::Clusters { .. } => "Versions".to_string(),
|
|
Route::ClusterOverview { .. } => "Cluster".to_string(),
|
|
Route::ClusterLogs { .. } => "Cluster Logs".to_string(),
|
|
Route::ProcessLogs { .. } => "Process".to_string(),
|
|
Route::ClusterScreenshots { .. } => "Cluster Screenshots".to_string(),
|
|
Route::ClusterMods { .. } => "Cluster Mods".to_string(),
|
|
Route::ClusterShaders { .. } => "Cluster Shaders".to_string(),
|
|
Route::ClusterTextures { .. } => "Cluster Textures".to_string(),
|
|
Route::ClusterWorlds { .. } => "Cluster Worlds".to_string(),
|
|
Route::ClusterDataPacks { .. } => "Cluster Data Packs".to_string(),
|
|
Route::ClusterSettings { .. } => "Cluster Settings".to_string(),
|
|
Route::Browser { .. } => "Browser".to_string(),
|
|
Route::BrowserPackage { .. } => "Browser".to_string(),
|
|
Route::AccountSkins { .. } => "Skins".to_string(),
|
|
Route::Stats { .. } => "Statistics".to_string(),
|
|
Route::Debug { .. } => "Debug".to_string(),
|
|
Route::SettingsAppearance { .. } => "Settings".to_string(),
|
|
Route::SettingsMinecraft { .. } => "Minecraft Settings".to_string(),
|
|
Route::SettingsAccounts { .. } => "Accounts".to_string(),
|
|
Route::SettingsLauncher { .. } => "Launcher Settings".to_string(),
|
|
Route::SettingsJava { .. } => "Java".to_string(),
|
|
Route::SettingsStorage { .. } => "Storage".to_string(),
|
|
Route::SettingsApis { .. } => "APIs".to_string(),
|
|
Route::SettingsLanguage { .. } => "Language".to_string(),
|
|
Route::SettingsDeveloper { .. } => "Developer Options".to_string(),
|
|
Route::SettingsChangelog { .. } => "Changelog".to_string(),
|
|
// Route::SettingsFeedback { .. } => "Feedback".to_string(),
|
|
Route::NotFound { .. } => "Not Found".to_string(),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn router() -> impl IntoElement {
|
|
Router::<Route>::new(|| RouterConfig::default().with_initial_path(Route::Startup {}))
|
|
}
|