start implementing nomadnet node page browser
This commit is contained in:
@@ -209,6 +209,9 @@
|
||||
<!-- chat view -->
|
||||
<div class="flex flex-col flex-1 py-2">
|
||||
|
||||
<!-- peer -->
|
||||
<template v-if="!selectedNode">
|
||||
|
||||
<!-- peer selected -->
|
||||
<div v-if="selectedPeer" class="flex flex-col h-full border rounded-xl bg-white shadow">
|
||||
|
||||
@@ -437,6 +440,51 @@
|
||||
<div>Select a Peer to start chatting!</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<!-- node -->
|
||||
<div v-if="selectedNode" class="flex flex-col h-full border rounded-xl bg-white shadow">
|
||||
|
||||
<!-- header -->
|
||||
<!-- todo: peer icon -->
|
||||
<!-- todo: node icon -->
|
||||
<div class="flex p-2 border-b border-gray-300">
|
||||
|
||||
<!-- node info -->
|
||||
<div>
|
||||
<div class="font-semibold">{{ selectedNode.name }}</div>
|
||||
<div class="text-sm">@<{{ selectedNode.destination_hash }}></div>
|
||||
</div>
|
||||
|
||||
<!-- close button -->
|
||||
<div class="my-auto ml-auto mr-2">
|
||||
<div @click="selectedNode = null" href="javascript:void(0)" class="cursor-pointer">
|
||||
<div class="flex text-gray-700 bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
||||
<path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- browser navigation -->
|
||||
<div class="w-full border-gray-300 border-b p-2">
|
||||
NAV BAR
|
||||
</div>
|
||||
|
||||
<!-- page content -->
|
||||
<div class="h-full overflow-y-scroll px-3 sm:px-0">
|
||||
<div class="flex flex-col space-y-3 p-3">
|
||||
{{ nodePageContent }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -478,6 +526,8 @@
|
||||
lxmfMessagesRequestSequence: 0,
|
||||
chatItems: [],
|
||||
|
||||
nodePageContent: null,
|
||||
|
||||
nomadnetPageDownloadCallbacks: {},
|
||||
nomadnetFileDownloadCallbacks: {},
|
||||
|
||||
@@ -780,7 +830,7 @@
|
||||
"display_name": this.displayName,
|
||||
});
|
||||
},
|
||||
async downloadNomadNetFile(destinationHash, filePath, onSuccessCallback, onFailureCallback, onProgressCallback) {
|
||||
downloadNomadNetFile(destinationHash, filePath, onSuccessCallback, onFailureCallback, onProgressCallback) {
|
||||
|
||||
// do nothing if not connected to websocket
|
||||
if(!this.isWebsocketConnected){
|
||||
@@ -811,7 +861,7 @@
|
||||
}
|
||||
|
||||
},
|
||||
async downloadNomadNetPage(destinationHash, pagePath, onSuccessCallback, onFailureCallback, onProgressCallback) {
|
||||
downloadNomadNetPage(destinationHash, pagePath, onSuccessCallback, onFailureCallback, onProgressCallback) {
|
||||
|
||||
// do nothing if not connected to websocket
|
||||
if(!this.isWebsocketConnected){
|
||||
@@ -948,6 +998,19 @@
|
||||
// do nothing if failed to load messages
|
||||
}
|
||||
},
|
||||
async loadNodeIndexPage(node) {
|
||||
this.nodePageContent = "Requesting page: /page/index.mu";
|
||||
this.downloadNomadNetPage(node.destination_hash, "/page/index.mu", (pageContent) => {
|
||||
console.log("pageContent", pageContent);
|
||||
this.nodePageContent = pageContent;
|
||||
}, (failureReason) => {
|
||||
console.log("failureReason", failureReason);
|
||||
this.nodePageContent = `Failed loading page: ${failureReason}`;
|
||||
}, (progress) => {
|
||||
console.log("progress", progress);
|
||||
this.nodePageContent = `Loading page: ${progress}`;
|
||||
});
|
||||
},
|
||||
async deleteChatItem(chatItem) {
|
||||
try {
|
||||
|
||||
@@ -1012,6 +1075,7 @@
|
||||
onNodeClick: function(node) {
|
||||
this.selectedPeer = null;
|
||||
this.selectedNode = node;
|
||||
this.loadNodeIndexPage(node);
|
||||
},
|
||||
parseSeconds: function(secondsToFormat) {
|
||||
secondsToFormat = Number(secondsToFormat);
|
||||
|
||||
Reference in New Issue
Block a user