Skip to content

Commit

Permalink
add bitnames tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-L2L committed Mar 25, 2024
1 parent 0c5f700 commit 190da1a
Show file tree
Hide file tree
Showing 17 changed files with 437 additions and 287 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
[workspace.package]
authors = [ "Ash Manning <[email protected]>" ]
edition = "2021"
version = "0.5.11"
version = "0.5.12"

[workspace.dependencies.bip300301]
git = "https://github.com/Ash-L2L/bip300301.git"
Expand Down
42 changes: 0 additions & 42 deletions app/gui/activity/bitname_explorer.rs

This file was deleted.

4 changes: 2 additions & 2 deletions app/gui/activity/mempool_explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use plain_bitnames::{
use crate::app::App;

#[derive(Default)]
pub struct MemPoolExplorer {
pub struct MempoolExplorer {
current: usize,
}

impl MemPoolExplorer {
impl MempoolExplorer {
pub fn show(&mut self, app: &mut App, ui: &mut egui::Ui) {
let transactions = app.node.get_all_transactions().unwrap_or_default();
let utxos = app.wallet.get_utxos().unwrap_or_default();
Expand Down
42 changes: 13 additions & 29 deletions app/gui/activity/mod.rs
Original file line number Diff line number Diff line change
@@ -1,70 +1,54 @@
use eframe::egui;
use strum::{EnumIter, IntoEnumIterator};

use crate::app::App;

mod bitname_explorer;
mod block_explorer;
mod mempool_explorer;

use bitname_explorer::BitNameExplorer;
use block_explorer::BlockExplorer;
use mempool_explorer::MemPoolExplorer;
use mempool_explorer::MempoolExplorer;

#[allow(clippy::enum_variant_names)]
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Debug, Default, EnumIter, Eq, PartialEq, strum::Display)]
enum Tab {
BitNameExplorer,
#[default]
#[strum(to_string = "Block Explorer")]
BlockExplorer,
MemPoolExplorer,
#[strum(to_string = "Mempool Explorer")]
MempoolExplorer,
}

pub struct Activity {
tab: Tab,
bitname_explorer: BitNameExplorer,
block_explorer: BlockExplorer,
mempool_explorer: MemPoolExplorer,
mempool_explorer: MempoolExplorer,
}

impl Activity {
pub fn new(app: &App) -> Self {
let height = app.node.get_height().unwrap_or(0);
Self {
tab: Default::default(),
bitname_explorer: BitNameExplorer,
block_explorer: BlockExplorer::new(height),
mempool_explorer: Default::default(),
}
}

pub fn show(&mut self, app: &mut App, ui: &mut egui::Ui) {
egui::TopBottomPanel::top("coins_tabs").show(ui.ctx(), |ui| {
egui::TopBottomPanel::top("activity_tabs").show(ui.ctx(), |ui| {
ui.horizontal(|ui| {
ui.selectable_value(
&mut self.tab,
Tab::BlockExplorer,
"block explorer",
);
ui.selectable_value(
&mut self.tab,
Tab::MemPoolExplorer,
"mempool explorer",
);
ui.selectable_value(
&mut self.tab,
Tab::BitNameExplorer,
"bitname explorer",
);
Tab::iter().for_each(|tab_variant| {
let tab_name = tab_variant.to_string();
ui.selectable_value(&mut self.tab, tab_variant, tab_name);
})
});
});
egui::CentralPanel::default().show(ui.ctx(), |ui| match self.tab {
Tab::BitNameExplorer => {
self.bitname_explorer.show(app, ui);
}
Tab::BlockExplorer => {
self.block_explorer.show(app, ui);
}
Tab::MemPoolExplorer => {
Tab::MempoolExplorer => {
self.mempool_explorer.show(app, ui);
}
});
Expand Down
123 changes: 0 additions & 123 deletions app/gui/bitname_explorer.rs

This file was deleted.

Loading

0 comments on commit 190da1a

Please sign in to comment.