-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ability to limit number of public transport connections * Refactor time widget into today widget * Allow user to change background color of display
- Loading branch information
Showing
15 changed files
with
186 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ pub mod base; | |
pub mod bernaqua; | ||
pub mod cafete; | ||
pub mod public_transport; | ||
pub mod time; | ||
pub mod today; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use common::models::{SystemConfiguration, SystemConfigurationAction}; | ||
use wasm_bindgen::JsCast; | ||
use web_sys::HtmlInputElement; | ||
use yew::prelude::*; | ||
|
||
use crate::components::config_card::ConfigCardComponent; | ||
|
||
#[derive(Properties, PartialEq)] | ||
pub struct BackgroundColorConfigProps { | ||
pub config: UseReducerHandle<SystemConfiguration>, | ||
} | ||
|
||
#[function_component(BackgroundColorConfigComponent)] | ||
pub fn public_transport_config_component(props: &BackgroundColorConfigProps) -> Html { | ||
let update_config = { | ||
let system_config = props.config.clone(); | ||
Callback::from(move |color| { | ||
system_config.dispatch(SystemConfigurationAction::SetBackgroundColor(color)); | ||
}) | ||
}; | ||
|
||
let on_changed = move |event: Event| { | ||
let input = event | ||
.target() | ||
.and_then(|t| t.dyn_into::<HtmlInputElement>().ok()); | ||
if let Some(input) = input { | ||
update_config.emit(input.value()); | ||
} | ||
}; | ||
|
||
html! { | ||
<ConfigCardComponent> | ||
<div class="text-white text-md font-medium">{"Background color"}</div> | ||
<div class="text-slate-300 text-sm">{"Changes the background color of the display"}</div> | ||
<input name="background_color" type="color" class="mt-2 bg-transparent" onchange={on_changed}/> | ||
</ConfigCardComponent> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use yew::prelude::*; | ||
|
||
#[derive(Properties, PartialEq)] | ||
pub struct DividerProps { | ||
pub text: AttrValue, | ||
} | ||
|
||
#[function_component(DividerComponent)] | ||
pub fn divider_component(props: &DividerProps) -> Html { | ||
html! { | ||
<div class="relative"> | ||
<div class="absolute inset-0 flex items-center" aria-hidden="true"> | ||
<div class="w-full border-t border-gray-300"></div> | ||
</div> | ||
<div class="relative flex justify-center"> | ||
<span class="bg-zinc-200 px-2 text-sm text-gray-500">{props.text.clone()}</span> | ||
</div> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
pub mod background_color_config; | ||
pub mod config_card; | ||
pub mod default_widget_config; | ||
pub mod divider; | ||
pub mod public_transport_config; | ||
pub mod widget_config; |
Oops, something went wrong.