move front end files into repo
This commit is contained in:
11
AobaClient/src/components/main_layout.rs
Normal file
11
AobaClient/src/components/main_layout.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::{components::Navbar, Route};
|
||||
|
||||
#[component]
|
||||
pub fn MainLayout() -> Element {
|
||||
rsx! {
|
||||
Navbar {}
|
||||
Outlet::<Route> {}
|
||||
}
|
||||
}
|
||||
4
AobaClient/src/components/mod.rs
Normal file
4
AobaClient/src/components/mod.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
mod main_layout;
|
||||
mod navbar;
|
||||
pub use main_layout::MainLayout;
|
||||
pub use navbar::Navbar;
|
||||
49
AobaClient/src/components/navbar.rs
Normal file
49
AobaClient/src/components/navbar.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::Route;
|
||||
|
||||
const NAV_CSS: Asset = asset!("/assets/style/nav.scss");
|
||||
|
||||
#[component]
|
||||
pub fn Navbar() -> Element {
|
||||
rsx! {
|
||||
document::Link { rel: "stylesheet", href: NAV_CSS }
|
||||
nav {
|
||||
Branding {}
|
||||
MainNaviagation {}
|
||||
Widgets {}
|
||||
Utils {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn MainNaviagation() -> Element {
|
||||
rsx! {
|
||||
div { class: "mainNav",
|
||||
Link { class: "navItem", to: Route::Home {}, "Home" }
|
||||
Link { class: "navItem", to: Route::Settings {}, "Settings" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn Branding() -> Element {
|
||||
rsx! {
|
||||
div { class: "branding" }
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn Widgets() -> Element {
|
||||
rsx! {
|
||||
div { class: "widgets" }
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn Utils() -> Element {
|
||||
rsx! {
|
||||
div { class: "utils" }
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,29 @@
|
||||
pub mod components;
|
||||
pub mod models;
|
||||
pub mod route;
|
||||
pub mod views;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
use route::Route;
|
||||
|
||||
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
||||
const MAIN_CSS: Asset = asset!("/assets/main.css");
|
||||
const HEADER_SVG: Asset = asset!("/assets/header.svg");
|
||||
const MAIN_CSS: Asset = asset!("/assets/style/main.scss");
|
||||
|
||||
fn main() {
|
||||
dioxus::launch(App);
|
||||
dioxus::launch(App);
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn App() -> Element {
|
||||
rsx! {
|
||||
document::Link { rel: "icon", href: FAVICON }
|
||||
document::Link { rel: "stylesheet", href: MAIN_CSS }
|
||||
Hero {}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn Hero() -> Element {
|
||||
rsx! {
|
||||
div {
|
||||
id: "hero",
|
||||
img { src: HEADER_SVG, id: "header" }
|
||||
div { id: "links",
|
||||
a { href: "https://dioxuslabs.com/learn/0.6/", "📚 Learn Dioxus" }
|
||||
a { href: "https://dioxuslabs.com/awesome", "🚀 Awesome Dioxus" }
|
||||
a { href: "https://github.com/dioxus-community/", "📡 Community Libraries" }
|
||||
a { href: "https://github.com/DioxusLabs/sdk", "⚙️ Dioxus Development Kit" }
|
||||
a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus", "💫 VSCode Extension" }
|
||||
a { href: "https://discord.gg/XgGxMSkvUM", "👋 Community Discord" }
|
||||
}
|
||||
}
|
||||
}
|
||||
rsx! {
|
||||
document::Link { rel: "icon", href: FAVICON }
|
||||
document::Link { rel: "preconnect", href: "https://fonts.googleapis.com" }
|
||||
document::Link { rel: "preconnect", href: "https://fonts.gstatic.com" }
|
||||
document::Link { rel: "stylesheet", href: MAIN_CSS }
|
||||
document::Link {
|
||||
rel: "stylesheet",
|
||||
href: "https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap",
|
||||
}
|
||||
Router::<Route> {}
|
||||
}
|
||||
}
|
||||
|
||||
23
AobaClient/src/models/media.rs
Normal file
23
AobaClient/src/models/media.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub struct Media {
|
||||
pub id: String,
|
||||
pub media_id: String,
|
||||
pub filename: String,
|
||||
pub media_type: MediaType,
|
||||
pub ext: String,
|
||||
pub view_count: i32,
|
||||
pub owner: String,
|
||||
}
|
||||
#[derive(Serialize_repr, Deserialize_repr, Clone, PartialEq)]
|
||||
#[repr(i32)]
|
||||
pub enum MediaType {
|
||||
Image,
|
||||
Audio,
|
||||
Video,
|
||||
Text,
|
||||
Code,
|
||||
Raw,
|
||||
}
|
||||
1
AobaClient/src/models/mod.rs
Normal file
1
AobaClient/src/models/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod media;
|
||||
12
AobaClient/src/route.rs
Normal file
12
AobaClient/src/route.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use dioxus::prelude::*;
|
||||
use crate::views::{Home, Settings};
|
||||
use crate::components::MainLayout;
|
||||
|
||||
#[derive(Debug, Clone, Routable, PartialEq)]
|
||||
pub enum Route {
|
||||
#[layout(MainLayout)]
|
||||
#[route("/")]
|
||||
Home {},
|
||||
#[route("/settings")]
|
||||
Settings {},
|
||||
}
|
||||
17
AobaClient/src/views/home.rs
Normal file
17
AobaClient/src/views/home.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::models::media::Media;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn Home() -> Element {
|
||||
rsx! {
|
||||
div { id: "content",
|
||||
"This is home"
|
||||
}
|
||||
}
|
||||
}
|
||||
#[component]
|
||||
fn MediaDisplay(media: Media) -> Element {
|
||||
rsx! {
|
||||
div { "{media.id}" }
|
||||
}
|
||||
}
|
||||
5
AobaClient/src/views/mod.rs
Normal file
5
AobaClient/src/views/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
mod home;
|
||||
pub use home::Home;
|
||||
|
||||
mod settings;
|
||||
pub use settings::Settings;
|
||||
6
AobaClient/src/views/settings.rs
Normal file
6
AobaClient/src/views/settings.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn Settings() -> Element {
|
||||
rsx! { "this is settings" }
|
||||
}
|
||||
Reference in New Issue
Block a user