-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
131 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { ul, li, a, span, input, label } from "@hyperapp/html"; | ||
import { card, cardContent, container, tabs, formField, formControl } from "util/bulma"; | ||
|
||
const keyGenerationModeName = "keyGenerationMode"; | ||
const keyGenerationModeWithPassphraseValue = "withPassphrase"; | ||
const keyGenerationModeOneTimeValue = "oneTime"; | ||
|
||
const keyGenerationPasswordName = "keyGenerationPassword"; | ||
|
||
export const KeyConfigurationElement = ({ state, actions }) => ( | ||
tabs({ class: "is-boxed" }, [ | ||
ul([ | ||
li({ class: "is-active" }, [ | ||
a([ | ||
span([ | ||
"Passphrase based-key" | ||
]) | ||
]) | ||
]), | ||
li([ | ||
a([ | ||
span([ | ||
"One-time key" | ||
]) | ||
]) | ||
]) | ||
]) | ||
]) | ||
); | ||
|
||
/* | ||
formField([ | ||
formControl([ | ||
label({ class: "radio" }, [ | ||
input({ type: "radio", name: keyGenerationModeName, value: keyGenerationModeWithPassphraseValue }), | ||
"I want to generate the key using a passphrase, so that I can receive responses later on." | ||
]) | ||
]) | ||
]), | ||
formField([ | ||
label({ class: "label" }, "Key Passphrase"), | ||
formControl([ | ||
input({ type: "password", name: keyGenerationPasswordName }) | ||
]) | ||
]) | ||
formField([ | ||
formControl([ | ||
label({ class: "radio" }, [ | ||
input({ type: "radio", name: keyGenerationModeName, value: keyGenerationModeOneTimeValue }), | ||
"I do only want to generate a one-time key." | ||
]) | ||
]) | ||
]) | ||
*/ |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { h } from "hyperapp"; | ||
import { Spinner } from "app/Spinner"; | ||
|
||
export const KeyGenerationElement = ({ state, actions }) => ( | ||
h("div", {}, | ||
h(Spinner), | ||
h("p", {}, "Your key is generated, please wait ...") | ||
) | ||
); |
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,18 @@ | ||
import { h } from "hyperapp"; | ||
import {div, h1, section} from "@hyperapp/html"; | ||
import {container} from "util/bulma"; | ||
import {KeyGenerationElement} from "./KeyGenerationElement"; | ||
import {KeyConfigurationElement} from "./KeyConfigurationElement"; | ||
|
||
export const KeyProviderSection = ({ logo, state, actions }) => ( | ||
section({class:"hero is-success is-fullheight"}, [ | ||
div({class:"hero-body"}, [ | ||
container([ | ||
h1({class:"title has-text-centered"}, [logo]), | ||
state.keyConfigurationAvailable | ||
? h(KeyGenerationElement, { state: state, actions: actions }) | ||
: h(KeyConfigurationElement, { state: state, actions: actions }) | ||
]) | ||
]) | ||
]) | ||
); |
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,8 +1,8 @@ | ||
import { h } from "hyperapp" | ||
import {KeyGeneratingSection} from "./KeyGeneratingSection"; | ||
import {KeyProviderSection} from "./KeyProviderSection"; | ||
|
||
export const WithEncryptionKey = ({actions, state, whenKeyAvailable, logo}) => ( | ||
h("div", { | ||
oncreate() { actions.setKeyAvailableDelayed(3000); } // HINT: Mock key creation for now | ||
}, state.keyAvailable ? whenKeyAvailable : h(KeyGeneratingSection, {logo: logo})) | ||
oncreate() { /*actions.setKeyAvailableDelayed(3000);*/ } // HINT: Mock key creation for now | ||
}, state.keyAvailable ? whenKeyAvailable : h(KeyProviderSection, {logo: logo, state: state, actions: actions})) | ||
); |
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,3 +1,5 @@ | ||
$tabs-boxed-link-active-border-color: #fff; | ||
|
||
@import 'bulma/bulma'; | ||
|
||
body { | ||
|
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,41 @@ | ||
import { h } from "hyperapp"; | ||
|
||
/** | ||
* Like Object.assign(), but concats props that are in both objects | ||
* @param target | ||
* @param source | ||
* @return modified target object | ||
*/ | ||
function mergeProps(target, source) { | ||
if (source) { | ||
for (const propName in source) { | ||
if (source.hasOwnProperty(propName)) { | ||
if (target[propName]) { | ||
target[propName] = source[propName] + " " + target[propName] | ||
} else { | ||
target[propName] = source[propName] | ||
} | ||
} | ||
} | ||
} | ||
return target; | ||
} | ||
|
||
// based on https://github.com/hyperapp/html/blob/master/src/html.js#L3 | ||
function vnode(name, additionalProps) { | ||
return function (props, children) { | ||
return typeof props === "object" && !Array.isArray(props) | ||
? h(name, mergeProps(props, additionalProps), children) | ||
: h(name, additionalProps, props) | ||
} | ||
} | ||
|
||
export function container(props, children) { return vnode("div", { class: "container" })(props, children); } | ||
|
||
export function card(props, children) { return vnode("div", { class: "card" })(props, children); } | ||
export function cardContent(props, children) { return vnode("div", { class: "card-content" })(props, children); } | ||
|
||
export function tabs(props, children) { return vnode("div", { class: "tabs" })(props, children); } | ||
|
||
export function formField(props, children) { return vnode("div", { class: "field" })(props, children); } | ||
export function formControl(props, children) { return vnode("div", { class: "control" })(props, children); } |