-
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.
#30: rewrite existing code from React to Hyperapp
- Loading branch information
Showing
16 changed files
with
114 additions
and
93 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
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 was deleted.
Oops, something went wrong.
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,14 @@ | ||
import { h } from "hyperapp" | ||
import {Logo} from "app/Logo"; | ||
import {WithEncryptionKey} from "encryption/WithEncryptionKey"; | ||
import {Nav} from "app/Nav"; | ||
import {KeyTag} from "encryption/KeyTag"; | ||
|
||
export const view = (state, actions) => { | ||
return h(WithEncryptionKey, { | ||
actions: actions.encryption, | ||
state: state.encryption, | ||
whenKeyAvailable: h(Nav, {logo: h(Logo), items: [h(KeyTag)]}), | ||
logo: h(Logo) | ||
}); | ||
}; |
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,6 @@ | ||
import { h } from "hyperapp" | ||
import "./Logo.css" | ||
|
||
export const Logo = () => ( | ||
h("div", {class: 'app-logo'}, "deadbox") | ||
); |
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,20 @@ | ||
import { h } from "hyperapp" | ||
|
||
export const Nav = ({ logo, items }, children) => ( | ||
h("div", {}, [ | ||
h("nav", {class: "navbar is-black"}, [ | ||
h("div", {class:"navbar-brand"}, [ | ||
h("h1", {class:"is-size-5 is-vertical-center"}, [ | ||
logo | ||
]) | ||
]), | ||
h("div", {class:"navbar-menu"}, [ | ||
h("div", {class:"navbar-start"}), | ||
h("div", {class:"navbar-end"}, | ||
items.map(item => h("div", {class:"navbar-item"}, [item])) | ||
) | ||
]) | ||
]), | ||
...children | ||
]) | ||
); |
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,14 @@ | ||
import { h } from "hyperapp" | ||
|
||
export const KeyGeneratingSection = ({ logo }) => ( | ||
h("section", {class:"hero is-success is-fullheight"}, [ | ||
h("div", {class:"hero-body"}, [ | ||
h("div", {class:"container has-text-centered"}, [ | ||
h("h1", {class:"title"}, [ | ||
logo | ||
]), | ||
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,8 @@ | ||
import { h } from "hyperapp" | ||
|
||
export const KeyTag = () => ( | ||
h("div", {class:"tags has-addons"}, [ | ||
h("span", {class:"tag"}, "personal key"), | ||
h("span", {class:"tag is-success"}, "AA:BB:CC:DD:EE:FF") | ||
]) | ||
); |
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,8 @@ | ||
import { h } from "hyperapp" | ||
import {KeyGeneratingSection} from "./KeyGeneratingSection"; | ||
|
||
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})) | ||
); |
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,10 @@ | ||
export default { | ||
state: { | ||
keyAvailable: false | ||
}, | ||
actions: { | ||
setKeyAvailable: () => (state) => ({ keyAvailable: true }), | ||
setKeyAvailableDelayed: timeout => (state, actions) => | ||
new Promise(resolve => setTimeout(resolve, timeout)).then(() => actions.setKeyAvailable()) | ||
} | ||
}; |
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,5 +1,14 @@ | ||
import { app } from "hyperapp" | ||
import './index.css'; | ||
import {state, actions, view} from './App'; | ||
import {view} from './View'; | ||
import encryption from "encryption"; | ||
|
||
const state = { | ||
encryption: encryption.state | ||
}; | ||
|
||
const actions = { | ||
encryption: encryption.actions | ||
}; | ||
|
||
app(state, actions, view, document.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
This file was deleted.
Oops, something went wrong.