[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2024-05-09 20:53:02 +00:00
parent 4f7352f3ed
commit 6651aa6644
No known key found for this signature in database
GPG key ID: B66B2D63282C190F
6 changed files with 118 additions and 139 deletions

View file

@ -8,8 +8,6 @@ import chat_new_message from "./chat_new_message.vue";
import { getStationInfoByCallsign } from "./../js/stationHandler";
import { setActivePinia } from "pinia";
import pinia from "../store/index";
setActivePinia(pinia);
@ -119,12 +117,9 @@ watch(
});
},
);
</script>
<template>
<div class="container-fluid d-flex p-0">
<!-- Chat Conversations -->
<div class="bg-light p-0" style="width: 250px">

View file

@ -35,13 +35,10 @@ function newChat() {
if (callsign === "") return;
this.newChatCall.value = "";
}
function startNewChat(){
function startNewChat() {
chat.newChatCallsign = "";
chat.newChatMessage = "Hi there! Nice to meet you!"
chat.newChatMessage = "Hi there! Nice to meet you!";
}
</script>
<template>

View file

@ -16,7 +16,6 @@ const chat = useChatStore(pinia);
import { getStationInfoByCallsign } from "./../../js/stationHandler";
function getDateTime(timestampRaw) {
var datetime = new Date(timestampRaw * 1000).toLocaleString(
navigator.language,
@ -68,10 +67,9 @@ function getActivityInfo(activityType) {
}
}
function startNewChat(callsign){
function startNewChat(callsign) {
chat.newChatCallsign = callsign;
chat.newChatMessage = "Hi there! Nice to meet you!"
chat.newChatMessage = "Hi there! Nice to meet you!";
}
</script>
<template>
@ -111,7 +109,6 @@ function startNewChat(callsign){
</td>
<td>{{ item.frequency / 1000 }} kHz</td>
<td>
<button
class="btn btn-sm btn-outline-secondary ms-2 border-0"
data-bs-target="#dxStationInfoModal"
@ -127,7 +124,6 @@ function startNewChat(callsign){
data-bs-target="#newChatModal"
data-bs-toggle="modal"
@click="startNewChat(item.origin)"
>
<i class="bi bi-pencil-square"></i>
</button>

View file

@ -15,9 +15,10 @@ const station = useStationStore(pinia);
import { useStateStore } from "../store/stateStore.js";
const state = useStateStore(pinia);
import { getStationInfoByCallsign, setStationInfoByCallsign } from "../js/stationHandler.js";
import {
getStationInfoByCallsign,
setStationInfoByCallsign,
} from "../js/stationHandler.js";
import { settingsStore } from "../store/settingsStore.js";
@ -124,8 +125,6 @@ const transmissionSpeedChartDataMessageInfo = computed(() => ({
],
}));
/*
const stationInfoData = ref({
name: "",
@ -164,23 +163,18 @@ onMounted(() => {
modalElement.addEventListener("show.bs.modal", fetchMyStationInfo);
});
function fetchMyStationInfo(){
function fetchMyStationInfo() {
let mycall = settingsStore.remote.STATION.mycall;
let myssid = settingsStore.remote.STATION.myssid;
let fullCall = `${mycall}-${myssid}`;
getStationInfoByCallsign(fullCall)
getStationInfoByCallsign(fullCall);
}
</script>
<template>
<main_startup_check />
<!-- Station Info Modal -->
<!-- Station Info Modal -->
<div
class="modal fade"
ref="modalEle"
@ -191,7 +185,6 @@ function fetchMyStationInfo(){
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="p-0 m-0">{{ station.stationInfo.callsign }}</h4>
<button
type="button"
@ -201,8 +194,7 @@ function fetchMyStationInfo(){
></button>
</div>
<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
@ -1550,7 +1542,9 @@ function fetchMyStationInfo(){
<!-- Social Media Inputs -->
<div class="mb-3">
<div v-for="(url, platform) in station.stationInfo.info.socialMedia">
<div
v-for="(url, platform) in station.stationInfo.info.socialMedia"
>
<div class="input-group mb-1" :key="platform">
<span class="input-group-text"
><i :class="`bi bi-${platform}`"></i

View file

@ -1,16 +1,16 @@
import { useStationStore } from "../store/stationStore.js";
const station = useStationStore();
const station = useStationStore();
import { getStationInfo, setStationInfo } from "../js/api";
export async function getStationInfoByCallsign(callsign) {
try {
const result = await getStationInfo(callsign);
console.log(result)
console.log(result);
station.stationInfo.callsign = result.callsign || "N/A";
station.stationInfo.location.gridsquare = result.location?.gridsquare || "N/A";
station.stationInfo.location.gridsquare =
result.location?.gridsquare || "N/A";
// Check if info is null and assign default values if it is
if (result.info === null) {
station.stationInfo.value.info = {
@ -53,15 +53,12 @@ export async function getStationInfoByCallsign(callsign) {
comments: result.info.comments || "",
};
}
} catch (error) {
console.error("Error fetching station info:", error);
}
}
export async function setStationInfoByCallsign(callsign){
console.log(station.stationInfo)
setStationInfo(callsign, station.stationInfo)
}
export async function setStationInfoByCallsign(callsign) {
console.log(station.stationInfo);
setStationInfo(callsign, station.stationInfo);
}

View file

@ -25,9 +25,9 @@ export const useStationStore = defineStore("stationStore", () => {
tiktok: "",
},
comments: "",
}
},
});
return{
stationInfo
}
return {
stationInfo,
};
});