Skip to content

Commit

Permalink
add support for we dev-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Dec 27, 2023
1 parent 26c88c6 commit a57e18f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"start": "AGENTS=2 BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) npm run network",
"dev": "VITE_ADMIN_PORT=$(port) VITE_APP_PORT=$(port) SIGNAL_PORT=$(port) BOOTSTRAP_PORT=$(port) UI_PORT=8888 npm run x",
"x": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run start:happ\" \"hc run-local-services -b $BOOTSTRAP_PORT -s $SIGNAL_PORT\"",
"applet-dev": " UI_PORT=8888 npm run applet-devx",
"applet-devx": "BPORT=46263 SPORT=46262; concurrently \"hc run-local-services -b $BPORT -s $SPORT\" \"npm start -w ui\" \"./we_dev/we.AppImage --dev-config we_dev/config.json --agent-num 1 -b http://127.0.0.1:$BPORT -s ws://127.0.0.1:$SPORT\" \"sleep 10 && ./we_dev/we.AppImage --dev-config we_dev/config.json --agent-num 2 -b http://127.0.0.1:$BPORT -s ws://127.0.0.1:$SPORT\"",
"network": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:happ\" \"holochain-playground\"",
"test": "npm run build:zomes && hc app pack workdir --recursive && npm t -w tests",
"launch:happ": "concurrently \"hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT\" \"echo pass | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/how.happ --ui-port $UI_PORT network --bootstrap http://127.0.0.1:\"$BOOTSTRAP_PORT\" webrtc ws://127.0.0.1:\"$SIGNAL_PORT\"\"",
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@holochain-open-dev/stores": "^0.8.3",
"@holochain-open-dev/utils": "^0.16.0",
"@holochain/client": "0.16",
"@lightningrodlabs/we-applet": "0.12.0",
"@lightningrodlabs/we-applet": "^0.12.2",
"@lit/context": "^1.0.0",
"@lit/localize": "^0.12.0",
"lit": "^3.0.0",
Expand Down
5 changes: 3 additions & 2 deletions ui/src/elements/how-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {EntryHashB64, encodeHashToBase64} from "@holochain/client";
import { consume } from '@lit/context';
import { HowMyProfileDialog } from "./how-my-profile-dialog";
import { EntryRecord } from "@holochain-open-dev/utils";
import { isWeContext } from "@lightningrodlabs/we-applet";
//import { HowSettings } from "./how-settings";
//import './how-settings.js';

Expand Down Expand Up @@ -603,7 +604,7 @@ export class HowController extends ScopedElementsMixin(LitElement) {
<div id="top-bar" class="row">
<div id="top-bar-title">How ${this._currentUnitEh ? ` - ${this._units.value[this._currentUnitEh].shortName}` : ''}</div>
<mwc-icon-button icon="view_module" @click=${this.toggleTreeType}></mwc-icon-button>
<mwc-icon-button icon="account_circle" @click=${() => {this._myProfileDialog.open()}}></mwc-icon-button>
${!isWeContext() ? html`<mwc-icon-button icon="account_circle" @click=${() => {this._myProfileDialog.open()}}></mwc-icon-button>`:''}
<mwc-icon-button icon="settings" @click=${() => {this._settings.show()}}></mwc-icon-button>
</div>
Expand All @@ -615,7 +616,7 @@ export class HowController extends ScopedElementsMixin(LitElement) {
${document}
</div>
<how-unit-dialog id="unit-dialog"
@unit-added=${(e:any)=>{this.handleNodeSelected(e); this.refresh();}}>
@unit-added=${(e:any)=>{this.handleNodeSelected(e); this.refresh();}}>
</how-unit-dialog>
</div>
Expand Down
9 changes: 8 additions & 1 deletion ui/src/holochain-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {howContext} from "./types"
import { localized, msg } from '@lit/localize';

import { ScopedElementsMixin } from "@open-wc/scoped-elements";
import { WeClient, isWeContext } from '@lightningrodlabs/we-applet';
import { WeClient, isWeContext, initializeHotReload } from '@lightningrodlabs/we-applet';

const appId = 'how'

Expand Down Expand Up @@ -57,6 +57,13 @@ export class HolochainApp extends ScopedElementsMixin(LitElement) {
avatarMode: "avatar-optional",
additionalFields: [], // "Location","Hashtags", "Bio"// Custom app level profile fields
};
if ((import.meta as any).env.DEV) {
try {
await initializeHotReload();
} catch (e) {
console.warn("Could not initialize applet hot-reloading. This is only expected to work in a We context in dev mode.")
}
}

if (!isWeContext()) {
const adminPort : string = import.meta.env.VITE_ADMIN_PORT
Expand Down

0 comments on commit a57e18f

Please sign in to comment.