[refactor] Remove UI components and associated assets

This commit is contained in:
2025-08-21 18:19:39 +02:00
parent ffbf5e6aa3
commit 68311051ba
47 changed files with 348 additions and 1432 deletions

View File

@@ -1,13 +0,0 @@
[package]
name = "mobile"
version = "0.1.0"
edition = "2021"
[dependencies]
dioxus = { workspace = true, features = ["router"] }
ui = { workspace = true }
[features]
default = []
mobile = ["dioxus/mobile"]
server = ["dioxus/server"]

View File

@@ -1,30 +0,0 @@
# Development
The mobile crate defines the entrypoint for the mobile app along with any assets, components and dependencies that are specific to mobile builds. The mobile crate starts out something like this:
```
mobile/
├─ assets/ # Assets used by the mobile app - Any platform specific assets should go in this folder
├─ src/
│ ├─ main.rs # The entrypoint for the mobile app.It also defines the routes for the mobile platform
│ ├─ views/ # The views each route will render in the mobile version of the app
│ │ ├─ mod.rs # Defines the module for the views route and re-exports the components for each route
│ │ ├─ blog.rs # The component that will render at the /blog/:id route
│ │ ├─ home.rs # The component that will render at the / route
├─ Cargo.toml # The mobile crate's Cargo.toml - This should include all mobile specific dependencies
```
## Dependencies
Since you have fullstack enabled, the mobile crate will be built two times:
1. Once for the server build with the `server` feature enabled
2. Once for the client build with the `mobile` feature enabled
You should make all mobile specific dependencies optional and only enabled in the `mobile` feature. This will ensure that the server builds don't pull in mobile specific dependencies which cuts down on build times significantly.
### Serving Your Mobile App
Mobile platforms are shared in a single crate. To serve mobile, you need to explicitly set your target device to `android` or `ios`:
```bash
dx serve --platform android
```

View File

@@ -1,8 +0,0 @@
#blog {
margin-top: 50px;
}
#blog a {
color: #ffffff;
margin-top: 50px;
}

View File

@@ -1,6 +0,0 @@
body {
background-color: #0f1116;
color: #ffffff;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 20px;
}

View File

@@ -1,54 +0,0 @@
use dioxus::prelude::*;
use ui::Navbar;
use views::{Blog, Home};
mod views;
#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
enum Route {
#[layout(MobileNavbar)]
#[route("/")]
Home {},
#[route("/blog/:id")]
Blog { id: i32 },
}
const MAIN_CSS: Asset = asset!("/assets/main.css");
fn main() {
dioxus::launch(App);
}
#[component]
fn App() -> Element {
// Build cool things ✌️
rsx! {
// Global app resources
document::Link { rel: "stylesheet", href: MAIN_CSS }
Router::<Route> {}
}
}
/// A mobile-specific Router around the shared `Navbar` component
/// which allows us to use the mobile-specific `Route` enum.
#[component]
fn MobileNavbar() -> Element {
rsx! {
Navbar {
Link {
to: Route::Home {},
"Home"
}
Link {
to: Route::Blog { id: 1 },
"Blog"
}
}
Outlet::<Route> {}
}
}

View File

@@ -1,30 +0,0 @@
use crate::Route;
use dioxus::prelude::*;
const BLOG_CSS: Asset = asset!("/assets/blog.css");
#[component]
pub fn Blog(id: i32) -> Element {
rsx! {
document::Link { rel: "stylesheet", href: BLOG_CSS}
div {
id: "blog",
// Content
h1 { "This is blog #{id}!" }
p { "In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components." }
// Navigation links
Link {
to: Route::Blog { id: id - 1 },
"Previous"
}
span { " <---> " }
Link {
to: Route::Blog { id: id + 1 },
"Next"
}
}
}
}

View File

@@ -1,10 +0,0 @@
use dioxus::prelude::*;
use ui::{Echo, Hero};
#[component]
pub fn Home() -> Element {
rsx! {
Hero {}
Echo {}
}
}

View File

@@ -1,5 +0,0 @@
mod home;
pub use home::Home;
mod blog;
pub use blog::Blog;