adds confirmation to the git ref link
This commit is contained in:
parent
f711ca0a55
commit
4a41ace4d0
|
|
@ -2195,6 +2195,11 @@ li.choice {
|
||||||
color: hsl(280, 65%, 43%);
|
color: hsl(280, 65%, 43%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.redir-url {
|
||||||
|
user-select: text;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
|
@ -2210,3 +2215,7 @@ li.choice {
|
||||||
padding: 10px 0 10px 0;
|
padding: 10px 0 10px 0;
|
||||||
border-top: 1px solid white;
|
border-top: 1px solid white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.has-confirm {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,26 +57,30 @@ pub fn ClientFooter() -> Html {
|
||||||
|
|
||||||
#[function_component]
|
#[function_component]
|
||||||
pub fn About() -> Html {
|
pub fn About() -> Html {
|
||||||
let confirm_state = use_state(|| false);
|
let source_confirm_state = use_state(|| false);
|
||||||
|
let git_ref_confirm_state = use_state(|| false);
|
||||||
|
|
||||||
let source_code_confirm = {
|
let source_code_confirm = {
|
||||||
let confirm_callback = {
|
let confirm_callback = {
|
||||||
move |_| {
|
move |_| {
|
||||||
let _ = gloo::utils::window().location().set_href(SOURCE_CODE_URL);
|
let _ = gloo::utils::window().location().set_href(SOURCE_CODE_URL);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let message = html! {
|
let confirm_message = html! {
|
||||||
<>
|
<>
|
||||||
<h1>{"this will take you away from the game"}</h1>
|
<h1>{"this will take you away from the game"}</h1>
|
||||||
|
<h5>{"("}<span class="redir-url">{SOURCE_CODE_URL}</span>{")"}</h5>
|
||||||
<h3>{"make sure this isn't an oopsie"}</h3>
|
<h3>{"make sure this isn't an oopsie"}</h3>
|
||||||
</>
|
</>
|
||||||
};
|
};
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<WithConfirmation
|
<WithConfirmation
|
||||||
state={confirm_state}
|
state={source_confirm_state}
|
||||||
confirm_callback={confirm_callback}
|
confirm_callback={confirm_callback}
|
||||||
message={message}
|
message={confirm_message}
|
||||||
>
|
>
|
||||||
{"source code"}
|
<button class="default-button">{"source code"}</button>
|
||||||
</WithConfirmation>
|
</WithConfirmation>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -86,16 +90,43 @@ pub fn About() -> Html {
|
||||||
<span class="dirty">{"(dirty)"}</span>
|
<span class="dirty">{"(dirty)"}</span>
|
||||||
</>
|
</>
|
||||||
});
|
});
|
||||||
|
let git_ref_confirm = {
|
||||||
|
let git_ref_url = format!("{SOURCE_CODE_URL}/commit/{}", crate::BUILD_ID_LONG);
|
||||||
|
let confirm_callback = {
|
||||||
|
let git_ref_url = git_ref_url.clone();
|
||||||
|
move |_| {
|
||||||
|
let _ = gloo::utils::window().location().set_href(&git_ref_url);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let confirm_message = html! {
|
||||||
|
<>
|
||||||
|
<h1>{"this will take you away from the game"}</h1>
|
||||||
|
<h4>{"("}<span class="redir-url">{git_ref_url}</span>{")"}</h4>
|
||||||
|
<h3>{"make sure this isn't an oopsie"}</h3>
|
||||||
|
</>
|
||||||
|
};
|
||||||
|
|
||||||
|
html! {
|
||||||
|
<WithConfirmation
|
||||||
|
state={git_ref_confirm_state}
|
||||||
|
confirm_callback={confirm_callback}
|
||||||
|
message={confirm_message}
|
||||||
|
>
|
||||||
|
<a>
|
||||||
|
{crate::BUILD_ID}
|
||||||
|
{dirty}
|
||||||
|
</a>
|
||||||
|
</WithConfirmation>
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<div class="about">
|
<div class="about">
|
||||||
<h1>{"werewolves"}</h1>
|
<h1>{"werewolves"}</h1>
|
||||||
<div class="build-info">
|
<div class="build-info">
|
||||||
<p class="build-id">
|
<p class="build-id">
|
||||||
<label>{"build: "}</label>
|
<label>{"build: "}</label>
|
||||||
<a href={format!("{SOURCE_CODE_URL}/commit/{}", crate::BUILD_ID_LONG)}>
|
{git_ref_confirm}
|
||||||
{crate::BUILD_ID}
|
|
||||||
{dirty}
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
<p class="build-time">
|
<p class="build-time">
|
||||||
<label>{"built at: "}</label>
|
<label>{"built at: "}</label>
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ pub fn WithConfirmation(
|
||||||
};
|
};
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<Button on_click={confirmation_click}>{children.clone()}</Button>
|
<span class="has-confirm" onclick={confirmation_click}>{children.clone()}</span>
|
||||||
{confirmation_dialog}
|
{confirmation_dialog}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue