-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(crypto-helper): asn1: implement hex view PoC
- Loading branch information
1 parent
4cb4813
commit 944fb9b
Showing
11 changed files
with
136 additions
and
51 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -58,3 +58,7 @@ | |
background-color: #ba0021; | ||
color: #f5bdb6; | ||
} | ||
|
||
.hover_node { | ||
border: 2px solid rebeccapurple; | ||
} |
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 |
---|---|---|
@@ -1,19 +1,21 @@ | ||
use asn1_parser::OwnedAsn1; | ||
use yew::{function_component, html, Html, Properties}; | ||
use yew::{function_component, html, Callback, Html, Properties}; | ||
|
||
use crate::asn1::scheme::build_asn1_schema; | ||
|
||
#[derive(PartialEq, Properties, Clone)] | ||
pub struct Asn1ViewerProps { | ||
pub data: Vec<u8>, | ||
pub structure: OwnedAsn1, | ||
|
||
pub cur_node: Option<u64>, | ||
pub set_cur_node: Callback<Option<u64>>, | ||
} | ||
|
||
#[function_component(Asn1Viewer)] | ||
pub fn asn1_viewer(props: &Asn1ViewerProps) -> Html { | ||
html! { | ||
<div> | ||
{build_asn1_schema(&props.structure)} | ||
{build_asn1_schema(&props.structure, &props.cur_node)} | ||
</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,10 +1,35 @@ | ||
use yew::{function_component, html, Html, Properties}; | ||
use asn1_parser::OwnedAsn1; | ||
use web_sys::MouseEvent; | ||
use yew::{function_component, html, use_context, Callback, Html, Properties}; | ||
|
||
#[derive(PartialEq, Properties, Clone)] | ||
pub struct HexViewerProps { | ||
pub raw_data: Vec<u8>, | ||
pub structure: OwnedAsn1, | ||
|
||
pub cur_node: Option<u64>, | ||
pub set_cur_node: Callback<Option<u64>>, | ||
} | ||
|
||
#[function_component(HexViewer)] | ||
pub fn hex_viewer() -> Html { | ||
pub fn hex_viewer(props: &HexViewerProps) -> Html { | ||
let cur_node = props.cur_node.clone(); | ||
|
||
let set_cur_node = props.set_cur_node.clone(); | ||
let onmouseenter = Callback::from(move |_: MouseEvent| { | ||
log::debug!("Mouse enter event! {:?}", cur_node); | ||
set_cur_node.emit(Some(3)); | ||
}); | ||
|
||
let set_cur_node = props.set_cur_node.clone(); | ||
let onmouseleave = Callback::from(move |_: MouseEvent| { | ||
log::debug!("Mouse leave event! {:?}", cur_node); | ||
set_cur_node.emit(None); | ||
}); | ||
|
||
html! { | ||
<div class="asn1-hex-viewer"> | ||
<span>{"HexView"}</span> | ||
<span {onmouseenter} {onmouseleave}>{"third elem show yourself"}</span> | ||
</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
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