Skip to content

Commit

Permalink
feat: include version in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
elsirion committed Dec 18, 2023
1 parent 5289f32 commit 6d98db8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
11 changes: 8 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ web-sys = { version = "0.3.65", features = [ "Navigator", "Window", "ServiceWork
gloo-storage = "0.3.0"
rand = "0.8.5"

[patch.crates-io]
secp256k1-zkp = { git = "https://github.com/dpc/rust-secp256k1-zkp/", branch = "sanket-pr" }
ring = { git = "https://github.com/dpc/ring", rev = "5493e7e76d0d8fb1d3cbb0be9c4944700741b802" }
[build-dependencies]
fedimint-build = "0.2.1-rc1"
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
fedimint_build::set_code_version();
}
9 changes: 7 additions & 2 deletions src/components/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use crate::components::service_worker::ServiceWorker;
//
#[component]
pub fn App(cx: Scope) -> impl IntoView {
info!("Starting app...");
pub const CODE_VERSION: &str = env!("FEDIMINT_BUILD_CODE_VERSION");

info!("Starting Webimint version {CODE_VERSION} ...");

let client = ClientRpc::new();
provide_client_context(cx, client.clone());
Expand Down Expand Up @@ -131,7 +133,10 @@ pub fn App(cx: Scope) -> impl IntoView {
<Joined />
</Show>
</main>
<Footer class="w-full py-2" />
<Footer
class="w-full py-2"
version=CODE_VERSION
/>
</div>
</div>
}
Expand Down
12 changes: 10 additions & 2 deletions src/components/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ use leptos::*;
use crate::components::LogoFedimint;

#[component]
pub fn Footer(cx: Scope, #[prop(optional, into)] class: String) -> impl IntoView {
pub fn Footer(cx: Scope, version: &'static str, #[prop(optional, into)] class: String) -> impl IntoView {
let version_prefix: &'static str = &version[..7];
view! { cx,
<div class={format!("flex justify-center items-center text-body text-sm text-gray-500 {class}")}>
"Powered by " <a class="opacity-50 hover:opacity-100 ease" href="https://fedimint.org/"><LogoFedimint class="ml-2 w-[100px] h-[23px]" /></a>
"Webimint version "
<a
class="text-gray-950 font-mono mx-1"
href={ format!("https://github.com/elsirion/webimint-rs/commit/{version}") }
>
{ version_prefix }
</a>
" powered by " <a class="opacity-50 hover:opacity-100 ease" href="https://fedimint.org/"><LogoFedimint class="ml-2 w-[100px] h-[23px]" /></a>
</div>
}
}

0 comments on commit 6d98db8

Please sign in to comment.