mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-11-22 07:56:21 -05:00
add ability to enable/disable telephone
This commit is contained in:
parent
63be82f601
commit
a366e8ff39
2 changed files with 101 additions and 12 deletions
|
|
@ -247,12 +247,16 @@
|
|||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 0 0 2.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 0 1-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 0 0-1.091-.852H4.5A2.25 2.25 0 0 0 2.25 4.5v2.25Z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="my-auto dark:text-white">Calls</div>
|
||||
<div class="ml-auto">
|
||||
<a @click.stop href="../call.html" target="_blank" class="my-auto inline-flex items-center gap-x-1 rounded-md bg-gray-500 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500
|
||||
dark:bg-zinc-800 dark:text-white dark:hover:bg-zinc-700 dark:focus-visible:outline-zinc-500
|
||||
">
|
||||
<span>Open Phone</span>
|
||||
<div class="my-auto dark:text-white">Phone</div>
|
||||
<div class="ml-auto space-x-1">
|
||||
<button v-if="telephoneEnabled" @click.stop="disableTelephone" type="button" class="my-auto inline-flex items-center gap-x-1 rounded-md bg-gray-500 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500 dark:bg-zinc-800 dark:text-white dark:hover:bg-zinc-700 dark:focus-visible:outline-zinc-500">
|
||||
<span>Disable</span>
|
||||
</button>
|
||||
<button v-if="!telephoneEnabled" @click.stop="enableTelephone" type="button" class="my-auto inline-flex items-center gap-x-1 rounded-md bg-gray-500 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500 dark:bg-zinc-800 dark:text-white dark:hover:bg-zinc-700 dark:focus-visible:outline-zinc-500">
|
||||
<span>Enable</span>
|
||||
</button>
|
||||
<a @click.stop href="../call.html" target="_blank" class="my-auto inline-flex items-center gap-x-1 rounded-md bg-gray-500 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500 dark:bg-zinc-800 dark:text-white dark:hover:bg-zinc-700 dark:focus-visible:outline-zinc-500">
|
||||
<span>Open</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
||||
<path fill-rule="evenodd" d="M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z" clip-rule="evenodd" />
|
||||
<path fill-rule="evenodd" d="M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z" clip-rule="evenodd" />
|
||||
|
|
@ -261,7 +265,13 @@ dark:bg-zinc-800 dark:text-white dark:hover:bg-zinc-700 dark:focus-visible:outli
|
|||
</div>
|
||||
</div>
|
||||
<div v-if="isShowingCallsSection" class="divide-y text-gray-900 border-t border-gray-300 dark:border-zinc-900">
|
||||
<div class="p-1 flex dark:border-zinc-900 dark:text-white">
|
||||
<div v-if="!telephoneEnabled" class="p-1 flex dark:border-zinc-900 dark:text-white">
|
||||
<div>
|
||||
<div>Status</div>
|
||||
<div class="text-sm">Disabled</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="telephoneEnabled" class="p-1 flex dark:border-zinc-900 dark:text-white">
|
||||
<div>
|
||||
<div>
|
||||
<span v-if="activeCall && activeCall.status === 6">Active Call</span>
|
||||
|
|
@ -277,7 +287,7 @@ dark:bg-zinc-800 dark:text-white dark:hover:bg-zinc-700 dark:focus-visible:outli
|
|||
<span v-else>Unknown Caller</span>
|
||||
</span>
|
||||
</div>
|
||||
<div v-else>Hung up, waiting for call...</div>
|
||||
<div v-else>Available. Waiting for call...</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="activeCall" class="ml-auto my-auto mr-1 space-x-2">
|
||||
|
|
@ -342,6 +352,7 @@ export default {
|
|||
config: null,
|
||||
appInfo: null,
|
||||
|
||||
telephoneEnabled: false,
|
||||
activeCall: null,
|
||||
propagationNodeStatus: null,
|
||||
|
||||
|
|
@ -540,6 +551,7 @@ export default {
|
|||
const response = await axios.get("/api/v1/telephone/status");
|
||||
|
||||
// update ui
|
||||
this.telephoneEnabled = response.data.enabled;
|
||||
this.activeCall = response.data.active_call;
|
||||
|
||||
} catch(e) {
|
||||
|
|
@ -572,6 +584,32 @@ export default {
|
|||
// ignore error hanging up call
|
||||
}
|
||||
},
|
||||
async enableTelephone() {
|
||||
try {
|
||||
|
||||
// enable telephone
|
||||
await axios.get(`/api/v1/telephone/enable`);
|
||||
|
||||
// update ui
|
||||
await this.getTelephoneStatus();
|
||||
|
||||
} catch(e) {
|
||||
// ignore error
|
||||
}
|
||||
},
|
||||
async disableTelephone() {
|
||||
try {
|
||||
|
||||
// disable telephone
|
||||
await axios.get(`/api/v1/telephone/disable`);
|
||||
|
||||
// update ui
|
||||
await this.getTelephoneStatus();
|
||||
|
||||
} catch(e) {
|
||||
// ignore error
|
||||
}
|
||||
},
|
||||
onAppNameClick() {
|
||||
// user may be on mobile, and is unable to scroll back to sidebar, so let them tap app name to do it
|
||||
this.$refs["middle"].scrollTo({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue