Doing some overall warning cleanup.
This commit is contained in:
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -224,7 +224,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bard"
|
||||
version = "0.3.2"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"dioxus",
|
||||
"tavern",
|
||||
@ -263,7 +263,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "blog_test"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum-server",
|
||||
@ -1941,7 +1941,7 @@ checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86"
|
||||
|
||||
[[package]]
|
||||
name = "loreweaver"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"tavern",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bard"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
edition = "2024"
|
||||
description = "Dioxus components that will display a Tavern blogging system Blog."
|
||||
repository = "/CyberMages/tavern"
|
||||
|
||||
@ -92,8 +92,6 @@
|
||||
|
||||
.blog_post_tale
|
||||
{
|
||||
all: initial;
|
||||
|
||||
pre
|
||||
{
|
||||
padding-left: 20px;
|
||||
@ -144,6 +142,9 @@
|
||||
flex-direction: column;
|
||||
margin-top: 70px;
|
||||
margin-right: 70px;
|
||||
position:sticky;
|
||||
top: 150px;
|
||||
height: 50vh;
|
||||
|
||||
fieldset
|
||||
{
|
||||
|
||||
@ -1,30 +1,15 @@
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::HashSet;
|
||||
use std::hash::Hash;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
use tavern::{Adventurer, Legend, Lore, Tale};
|
||||
|
||||
use crate::togglable::Togglable;
|
||||
use crate::page::Page;
|
||||
use crate::server::*;
|
||||
use crate::settings::{BardSettings};
|
||||
use super::tags::*;
|
||||
|
||||
|
||||
|
||||
#[component]
|
||||
pub fn BlogAuthor() -> Element
|
||||
{
|
||||
rsx!
|
||||
{
|
||||
section
|
||||
{
|
||||
class: "blog_author_style",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[component]
|
||||
pub fn BlogItem(title: String, slug: String, author: String, summary: String,
|
||||
tags: Vec<String>)
|
||||
@ -68,6 +53,9 @@ pub fn BlogItem(title: String, slug: String, author: String, summary: String,
|
||||
#[component]
|
||||
pub fn BlogList(tags: Signal<HashSet<String>>, children: Element) -> Element
|
||||
{
|
||||
// Retrieve the provided settings from context.
|
||||
let settings = use_context::<BardSettings>();
|
||||
|
||||
let list = use_server_future(move ||
|
||||
{
|
||||
let t = tags();
|
||||
@ -82,7 +70,23 @@ pub fn BlogList(tags: Signal<HashSet<String>>, children: Element) -> Element
|
||||
{
|
||||
class: "blog_list",
|
||||
|
||||
h1 { class: "blog_title", "Runes & Ramblings" }
|
||||
match settings.blog_name
|
||||
{
|
||||
Some(title) =>
|
||||
{
|
||||
rsx!
|
||||
{
|
||||
h1 { class: "blog_title", "{title}" }
|
||||
}
|
||||
}
|
||||
None =>
|
||||
{
|
||||
rsx!
|
||||
{
|
||||
h1 { class: "blog_title visually_hidden", "Blog" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(Ok(lores)) = &*list.read()
|
||||
{
|
||||
@ -98,10 +102,9 @@ pub fn BlogList(tags: Signal<HashSet<String>>, children: Element) -> Element
|
||||
}
|
||||
}
|
||||
}
|
||||
else if let Some(Err(e)) = &*list.read()
|
||||
else if let Some(Err(_e)) = &*list.read()
|
||||
{
|
||||
p { "Unable to show post header." }
|
||||
p { "{e}" }
|
||||
p { "Please choose a category to see related blog posts." }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,12 +1,6 @@
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::HashSet;
|
||||
use std::hash::Hash;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
use tavern::{Adventurer, Legend, Lore, Tale};
|
||||
use tavern::{Adventurer, Tale};
|
||||
|
||||
use crate::togglable::Togglable;
|
||||
use crate::page::Page;
|
||||
use crate::server::*;
|
||||
use super::tags::*;
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ use std::collections::HashSet;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::components::{BlogList, TagSelector};
|
||||
use crate::page::Page;
|
||||
|
||||
|
||||
|
||||
@ -11,7 +10,7 @@ use crate::page::Page;
|
||||
#[component]
|
||||
pub fn Blog(tag: ReadOnlySignal<String>) -> Element
|
||||
{
|
||||
let mut categories: Signal<HashSet<String>> =
|
||||
let categories: Signal<HashSet<String>> =
|
||||
use_signal(|| HashSet::new());
|
||||
|
||||
rsx!
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::components::{BlogPost, TagNav};
|
||||
use crate::page::Page;
|
||||
|
||||
|
||||
|
||||
@ -10,7 +9,7 @@ use crate::page::Page;
|
||||
pub fn Post(slug: ReadOnlySignal<String>) -> Element
|
||||
{
|
||||
// Create a copy of the current slug to detect changes.
|
||||
let mut url_slug = use_signal(|| slug());
|
||||
let url_slug = use_signal(|| slug());
|
||||
|
||||
rsx!
|
||||
{
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::page::Page;
|
||||
use crate::pages::Blog;
|
||||
|
||||
|
||||
|
||||
@ -15,9 +15,14 @@ pub enum StylesheetBehavior
|
||||
}
|
||||
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct BardSettings
|
||||
{
|
||||
/// The name to use for the blog.
|
||||
/// If None, then the name will be Blog, but made invisible so that
|
||||
/// it is still available for screen readers.
|
||||
pub blog_name: Option<String>,
|
||||
|
||||
/// A user defined stylesheet and how the library should include it.
|
||||
pub stylesheet: StylesheetBehavior
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "blog_test"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Myrddin Dundragon <myrddin@cybermages.tech>"]
|
||||
edition = "2021"
|
||||
|
||||
|
||||
45
blog_test/assets/blog.css
Normal file
45
blog_test/assets/blog.css
Normal file
@ -0,0 +1,45 @@
|
||||
:root
|
||||
{
|
||||
--text-color: #000000;
|
||||
--bg-color: #FFFFFF;
|
||||
|
||||
--primary-color: #ffffff;
|
||||
--secondary-color: #000000;
|
||||
--accent-color: #7dfdfe; /* Tron grid or try 00a8ff 00eaff 26b4ca 59b4c7 5584AC*/
|
||||
--mobile-color: #363636;
|
||||
|
||||
--desktop-size: 1230px;
|
||||
}
|
||||
|
||||
.toggle_button {
|
||||
display: inline-block;
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
padding: 0px 6px;
|
||||
border: 2px solid var(--text-color);
|
||||
border-radius: 5px;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: 0.1s ease-in;
|
||||
}
|
||||
|
||||
.toggle_button:hover {
|
||||
color: var(--accent-color);
|
||||
border-color: var(--accent-color);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.toggle_button input[type="checkbox"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Checked state using :has() — modern browsers only */
|
||||
.toggle_button:has(input:checked) {
|
||||
color: var(--accent-color);
|
||||
border-color: var(--accent-color);
|
||||
}
|
||||
32
blog_test/blog.css
Normal file
32
blog_test/blog.css
Normal file
@ -0,0 +1,32 @@
|
||||
.toggle_button {
|
||||
display: inline-block;
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
padding: 0px 6px;
|
||||
border: 2px solid var(--text-color);
|
||||
border-radius: 5px;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: 0.1s ease-in;
|
||||
}
|
||||
|
||||
.toggle_button:hover {
|
||||
color: var(--accent-color);
|
||||
border-color: var(--accent-color);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.toggle_button input[type="checkbox"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Checked state using :has() — modern browsers only */
|
||||
.toggle_button:has(input:checked) {
|
||||
color: var(--accent-color);
|
||||
border-color: var(--accent-color);
|
||||
}
|
||||
@ -1,27 +1,11 @@
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
use axum::Router;
|
||||
#[cfg(feature = "server")]
|
||||
use axum::ServiceExt;
|
||||
#[cfg(feature = "server")]
|
||||
use axum::extract::{Extension, Host};
|
||||
#[cfg(feature = "server")]
|
||||
use axum::http::uri::{Parts, Uri};
|
||||
#[cfg(feature = "server")]
|
||||
use axum::http::StatusCode;
|
||||
#[cfg(feature = "server")]
|
||||
use axum::response::{IntoResponse, Redirect};
|
||||
#[cfg(feature = "server")]
|
||||
use axum::routing::get;
|
||||
|
||||
use bard::*;
|
||||
|
||||
|
||||
|
||||
const FAVICON: Asset = asset!("/assets/favicon.ico");
|
||||
const BLOG: Asset = asset!("/assets/blog.css");
|
||||
|
||||
|
||||
|
||||
@ -29,7 +13,7 @@ fn main()
|
||||
{
|
||||
#[cfg(feature = "server")]
|
||||
{
|
||||
tokio::runtime::Runtime::new()
|
||||
let _ = tokio::runtime::Runtime::new()
|
||||
.unwrap()
|
||||
.block_on(async move { bard::init_database("/home/myrddin/cybermages/website/tavern.db").await });
|
||||
}
|
||||
@ -41,6 +25,13 @@ fn main()
|
||||
#[component]
|
||||
fn App() -> Element
|
||||
{
|
||||
let custom_settings = BardSettings
|
||||
{
|
||||
blog_name: Some(String::from("Blog Test")),
|
||||
stylesheet: StylesheetBehavior::Extend(BLOG),
|
||||
};
|
||||
provide_context(custom_settings);
|
||||
|
||||
rsx!
|
||||
{
|
||||
document::Link { rel: "icon", href: FAVICON }
|
||||
@ -52,8 +43,7 @@ fn App() -> Element
|
||||
#[component]
|
||||
fn Home() -> Element
|
||||
{
|
||||
rsx!
|
||||
{
|
||||
rsx! {
|
||||
h1 { "Blog Test" }
|
||||
}
|
||||
}
|
||||
@ -62,8 +52,7 @@ fn Home() -> Element
|
||||
#[component]
|
||||
pub fn PageNotFound(route: Vec<String>) -> Element
|
||||
{
|
||||
rsx!
|
||||
{
|
||||
rsx! {
|
||||
h1 { "Page not found" }
|
||||
p { "We are terribly sorry, but the page you requested doesn't exist." }
|
||||
pre { color: "red", "log:\nattemped to navigate to: {route:?}" }
|
||||
@ -94,7 +83,6 @@ fn Navbar() -> Element
|
||||
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Routable, PartialEq)]
|
||||
#[rustfmt::skip]
|
||||
pub enum Page
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "loreweaver"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
edition = "2024"
|
||||
description = "Converts a blog repository into an SQLite database using the Tavern blog system."
|
||||
repository = "/CyberMages/tavern"
|
||||
|
||||
@ -3,12 +3,15 @@
|
||||
|
||||
|
||||
/// The environment variable defined by Cargo for the name.
|
||||
#[allow(dead_code)]
|
||||
const NAME: Option<&str> = option_env!("CARGO_PKG_NAME");
|
||||
|
||||
/// The environment variable defined by Cargo for the version.
|
||||
#[allow(dead_code)]
|
||||
const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
|
||||
|
||||
/// The string to display if a value is not defined during compile time.
|
||||
#[allow(dead_code)]
|
||||
const NOT_DEFINED: &'static str = "UNDEFINED";
|
||||
|
||||
|
||||
@ -17,6 +20,7 @@ const NOT_DEFINED: &'static str = "UNDEFINED";
|
||||
/// set at compile time and comes from the Cargo.toml file.
|
||||
///
|
||||
/// If a value is not found, then it will return the not defined value.
|
||||
#[allow(dead_code)]
|
||||
pub fn get_name() -> &'static str
|
||||
{
|
||||
NAME.unwrap_or(NOT_DEFINED)
|
||||
@ -27,6 +31,7 @@ pub fn get_name() -> &'static str
|
||||
/// This is set at compile time and comes from the Cargo.toml file.
|
||||
///
|
||||
/// If a value is not found, then it will return the not defined value.
|
||||
#[allow(dead_code)]
|
||||
pub fn get_version() -> &'static str
|
||||
{
|
||||
VERSION.unwrap_or(NOT_DEFINED)
|
||||
|
||||
Reference in New Issue
Block a user