-
Notifications
You must be signed in to change notification settings - Fork 207
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
1 parent
a7ec550
commit f331df0
Showing
16 changed files
with
284 additions
and
241 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 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,43 +1,46 @@ | ||
<script> | ||
import { E } from "@agoric/eventual-send"; | ||
import Card from 'smelte/src/components/Card'; | ||
import TextField from 'smelte/src/components/TextField'; | ||
import Switch from 'smelte/src/components/Switch'; | ||
export let dapp; | ||
let petname = dapp.petname || dapp.suggestedPetname; | ||
export let item; | ||
export let details = true; | ||
export let summary = true; | ||
const onKeydown = e => { | ||
if (e.key === 'Escape') { | ||
petname = origPetname; | ||
} else if (e.key === 'Enter') { | ||
E(actions).setPetname(petname); | ||
} | ||
}; | ||
</script> | ||
$: ({ enable, actions, suggestedPetname, | ||
petname: origPetname, dappOrigin, origin } = item); | ||
let petname = item.petname || item.suggestedPetname; | ||
const toggleDappEnabled = () => { | ||
if (enable) { | ||
E(E(actions).setPetname(petname)).disable(); | ||
} else { | ||
E(E(actions).setPetname(petname)).enable(); | ||
} | ||
}; | ||
<style> | ||
div { | ||
padding: 10px; | ||
box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, 0.5); | ||
} | ||
</style> | ||
const keydown = e => { | ||
// console.log('have', e.key); | ||
if (e.key === 'Escape') { | ||
petname = origPetname; | ||
ev.stopPropagation(); | ||
} else if (e.key === 'Enter') { | ||
E(actions).setPetname(petname); | ||
ev.stopPropagation(); | ||
} | ||
}; | ||
</script> | ||
|
||
<div> | ||
{#each [dapp] as { actions, enable, petname: origPetname, suggestedPetname, dappOrigin, origin } (dappOrigin || origin)} | ||
<p>{dappOrigin || origin} suggested: {JSON.stringify(suggestedPetname)}</p> | ||
<dd> | ||
<input | ||
type="text" | ||
on:keydown={onKeydown} | ||
bind:value={petname} /> | ||
{#if enable} | ||
<button on:click={() => E(E(actions).setPetname(petname)).disable()}> | ||
Disable | ||
</button> | ||
{:else} | ||
<button on:click={() => E(E(actions).setPetname(petname)).enable()}> | ||
Enable | ||
</button> | ||
{/if} | ||
</dd> | ||
{/each} | ||
</div> | ||
{#if summary}{dappOrigin || origin}{/if} | ||
{#if details} | ||
<div on:keydown|capture><TextField | ||
hint="Alleged name: {JSON.stringify(suggestedPetname)}" | ||
label="Dapp petname" | ||
bind:value={petname} | ||
/></div> | ||
<div on:click|capture|stopPropagation={toggleDappEnabled}> | ||
<Switch value={enable} label="Enabled" /> | ||
</div> | ||
{/if} | ||
</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,24 +1,25 @@ | ||
<script> | ||
import { E } from "@agoric/eventual-send"; | ||
import ListItems from "../lib/ListItems.svelte"; | ||
import ListCard from "../lib/ListCard.svelte"; | ||
import Card from 'smelte/src/components/Card'; | ||
import Dapp from "./Dapp.svelte"; | ||
export let dapps; | ||
import { dapps } from './store'; | ||
</script> | ||
|
||
<style> | ||
div { | ||
margin: 1rem; | ||
/* border: 1px solid grey; */ | ||
} | ||
</style> | ||
<ListCard items={$dapps}> | ||
<div slot="title"> | ||
<Card.Title title="Dapps" /> | ||
</div> | ||
|
||
<section> | ||
<h2>Dapps</h2> | ||
<ListItems items={$dapps} idFn={item => item.origin}> | ||
<div slot="item" let:item> | ||
<Dapp dapp={item} /> | ||
</div> | ||
<p slot="empty">No dapps.</p> | ||
</ListItems> | ||
</section> | ||
<div slot="empty"> | ||
No Dapps. | ||
</div> | ||
|
||
<div slot="item-header" let:item> | ||
<Dapp {item} details={false}/> | ||
</div> | ||
|
||
<div slot="item-details" let:item> | ||
<Dapp {item} summary={false}/> | ||
</div> | ||
</ListCard> |
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
Oops, something went wrong.