diff --git a/src/components/InitialSetup.ts b/src/components/InitialSetup.ts
index 76dfd1e..708e4e8 100644
--- a/src/components/InitialSetup.ts
+++ b/src/components/InitialSetup.ts
@@ -17,6 +17,7 @@ import '@components/General/Fieldset';
import '@components/General/Input';
import '@components/LoadingView';
import '@components/ProgressSteps';
+import '@components/RelayLogs';
@customElement('arx-initial-setup')
export class InitialSetup extends LitElement {
@@ -395,8 +396,7 @@ export class InitialSetup extends LitElement {
${this.relayStatus.logs.slice(-5).join('\n')}- `, +
Having trouble? Our team is here to help if you encounter any diff --git a/src/components/RelayLogs.ts b/src/components/RelayLogs.ts new file mode 100644 index 0000000..d3939cc --- /dev/null +++ b/src/components/RelayLogs.ts @@ -0,0 +1,39 @@ +import { ansiToLitHtml } from '@/utils/ansiToLitHtml'; +import { LitElement, css, html } from 'lit'; +import { customElement, property } from 'lit/decorators.js'; +import { map } from 'lit/directives/map.js'; + +@customElement('arx-relay-logs') +export class RelayLogs extends LitElement { + static override styles = css` + :host { + display: block; + font-family: var(--font-family, "Inter", system-ui, sans-serif); + margin: 0 auto; + line-height: 1.6; + color: var(--color-base-content); + } + + .relay-logs { + white-space: pre-wrap; + word-wrap: break-word; + overflow-wrap: break-word; + overflow-x: auto; + max-height: 200px; + padding: 1rem; + border: 2px solid var(--color-base-300); + border-radius: var(--radius-box); + border-radius: var(--radius-md); + background-color: var(--color-code-block); + color: var(--color-code-block-content); + } + `; + + @property({ type: Array }) logs: string[] = []; + + override render() { + return html` +
${map(this.logs, (log) => ansiToLitHtml(log))}+ `; + } +} diff --git a/src/routes/Settings.ts b/src/routes/Settings.ts index 4886845..32edf75 100644 --- a/src/routes/Settings.ts +++ b/src/routes/Settings.ts @@ -12,6 +12,7 @@ import '@components/General/Button'; import '@components/General/Card'; import '@components/General/Fieldset'; import '@components/General/Input'; +import '@components/RelayLogs'; @customElement('arx-settings') export class EveSettings extends LitElement { @@ -61,11 +62,22 @@ export class EveSettings extends LitElement { @state() private profile: NDKUserProfile | undefined; @state() private error: string | undefined; @state() private darkMode = false; + @state() private relayStatus: { running: boolean; pid: number | null; logs: string[] } = { + running: false, + pid: null, + logs: [], + }; + + private async updateRelayStatus() { + this.relayStatus = await window.relay.getStatus(); + if (this.relayStatus.running) setTimeout(() => this.updateRelayStatus(), 2000); + } protected override async firstUpdated() { try { this.profile = await getUserProfile(); this.darkMode = localStorage.getItem('darkMode') === 'true'; + this.updateRelayStatus(); this.loading = false; } catch (err) { this.error = 'Failed to load profile'; @@ -176,6 +188,14 @@ export class EveSettings extends LitElement { > +
+ ${this.relayStatus.running ? `Relay is running. PID: ${this.relayStatus.pid}` : 'Relay is not running'} +
+