Skip to content

Commit

Permalink
removed delete attachments from main page, and added Bound To display
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Jan 18, 2024
1 parent 5face38 commit ad54096
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 17 deletions.
26 changes: 16 additions & 10 deletions ui/src/AttachmentsList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
const dispatch = createEventDispatcher()
export let attachments: Array<HrlB64WithContext>
export let allowDelete = true
const { getStore } :any = getContext("gzStore");
let store: GamezStore = getStore();
</script>
<div class="attachments-list">
{#each attachments as attachment, index}
<div class="attachment-item">
<div
class:attachment-item-with-delete={allowDelete}
class:attachment-item={!allowDelete}
>
{#await store.weClient.attachableInfo(hrlB64WithContextToRaw(attachment))}
<sl-button size="small" loading></sl-button>
{:then { attachableInfo }}
Expand All @@ -29,13 +33,15 @@
style="display:flex;flex-direction:row;margin-right:5px"><sl-icon src={attachableInfo.icon_src} slot="prefix"></sl-icon>
{attachableInfo.name}
</sl-button>
<sl-button size="small"
on:click={()=>{
dispatch("remove-attachment",index)
}}
>
<Fa icon={faTrash} />
</sl-button>
{#if allowDelete}
<sl-button size="small"
on:click={()=>{
dispatch("remove-attachment",index)
}}
>
<Fa icon={faTrash} />
</sl-button>
{/if}
{:catch error}
Oops. something's wrong.
{/await}
Expand All @@ -44,13 +50,13 @@
</div>
<style>
.attachments-list {
margin-top:5px;
display:flex;
flex-direction:row;
flex-wrap: wrap;
}
.attachment-item {
}
.attachment-item-with-delete {
border:1px solid #aaa;
background-color:rgba(0,255,0,.1);
padding:4px;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Controller.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
export let profilesStore: ProfilesStore;
export let weClient : WeClient
let DEFAULT_GAMES = ["Chess", "Go"];
let DEFAULT_GAMES = ["Chess", "Go", "World"];
let store: GamezStore = new GamezStore(
weClient,
profilesStore,
Expand Down
13 changes: 11 additions & 2 deletions ui/src/GamezPane.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@
<div class="top-bar">
<div class="left-items">
<h5>{$state.name}</h5>
{#if store.weClient}
{#if $state.boundTo.length>0}
<div style="margin-left:20px;display:flex; align-items: center">
Bound To:
<AttachmentsList allowDelete={false} attachments={$state.boundTo} />
</div>
{/if}
{/if}
</div>
<div class="right-items">
Watching:
Expand Down Expand Up @@ -298,11 +306,11 @@
{/if}
{#if store.weClient}
<div class="attachments-area">
<sl-button style="margin-top:5px;margin-right: 5px" circle on:click={()=>attachmentsDialog.open()} >
<sl-button style="margin-top:5px;margin-right: 5px" circle on:click={()=>attachmentsDialog.open(undefined)} >
<Fa icon={faPaperclip}/>
</sl-button>
{#if attachments}
<AttachmentsList attachments={attachments}
<AttachmentsList attachments={attachments} allowDelete={false}
on:remove-attachment={(e)=>removeAttachment(e.detail)}/>
{/if}

Expand Down Expand Up @@ -457,6 +465,7 @@
display:flex;
flex-direction:row;
margin-left:20px;
align-items: center;
}
.piece-has-attachment {
position: absolute;
Expand Down
21 changes: 21 additions & 0 deletions ui/src/defaultGames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,25 @@ export const CHESS : BoardState =
}
}
},
}

export const WORLD: BoardState = {
"boundTo": [],
"max_players": 99,
"min_players": 1,
"name": "World: Zippy- 1/18/2024",
"pieceDefs": [],
"playerPieces": true,
"props": {
"attachments": [],
"bgHeight": "",
"bgUrl": "https://h5pstudio.ecampusontario.ca/sites/default/files/h5p/content/9451/images/image-5f6645b4ef14e.jpg",
"bgWidth": "1500",
"pieces": {},
"players": [
],
"turn": 0
},
"status": "",
"turns": false
}
7 changes: 4 additions & 3 deletions ui/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
type AgentPubKey,
type ActionHash,
type Link,
type EntryHashB64,
type EntryHash,
decodeHashFromBase64,
type DnaHash,
Expand All @@ -16,7 +15,7 @@ import type { BoardState } from './board';
import { BoardList } from './boardList';
import TimeAgo from "javascript-time-ago"
import en from 'javascript-time-ago/locale/en'
import { CHESS, GO } from './defaultGames';
import { CHESS, GO, WORLD } from './defaultGames';
import type { ProfilesStore } from '@holochain-open-dev/profiles';
import { EntryRecord, LazyHoloHashMap, ZomeClient } from '@holochain-open-dev/utils';
import { collectionStore, type AsyncReadable, latestVersionOfEntryStore, pipe, joinAsync, sliceAndJoin, asyncDerived, type Writable, writable, get, type Unsubscriber } from '@holochain-open-dev/stores';
Expand Down Expand Up @@ -201,7 +200,9 @@ export class GamezStore {
break;
case "Go" :
board = GO

break;
case "World":
board = WORLD
break;
}
if (board) {
Expand Down
2 changes: 1 addition & 1 deletion we_dev/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
"source": {
"type": "https",
"url": "https://github.com/holochain-apps/kando/releases/download/v0.8.11/kando.webhapp"
"url": "https://github.com/holochain-apps/kando/releases/download/v0.8.12/kando.webhapp"
}
}
]
Expand Down

0 comments on commit ad54096

Please sign in to comment.