[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2024-05-02 09:56:17 +00:00
parent 9db2f58f6b
commit 01f0b0d09a
No known key found for this signature in database
GPG key ID: B66B2D63282C190F
2 changed files with 173 additions and 103 deletions

View file

@ -113,5 +113,4 @@ function toggleTextVisibility() {
<i class="bi bi-person-circle h3"></i> <i class="bi bi-person-circle h3"></i>
<span class="ms-2" v-if="isTextVisible">Station</span> <span class="ms-2" v-if="isTextVisible">Station</span>
</button> </button>
</template> </template>

View file

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
// @ts-nocheck // @ts-nocheck
// reason for no check is, that we have some mixing of typescript and chart js which seems to be not to be fixed that easy // reason for no check is, that we have some mixing of typescript and chart js which seems to be not to be fixed that easy
import { ref, onMounted } from 'vue'; import { ref, onMounted } from "vue";
import { setActivePinia } from "pinia"; import { setActivePinia } from "pinia";
import pinia from "../store/index"; import pinia from "../store/index";
@ -118,45 +118,39 @@ const transmissionSpeedChartDataMessageInfo = computed(() => ({
], ],
})); }));
const stationInfoData = ref({ const stationInfoData = ref({
name: '', name: "",
city: '', city: "",
age: '', age: "",
radio: '', radio: "",
antenna: '', antenna: "",
email: '', email: "",
website: '', website: "",
socialMedia: { socialMedia: {
facebook: '', facebook: "",
'twitter-x': '', // Use twitter-x to correspond to the Twitter X icon "twitter-x": "", // Use twitter-x to correspond to the Twitter X icon
mastodon: '', mastodon: "",
instagram: '', instagram: "",
linkedin: '', linkedin: "",
youtube: '', youtube: "",
tiktok: '' tiktok: "",
}, },
comments: '' comments: "",
}); });
// Function to handle updates and save changes // Function to handle updates and save changes
function updateStationInfo() { function updateStationInfo() {
console.log('Updating station info:', stationInfoData.value); console.log("Updating station info:", stationInfoData.value);
let mycall = settingsStore.remote.STATION.mycall; let mycall = settingsStore.remote.STATION.mycall;
let myssid = settingsStore.remote.STATION.myssid; let myssid = settingsStore.remote.STATION.myssid;
let fullCall = `${mycall}-${myssid}`; let fullCall = `${mycall}-${myssid}`;
setStationInfo(fullCall, stationInfoData.value) setStationInfo(fullCall, stationInfoData.value);
} }
// Fixme: this is a dirty hack. Can we make this more VueJS like? // Fixme: this is a dirty hack. Can we make this more VueJS like?
onMounted(() => { onMounted(() => {
const modalElement = document.getElementById('stationInfoModal'); const modalElement = document.getElementById("stationInfoModal");
modalElement.addEventListener('show.bs.modal', fetchStationInfo); modalElement.addEventListener("show.bs.modal", fetchStationInfo);
}); });
async function fetchStationInfo() { async function fetchStationInfo() {
@ -166,29 +160,25 @@ async function fetchStationInfo(){
let result = await getStationInfo(fullCall); let result = await getStationInfo(fullCall);
let info = result.info; let info = result.info;
stationInfoData.value = { stationInfoData.value = {
name: info.name || '', name: info.name || "",
city: info.city || '', city: info.city || "",
age: info.age || '', age: info.age || "",
radio: info.radio || '', radio: info.radio || "",
antenna: info.antenna || '', antenna: info.antenna || "",
email: info.email || '', email: info.email || "",
website: info.website || '', website: info.website || "",
socialMedia: { socialMedia: {
facebook: info.socialMedia.facebook || '', facebook: info.socialMedia.facebook || "",
'twitter-x': info.socialMedia['twitter-x'] || '', "twitter-x": info.socialMedia["twitter-x"] || "",
mastodon: info.socialMedia.mastodon || '', mastodon: info.socialMedia.mastodon || "",
instagram: info.socialMedia.instagram || '', instagram: info.socialMedia.instagram || "",
linkedin: info.socialMedia.linkedin || '', linkedin: info.socialMedia.linkedin || "",
youtube: info.socialMedia.youtube || '', youtube: info.socialMedia.youtube || "",
tiktok: info.socialMedia.tiktok || '' tiktok: info.socialMedia.tiktok || "",
}, },
comments: info.comments || '' comments: info.comments || "",
}; };
} }
</script> </script>
<template> <template>
@ -1313,8 +1303,6 @@ let info = result.info;
</div> </div>
</div> </div>
<!-- AUDIO MODAL --> <!-- AUDIO MODAL -->
<div <div
class="modal fade" class="modal fade"
@ -1389,7 +1377,13 @@ let info = result.info;
</div> </div>
<!-- STATION INFO MODAL --> <!-- STATION INFO MODAL -->
<div class="modal fade" id="stationInfoModal" tabindex="-1" aria-labelledby="stationInfoModal" aria-hidden="true"> <div
class="modal fade"
id="stationInfoModal"
tabindex="-1"
aria-labelledby="stationInfoModal"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-scrollable"> <div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -1399,83 +1393,160 @@ let info = result.info;
{{ settingsStore.remote.STATION.myssid }} {{ settingsStore.remote.STATION.myssid }}
</h1> </h1>
<span class="badge text-bg-secondary ms-3">{{settingsStore.remote.STATION.mygrid }}</span> <span class="badge text-bg-secondary ms-3">{{
settingsStore.remote.STATION.mygrid
}}</span>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="alert alert-primary" role="alert"> <div class="alert alert-primary" role="alert">
<strong> Please note:</strong> This is a preview to show you the direction, FreeDATA is going somewhen. For now you can save only your personal data, so we can optimize and improve the database. In future this data can be requested by a remote station. <strong> Please note:</strong> This is a preview to show you the
direction, FreeDATA is going somewhen. For now you can save only
your personal data, so we can optimize and improve the database. In
future this data can be requested by a remote station.
</div> </div>
<!-- Name --> <!-- Name -->
<div class="input-group mb-1"> <div class="input-group mb-1">
<span class="input-group-text"><i class="bi bi-person-fill"></i></span> <span class="input-group-text"
<input type="text" class="form-control" placeholder="Name" v-model="stationInfoData.name" > ><i class="bi bi-person-fill"></i
></span>
<input
type="text"
class="form-control"
placeholder="Name"
v-model="stationInfoData.name"
/>
</div> </div>
<!-- City --> <!-- City -->
<div class="input-group mb-1"> <div class="input-group mb-1">
<span class="input-group-text"><i class="bi bi-geo-alt-fill"></i></span> <span class="input-group-text"
<input type="text" class="form-control" placeholder="City" v-model="stationInfoData.city" > ><i class="bi bi-geo-alt-fill"></i
></span>
<input
type="text"
class="form-control"
placeholder="City"
v-model="stationInfoData.city"
/>
</div> </div>
<!-- Age --> <!-- Age -->
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-text"><i class="bi bi-person-fill"></i></span> <span class="input-group-text"
<input type="text" class="form-control" placeholder="Age" v-model="stationInfoData.age" > ><i class="bi bi-person-fill"></i
></span>
<input
type="text"
class="form-control"
placeholder="Age"
v-model="stationInfoData.age"
/>
</div> </div>
<!-- Radio --> <!-- Radio -->
<div class="input-group mb-1"> <div class="input-group mb-1">
<span class="input-group-text"><i class="bi bi-broadcast-pin"></i></span> <span class="input-group-text"
<input type="text" class="form-control" placeholder="Radio" v-model="stationInfoData.radio" > ><i class="bi bi-broadcast-pin"></i
></span>
<input
type="text"
class="form-control"
placeholder="Radio"
v-model="stationInfoData.radio"
/>
</div> </div>
<!-- Antenna --> <!-- Antenna -->
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-text"><i class="bi bi-cone-striped"></i></span> <span class="input-group-text"
<input type="text" class="form-control" placeholder="Antenna" v-model="stationInfoData.antenna" > ><i class="bi bi-cone-striped"></i
></span>
<input
type="text"
class="form-control"
placeholder="Antenna"
v-model="stationInfoData.antenna"
/>
</div> </div>
<!-- Website --> <!-- Website -->
<div class="input-group mb-1"> <div class="input-group mb-1">
<span class="input-group-text"><i class="bi bi-globe"></i></span> <span class="input-group-text"><i class="bi bi-globe"></i></span>
<input type="url" class="form-control" placeholder="Website" v-model="stationInfoData.website" > <input
type="url"
class="form-control"
placeholder="Website"
v-model="stationInfoData.website"
/>
</div> </div>
<!-- Email --> <!-- Email -->
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-text"><i class="bi bi-envelope-fill"></i></span> <span class="input-group-text"
<input type="email" class="form-control" placeholder="Email" v-model="stationInfoData.email" > ><i class="bi bi-envelope-fill"></i
></span>
<input
type="email"
class="form-control"
placeholder="Email"
v-model="stationInfoData.email"
/>
</div> </div>
<!-- Social Media Inputs --> <!-- Social Media Inputs -->
<div class="mb-3"> <div class="mb-3">
<div v-for="(url, platform) in stationInfoData.socialMedia"> <div v-for="(url, platform) in stationInfoData.socialMedia">
<div class="input-group mb-1" :key="platform"> <div class="input-group mb-1" :key="platform">
<span class="input-group-text"><i :class="`bi bi-${platform}`"></i></span> <span class="input-group-text"
<input type="url" class="form-control" :placeholder="`${platform.charAt(0).toUpperCase() + platform.slice(1)} URL`" v-model="stationInfoData.socialMedia[platform]" > ><i :class="`bi bi-${platform}`"></i
></span>
<input
type="url"
class="form-control"
:placeholder="`${platform.charAt(0).toUpperCase() + platform.slice(1)} URL`"
v-model="stationInfoData.socialMedia[platform]"
/>
</div> </div>
</div> </div>
</div> </div>
<!-- Comments --> <!-- Comments -->
<div class="mb-3"> <div class="mb-3">
<label class="input-group-text" for="comments"><i class="bi bi-textarea-resize"></i> Comments</label> <label class="input-group-text" for="comments"
<textarea class="form-control" rows="3" v-model="stationInfoData.comments" ></textarea> ><i class="bi bi-textarea-resize"></i> Comments</label
>
<textarea
class="form-control"
rows="3"
v-model="stationInfoData.comments"
></textarea>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> type="button"
<button type="button" class="btn btn-primary" @click="updateStationInfo">Save changes</button> class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
@click="updateStationInfo"
>
Save changes
</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>