feat: initial commit
This commit is contained in:
commit
4fd2d85c97
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
/target
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
5768
Cargo.lock
generated
Normal file
5768
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
Cargo.toml
Normal file
29
Cargo.toml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[package]
|
||||||
|
name = "upcomming"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Alex Wellnitz <moin@wellnitz-alex.de>"]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
dioxus = { version = "0.6.0", features = ["router", "fullstack"] }
|
||||||
|
reqwest = { version = "0.12.15" }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["web"]
|
||||||
|
web = ["dioxus/web"]
|
||||||
|
desktop = ["dioxus/desktop"]
|
||||||
|
mobile = ["dioxus/mobile"]
|
||||||
|
|
||||||
|
[profile]
|
||||||
|
|
||||||
|
[profile.wasm-dev]
|
||||||
|
inherits = "dev"
|
||||||
|
opt-level = 1
|
||||||
|
|
||||||
|
[profile.server-dev]
|
||||||
|
inherits = "dev"
|
||||||
|
|
||||||
|
[profile.android-dev]
|
||||||
|
inherits = "dev"
|
21
Dioxus.toml
Normal file
21
Dioxus.toml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[application]
|
||||||
|
|
||||||
|
[web.app]
|
||||||
|
|
||||||
|
# HTML title tag content
|
||||||
|
title = "upcomming"
|
||||||
|
|
||||||
|
# include `assets` in web platform
|
||||||
|
[web.resource]
|
||||||
|
|
||||||
|
# Additional CSS style files
|
||||||
|
style = []
|
||||||
|
|
||||||
|
# Additional JavaScript files
|
||||||
|
script = []
|
||||||
|
|
||||||
|
[web.resource.dev]
|
||||||
|
|
||||||
|
# Javascript code file
|
||||||
|
# serve: [dev-server] only
|
||||||
|
script = []
|
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Development
|
||||||
|
|
||||||
|
Your new jumpstart project includes basic organization with an organized `assets` folder and a `components` folder.
|
||||||
|
If you chose to develop with the router feature, you will also have a `views` folder.
|
||||||
|
|
||||||
|
### Tailwind
|
||||||
|
1. Install npm: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
|
||||||
|
2. Install the Tailwind CSS CLI: https://tailwindcss.com/docs/installation
|
||||||
|
3. Run the following command in the root of the project to start the Tailwind CSS compiler:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx tailwindcss -i ./input.css -o ./assets/tailwind.css --watch
|
||||||
|
```
|
||||||
|
|
||||||
|
### Serving Your App
|
||||||
|
|
||||||
|
Run the following command in the root of your project to start developing with the default platform:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dx serve --platform web
|
||||||
|
```
|
||||||
|
|
||||||
|
To run for a different platform, use the `--platform platform` flag. E.g.
|
||||||
|
```bash
|
||||||
|
dx serve --platform desktop
|
||||||
|
```
|
||||||
|
|
BIN
assets/favicon.ico
Normal file
BIN
assets/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 KiB |
20
assets/header.svg
Normal file
20
assets/header.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 23 KiB |
8
assets/styling/blog.css
Normal file
8
assets/styling/blog.css
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#blog {
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blog a {
|
||||||
|
color: #ffffff;
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
20
assets/styling/calendar.css
Normal file
20
assets/styling/calendar.css
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
table {
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td, th {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background-color: #dddddd;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
th > p {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
34
assets/styling/echo.css
Normal file
34
assets/styling/echo.css
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#echo {
|
||||||
|
width: 360px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-top: 50px;
|
||||||
|
background-color: #1e222d;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#echo>h4 {
|
||||||
|
margin: 0px 0px 15px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#echo>input {
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px white solid;
|
||||||
|
background-color: transparent;
|
||||||
|
color: #ffffff;
|
||||||
|
transition: border-bottom-color 0.2s ease;
|
||||||
|
outline: none;
|
||||||
|
display: block;
|
||||||
|
padding: 0px 0px 5px 0px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#echo>input:focus {
|
||||||
|
border-bottom-color: #6d85c6;
|
||||||
|
}
|
||||||
|
|
||||||
|
#echo>p {
|
||||||
|
margin: 20px 0px 0px auto;
|
||||||
|
}
|
42
assets/styling/main.css
Normal file
42
assets/styling/main.css
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
body {
|
||||||
|
background-color: #0f1116;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#hero {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#links {
|
||||||
|
width: 400px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: x-large;
|
||||||
|
color: white;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#links a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin: 10px 0px;
|
||||||
|
border: white 1px solid;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#links a:hover {
|
||||||
|
background-color: #1f1f1f;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
max-width: 1200px;
|
||||||
|
}
|
16
assets/styling/navbar.css
Normal file
16
assets/styling/navbar.css
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#navbar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navbar a {
|
||||||
|
color: #ffffff;
|
||||||
|
margin-right: 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navbar a:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #91a4d2;
|
||||||
|
}
|
0
assets/tailwind.css
Normal file
0
assets/tailwind.css
Normal file
3
input.css
Normal file
3
input.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
37
src/components/echo.rs
Normal file
37
src/components/echo.rs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const ECHO_CSS: Asset = asset!("/assets/styling/echo.css");
|
||||||
|
|
||||||
|
/// Echo component that demonstrates fullstack server functions.
|
||||||
|
#[component]
|
||||||
|
pub fn Echo() -> Element {
|
||||||
|
let mut response = use_signal(|| String::new());
|
||||||
|
|
||||||
|
rsx! {
|
||||||
|
document::Link { rel: "stylesheet", href: ECHO_CSS }
|
||||||
|
div {
|
||||||
|
id: "echo",
|
||||||
|
h4 { "ServerFn Echo" }
|
||||||
|
input {
|
||||||
|
placeholder: "Type here to echo...",
|
||||||
|
oninput: move |event| async move {
|
||||||
|
let data = echo_server(event.value()).await.unwrap();
|
||||||
|
response.set(data);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if !response().is_empty() {
|
||||||
|
p {
|
||||||
|
"Server echoed: "
|
||||||
|
i { "{response}" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Echo the user input on the server.
|
||||||
|
#[server(EchoServer)]
|
||||||
|
async fn echo_server(input: String) -> Result<String, ServerFnError> {
|
||||||
|
Ok(input)
|
||||||
|
}
|
21
src/components/hero.rs
Normal file
21
src/components/hero.rs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const HEADER_SVG: Asset = asset!("/assets/header.svg");
|
||||||
|
|
||||||
|
#[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" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
src/components/mod.rs
Normal file
8
src/components/mod.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
mod hero;
|
||||||
|
pub use hero::Hero;
|
||||||
|
|
||||||
|
mod navbar;
|
||||||
|
pub use navbar::Navbar;
|
||||||
|
|
||||||
|
mod echo;
|
||||||
|
pub use echo::Echo;
|
25
src/components/navbar.rs
Normal file
25
src/components/navbar.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
use crate::Route;
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const NAVBAR_CSS: Asset = asset!("/assets/styling/navbar.css");
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Navbar() -> Element {
|
||||||
|
rsx! {
|
||||||
|
document::Link { rel: "stylesheet", href: NAVBAR_CSS }
|
||||||
|
|
||||||
|
div {
|
||||||
|
id: "navbar",
|
||||||
|
Link {
|
||||||
|
to: Route::Home {},
|
||||||
|
"Home"
|
||||||
|
}
|
||||||
|
Link {
|
||||||
|
to: Route::Calendar { id: 1 },
|
||||||
|
"Calendar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Outlet::<Route> {}
|
||||||
|
}
|
||||||
|
}
|
1
src/jobs/mod.rs
Normal file
1
src/jobs/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod tmdb;
|
12
src/jobs/tmdb.rs
Normal file
12
src/jobs/tmdb.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
use std::fmt::Error;
|
||||||
|
|
||||||
|
pub async fn get_series() {
|
||||||
|
// TODO: get series upcomming dates from tmdb
|
||||||
|
//
|
||||||
|
let body = reqwest::get("https://www.rust-lang.org")
|
||||||
|
.await?
|
||||||
|
.text()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("body = {body:?}");
|
||||||
|
}
|
42
src/main.rs
Normal file
42
src/main.rs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
use components::Navbar;
|
||||||
|
use views::{Blog, Calendar, Home};
|
||||||
|
|
||||||
|
mod components;
|
||||||
|
mod jobs;
|
||||||
|
mod views;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Routable, PartialEq)]
|
||||||
|
#[rustfmt::skip]
|
||||||
|
enum Route {
|
||||||
|
#[layout(Navbar)]
|
||||||
|
#[route("/")]
|
||||||
|
Home {},
|
||||||
|
#[route("/blog/:id")]
|
||||||
|
Blog { id: i32 },
|
||||||
|
#[route("/calendar/:id")]
|
||||||
|
Calendar { id: i32 },
|
||||||
|
}
|
||||||
|
|
||||||
|
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
||||||
|
const MAIN_CSS: Asset = asset!("/assets/styling/main.css");
|
||||||
|
const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css");
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
dioxus::launch(App);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
fn App() -> Element {
|
||||||
|
// Build cool things ✌️
|
||||||
|
|
||||||
|
rsx! {
|
||||||
|
// Global app resources
|
||||||
|
document::Link { rel: "icon", href: FAVICON }
|
||||||
|
document::Link { rel: "stylesheet", href: MAIN_CSS }
|
||||||
|
document::Link { rel: "stylesheet", href: TAILWIND_CSS }
|
||||||
|
|
||||||
|
Router::<Route> {}
|
||||||
|
}
|
||||||
|
}
|
30
src/views/blog.rs
Normal file
30
src/views/blog.rs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
use crate::Route;
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const BLOG_CSS: Asset = asset!("/assets/styling/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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
102
src/views/calendar.rs
Normal file
102
src/views/calendar.rs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
use crate::Route;
|
||||||
|
use dioxus::{
|
||||||
|
html::{strong, th, tr},
|
||||||
|
prelude::*,
|
||||||
|
};
|
||||||
|
|
||||||
|
const CALENDAR_CSS: Asset = asset!("/assets/styling/calendar.css");
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Calendar(id: i32) -> Element {
|
||||||
|
rsx! {
|
||||||
|
document::Link { rel: "stylesheet", href: CALENDAR_CSS}
|
||||||
|
|
||||||
|
div {
|
||||||
|
id: "calendar",
|
||||||
|
|
||||||
|
// Content
|
||||||
|
h1 { "This is Calendar #{id}!" }
|
||||||
|
table {
|
||||||
|
tr {
|
||||||
|
th { "Monday" }
|
||||||
|
th { "Tuesday" }
|
||||||
|
th { "Wednesday" }
|
||||||
|
th { "Thursday" }
|
||||||
|
th { "Friday" }
|
||||||
|
th { "Saturday" }
|
||||||
|
th { "Sunday" }
|
||||||
|
}
|
||||||
|
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
strong { "Family Guy" }
|
||||||
|
p { "S23E05" }
|
||||||
|
p { "01:00 Uhr" }
|
||||||
|
p { "FOX" }
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
strong { "Die Rosenheim-Cops" }
|
||||||
|
p { "S24E23" }
|
||||||
|
p { "01:00 Uhr" }
|
||||||
|
p { "ZDFmediathek" }
|
||||||
|
}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
}
|
||||||
|
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
strong { "Married to Medicine" }
|
||||||
|
p { "S11E15" }
|
||||||
|
p { "01:00 Uhr" }
|
||||||
|
p { "Hayu" }
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
strong { "SOKO Köln" }
|
||||||
|
p { "S23E23" }
|
||||||
|
p { "01:00 Uhr" }
|
||||||
|
p { "ZDFmediathek" }
|
||||||
|
}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
}
|
||||||
|
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
strong { "SOKO Potsdam" }
|
||||||
|
p { "S07E11" }
|
||||||
|
p { "01:00 Uhr" }
|
||||||
|
p { "ZDFmediathek" }
|
||||||
|
}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
}
|
||||||
|
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
strong { "Tracker" }
|
||||||
|
p { "S02E13" }
|
||||||
|
p { "01:00 Uhr" }
|
||||||
|
p { "CBS" }
|
||||||
|
}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
th {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
src/views/home.rs
Normal file
10
src/views/home.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
use crate::components::{Echo, Hero};
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Home() -> Element {
|
||||||
|
rsx! {
|
||||||
|
Hero {}
|
||||||
|
Echo {}
|
||||||
|
}
|
||||||
|
}
|
8
src/views/mod.rs
Normal file
8
src/views/mod.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
mod home;
|
||||||
|
pub use home::Home;
|
||||||
|
|
||||||
|
mod blog;
|
||||||
|
pub use blog::Blog;
|
||||||
|
|
||||||
|
mod calendar;
|
||||||
|
pub use calendar::Calendar;
|
9
tailwind.config.js
Normal file
9
tailwind.config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
mode: "all",
|
||||||
|
content: ["./src/**/*.{rs,html,css}", "./dist/**/*.html"],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user