Doing some overall warning cleanup.
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user