mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
[CodeFactor] Apply fixes
This commit is contained in:
parent
4f7352f3ed
commit
6651aa6644
6 changed files with 118 additions and 139 deletions
|
@ -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">
|
||||
|
|
|
@ -35,13 +35,10 @@ function newChat() {
|
|||
if (callsign === "") return;
|
||||
this.newChatCall.value = "";
|
||||
}
|
||||
function startNewChat(){
|
||||
chat.newChatCallsign = "";
|
||||
chat.newChatMessage = "Hi there! Nice to meet you!"
|
||||
|
||||
function startNewChat() {
|
||||
chat.newChatCallsign = "";
|
||||
chat.newChatMessage = "Hi there! Nice to meet you!";
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -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){
|
||||
chat.newChatCallsign = callsign;
|
||||
chat.newChatMessage = "Hi there! Nice to meet you!"
|
||||
|
||||
function startNewChat(callsign) {
|
||||
chat.newChatCallsign = callsign;
|
||||
chat.newChatMessage = "Hi there! Nice to meet you!";
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
@ -111,26 +109,24 @@ 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"
|
||||
data-bs-toggle="modal"
|
||||
@click="getStationInfoByCallsign(item.origin)"
|
||||
disabled
|
||||
>
|
||||
<h6 class="p-0 m-0">{{ item.origin }}</h6>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="btn btn-sm btn-outline-secondary ms-2 border-0"
|
||||
data-bs-target="#dxStationInfoModal"
|
||||
data-bs-toggle="modal"
|
||||
@click="getStationInfoByCallsign(item.origin)"
|
||||
disabled
|
||||
>
|
||||
<h6 class="p-0 m-0">{{ item.origin }}</h6>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="btn btn-sm border-0 btn-outline-primary"
|
||||
data-bs-target="#newChatModal"
|
||||
data-bs-toggle="modal"
|
||||
@click="startNewChat(item.origin)"
|
||||
|
||||
>
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</button>
|
||||
class="btn btn-sm border-0 btn-outline-primary"
|
||||
data-bs-target="#newChatModal"
|
||||
data-bs-toggle="modal"
|
||||
@click="startNewChat(item.origin)"
|
||||
>
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
{{ item.gridsquare }}
|
||||
|
|
|
@ -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,19 +194,18 @@ 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
|
||||
future this data can be requested by a remote station.
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li v-for="(value, key) in station.stationInfo.info" :key="key">
|
||||
<strong>{{ key }}:</strong> {{ value }}
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li v-for="(value, key) in station.stationInfo.info" :key="key">
|
||||
<strong>{{ key }}:</strong> {{ value }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
@ -454,7 +446,7 @@ function fetchMyStationInfo(){
|
|||
2. Enter a first message
|
||||
<br />
|
||||
3. Click "START NEW CHAT"
|
||||
<br />
|
||||
<br />
|
||||
4. Check the chat tab on left side for messages
|
||||
</div>
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -1,67 +1,64 @@
|
|||
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)
|
||||
|
||||
station.stationInfo.callsign = result.callsign || "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 = {
|
||||
name: "",
|
||||
city: "",
|
||||
age: "",
|
||||
radio: "",
|
||||
antenna: "",
|
||||
email: "",
|
||||
website: "",
|
||||
socialMedia: {
|
||||
facebook: "",
|
||||
"twitter-x": "",
|
||||
mastodon: "",
|
||||
instagram: "",
|
||||
linkedin: "",
|
||||
youtube: "",
|
||||
tiktok: "",
|
||||
},
|
||||
comments: "",
|
||||
};
|
||||
} else {
|
||||
station.stationInfo.info = {
|
||||
name: result.info.name || "",
|
||||
city: result.info.city || "",
|
||||
age: result.info.age || "",
|
||||
radio: result.info.radio || "",
|
||||
antenna: result.info.antenna || "",
|
||||
email: result.info.email || "",
|
||||
website: result.info.website || "",
|
||||
socialMedia: {
|
||||
facebook: result.info.socialMedia.facebook || "",
|
||||
"twitter-x": result.info.socialMedia["twitter-x"] || "",
|
||||
mastodon: result.info.socialMedia.mastodon || "",
|
||||
instagram: result.info.socialMedia.instagram || "",
|
||||
linkedin: result.info.socialMedia.linkedin || "",
|
||||
youtube: result.info.socialMedia.youtube || "",
|
||||
tiktok: result.info.socialMedia.tiktok || "",
|
||||
},
|
||||
comments: result.info.comments || "",
|
||||
};
|
||||
}
|
||||
|
||||
console.log(result);
|
||||
|
||||
station.stationInfo.callsign = result.callsign || "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 = {
|
||||
name: "",
|
||||
city: "",
|
||||
age: "",
|
||||
radio: "",
|
||||
antenna: "",
|
||||
email: "",
|
||||
website: "",
|
||||
socialMedia: {
|
||||
facebook: "",
|
||||
"twitter-x": "",
|
||||
mastodon: "",
|
||||
instagram: "",
|
||||
linkedin: "",
|
||||
youtube: "",
|
||||
tiktok: "",
|
||||
},
|
||||
comments: "",
|
||||
};
|
||||
} else {
|
||||
station.stationInfo.info = {
|
||||
name: result.info.name || "",
|
||||
city: result.info.city || "",
|
||||
age: result.info.age || "",
|
||||
radio: result.info.radio || "",
|
||||
antenna: result.info.antenna || "",
|
||||
email: result.info.email || "",
|
||||
website: result.info.website || "",
|
||||
socialMedia: {
|
||||
facebook: result.info.socialMedia.facebook || "",
|
||||
"twitter-x": result.info.socialMedia["twitter-x"] || "",
|
||||
mastodon: result.info.socialMedia.mastodon || "",
|
||||
instagram: result.info.socialMedia.instagram || "",
|
||||
linkedin: result.info.socialMedia.linkedin || "",
|
||||
youtube: result.info.socialMedia.youtube || "",
|
||||
tiktok: result.info.socialMedia.tiktok || "",
|
||||
},
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -2,32 +2,32 @@ import { defineStore } from "pinia";
|
|||
import { ref } from "vue";
|
||||
import * as bootstrap from "bootstrap";
|
||||
export const useStationStore = defineStore("stationStore", () => {
|
||||
const stationInfo = ref({
|
||||
callsign: "N/A", // Default value for callsign
|
||||
location: {
|
||||
gridsquare: "N/A", // Default value for gridsquare
|
||||
},
|
||||
info: {
|
||||
name: "",
|
||||
city: "",
|
||||
age: "",
|
||||
radio: "",
|
||||
antenna: "",
|
||||
email: "",
|
||||
website: "",
|
||||
socialMedia: {
|
||||
facebook: "",
|
||||
"twitter-x": "", // Use twitter-x to correspond to the Twitter X icon
|
||||
mastodon: "",
|
||||
instagram: "",
|
||||
linkedin: "",
|
||||
youtube: "",
|
||||
tiktok: "",
|
||||
},
|
||||
comments: "",
|
||||
}
|
||||
});
|
||||
return{
|
||||
stationInfo
|
||||
}
|
||||
const stationInfo = ref({
|
||||
callsign: "N/A", // Default value for callsign
|
||||
location: {
|
||||
gridsquare: "N/A", // Default value for gridsquare
|
||||
},
|
||||
info: {
|
||||
name: "",
|
||||
city: "",
|
||||
age: "",
|
||||
radio: "",
|
||||
antenna: "",
|
||||
email: "",
|
||||
website: "",
|
||||
socialMedia: {
|
||||
facebook: "",
|
||||
"twitter-x": "", // Use twitter-x to correspond to the Twitter X icon
|
||||
mastodon: "",
|
||||
instagram: "",
|
||||
linkedin: "",
|
||||
youtube: "",
|
||||
tiktok: "",
|
||||
},
|
||||
comments: "",
|
||||
},
|
||||
});
|
||||
return {
|
||||
stationInfo,
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue