Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
matthme committed Apr 3, 2024
2 parents bbaa20c + 0a0a21e commit a39a601
Show file tree
Hide file tree
Showing 19 changed files with 206 additions and 275 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
matrix:
# platform: [windows-2019]
# platform: [macos-11]
# platform: [windows-2019, macos-11, ubuntu-22.04]
platform: [windows-2019, ubuntu-22.04]
platform: [windows-2019, macos-11, ubuntu-22.04]
# platform: [windows-2019, ubuntu-22.04]
env:
MACOSX_DEPLOYMENT_TARGET: 10.13

Expand Down Expand Up @@ -102,4 +102,4 @@ jobs:
# echo "sha512 after code signing"
# CertUtil -hashfile "dist/org.lightningrodlabs.we-electron-alpha-${{ steps.version.outputs.APP_VERSION }}-setup.exe" SHA512
gh release upload "we-alpha-v${{ steps.version.outputs.APP_VERSION }}" "dist/org.lightningrodlabs.we-electron-alpha-${{ steps.version.outputs.APP_VERSION }}-setup.exe" --clobber
# gh release upload "we-alpha-v${{ steps.version.outputs.APP_VERSION }}" "dist/org.lightningrodlabs.we-electron-alpha-${{ steps.version.outputs.APP_VERSION }}-setup.exe" --clobber
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CLI to run We Applets in development mode.

This version is compatible with `@lightningrodlabs/[email protected].0`.
This version is compatible with `@lightningrodlabs/[email protected].1`.

```
Usage: @lightningrodlabs/we-dev-cli [options]
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lightningrodlabs/we-dev-cli",
"version": "0.11.5",
"version": "0.11.8-dev.0",
"description": "CLI to run We applets in development mode",
"license": "CAL-1.0",
"repository": {
Expand Down
7 changes: 7 additions & 0 deletions example/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<meta name="Description" content="Example We Applet." />
<base href="/" />
<title>Example We Applet</title>
<style>
body {
background: white;
}
</style>
</head>

<body>
Expand Down Expand Up @@ -55,6 +60,8 @@
post: {
label: 'post',
icon_src: wrapPathInSvg(mdiPost),
width: 'large',
height: 'large',
},
},
blockTypes: {},
Expand Down
3 changes: 3 additions & 0 deletions example/ui/src/example-applet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ export class ExampleApplet extends LitElement {
Create
</button>
</div>
<div style="margin-top: 200px; width: 600px; background: blue;">
Here is more content to make the dialog require more space.
</div>
</div>
`;
default:
Expand Down
2 changes: 1 addition & 1 deletion libs/we-applet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lightningrodlabs/we-applet",
"version": "0.16.0",
"version": "0.16.1",
"main": "./dist/index.js",
"module": "./dist/index.js",
"license": "MIT",
Expand Down
2 changes: 2 additions & 0 deletions libs/we-applet/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ export type CreatableType = {
*/
label: string;
icon_src: string;
width?: 'small' | 'medium' | 'large';
height?: 'small' | 'medium' | 'large';
};

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "org.lightningrodlabs.we-electron-alpha",
"version": "0.11.7",
"version": "0.11.8",
"private": true,
"description": "Moss (Alpha)",
"main": "./out/main/index.js",
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/src/applets/applet-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,12 @@ export async function handleAppletIframeMessage(
case 'toggle-pocket':
return openViews.toggleClipboard();
case 'notify-frame': {
console.log(
'### NOTIFY FRAME ### from applet ',
appletId,
'message: ',
message.notifications,
);
if (!message.notifications) {
throw new Error(
`Got notification message without notifications attribute: ${JSON.stringify(message)}`,
Expand Down
30 changes: 29 additions & 1 deletion src/renderer/src/elements/creatable-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,28 @@ export class CreatablePanel extends LitElement {
this._dialog.hide();
}

creatableWidth(width: string | undefined) {
switch (width) {
case 'medium':
return '--width: 600px;';
case 'large':
return '--width: 800px;';
default:
return '';
}
}

creatableHeight(height: string | undefined) {
switch (height) {
case 'medium':
return 'height: 400px;';
case 'large':
return 'height: 600px;';
default:
return '';
}
}

async handleCreatableResponse(e: CustomEvent) {
const creatableResult: CreatableResult = e.detail;
if (this._creatableViewDialog) this._creatableViewDialog.hide();
Expand Down Expand Up @@ -172,6 +194,10 @@ export class CreatablePanel extends LitElement {
this.requestUpdate();
});

const appletsWithCreatables = Object.entries(this._allCreatableTypes.value)
.filter(([_appletId, creatables]) => Object.keys(creatables).length > 0)
.map(([appletId, _]) => appletId);

return html`
<div class="column" style="align-items: flex-start; flex: 1;">
${knownGroups
Expand Down Expand Up @@ -203,7 +229,7 @@ export class CreatablePanel extends LitElement {
</sl-tooltip>
<group-applets-row
style="display: flex; flex: 1;"
.activeApplets=${Object.keys(this._allCreatableTypes.value)}
.activeApplets=${appletsWithCreatables}
@applet-chosen=${(e) => {
this._showCreatablesSelection = encodeHashToBase64(e.detail.appletHash);
setTimeout(() => this._creatableSelectionDialog!.show());
Expand Down Expand Up @@ -235,12 +261,14 @@ export class CreatablePanel extends LitElement {
? html`
<sl-dialog
id="creatable-view-dialog"
style="${this.creatableWidth(this._showCreatableView.creatable.width)}"
label="${msg('Create New')} ${this._showCreatableView.creatable.label}"
@sl-hide=${() => {
this._showCreatableView = undefined;
}}
>
<creatable-view
style="${this.creatableHeight(this._showCreatableView.creatable.height)}"
.creatableInfo=${this._showCreatableView}
.dialogId=${this._activeDialogId}
@creatable-response-received=${(e) => this.handleCreatableResponse(e)}
Expand Down
46 changes: 42 additions & 4 deletions src/renderer/src/elements/group-sidebar-button.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css, html, LitElement } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { consume } from '@lit/context';
import { derived, joinMap, pipe, StoreSubscriber } from '@holochain-open-dev/stores';
import { derived, joinMap, pipe, StoreSubscriber, Unsubscriber } from '@holochain-open-dev/stores';

import '@shoelace-style/shoelace/dist/components/tooltip/tooltip.js';
import { groupStoreContext } from '../groups/context.js';
Expand Down Expand Up @@ -49,6 +49,27 @@ export class GroupSidebarButton extends LitElement {
() => [this._groupStore],
);

_unsubscribe: Unsubscriber | undefined;

disconnectedCallback(): void {
if (this._unsubscribe) this._unsubscribe();
}

firstUpdated() {
this._unsubscribe = this._onlineAgents.store.subscribe((value) => {
// TODO emit event if first agent comes online
if (value.status === 'complete' && value.value.length > 0) {
this.dispatchEvent(
new CustomEvent('agents-online', {
detail: this._groupStore.groupDnaHash,
bubbles: true,
composed: true,
}),
);
}
});
}

@property()
logoSrc!: string;

Expand Down Expand Up @@ -79,9 +100,26 @@ export class GroupSidebarButton extends LitElement {
renderOnlineCount() {
switch (this._onlineAgents.value.status) {
case 'pending':
return html``;
return html`
<div
class="row center-content online-agents gray"
title="${msg('Loading number of online members')}"
>
<sl-spinner
style="font-size: 10px; --indicator-color: white; --track-color: var(--sl-color-primary-700)"
></sl-spinner>
</div>
`;
case 'error':
return html``;
return html`
<div
class="row center-content online-agents gray"
style="color: red; font-weight: bold;"
title="${msg('Error while loading number of online members')}"
>
x
</div>
`;
case 'complete':
const onlineAgentCount = this._onlineAgents.value.value.length;
setTimeout(() => {
Expand All @@ -96,7 +134,7 @@ export class GroupSidebarButton extends LitElement {
>
${this._loadingPeerCount
? html`<sl-spinner
style="font-size: 10px; margin-right: 5px; --indicator-color: white; --track-color: var(--sl-color-primary-700)"
style="font-size: 10px; --indicator-color: white; --track-color: var(--sl-color-primary-700)"
></sl-spinner>`
: html`
<sl-icon
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/elements/groups-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ export class GroupsSidebar extends LitElement {
outline: none;
border: none;
color: #fff;
background: linear-gradient(270deg, #394333 0%, #526C44 100%);
background: linear-gradient(270deg, #394333 0%, #526c44 100%);
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
border-radius: 5px;
margin-top: 15px;
}
.moss-button:hover {
background: linear-gradient(270deg, #495542 0%, #67924F 100%);
background: linear-gradient(270deg, #495542 0%, #67924f 100%);
cursor: pointer;
}
`,
Expand Down
Loading

0 comments on commit a39a601

Please sign in to comment.