Clean up dead code: remove unused components and functions

This commit is contained in:
Augustin ROUX 2025-10-18 22:42:24 +02:00
parent 2f5a177e32
commit 9eee694a2c
3 changed files with 1 additions and 209 deletions

View File

@ -1,43 +0,0 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Learn more about IDE Support for Vue in the
<a
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
target="_blank"
>Vue Docs Scaling up Guide</a
>.
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

View File

@ -1,157 +0,0 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
const latency = ref(0)
const quality = ref('excellent')
const lastCheckTime = ref(Date.now())
const props = defineProps({
checkInterval: {
type: Number,
default: 5000 // Check every 5 seconds
}
})
let intervalId = null
onMounted(() => {
checkNetworkStatus()
intervalId = setInterval(checkNetworkStatus, props.checkInterval)
})
onUnmounted(() => {
if (intervalId) clearInterval(intervalId)
})
async function checkNetworkStatus() {
const startTime = Date.now()
try {
const response = await fetch('/api/health', {
method: 'HEAD'
})
if (response.ok) {
const endTime = Date.now()
latency.value = endTime - startTime
updateQuality(latency.value)
}
} catch (error) {
latency.value = 0
quality.value = 'offline'
}
lastCheckTime.value = Date.now()
}
function updateQuality(lat) {
if (lat < 100) quality.value = 'excellent'
else if (lat < 300) quality.value = 'good'
else if (lat < 600) quality.value = 'fair'
else quality.value = 'poor'
}
function getStatusColor() {
switch (quality.value) {
case 'excellent': return '#4caf50'
case 'good': return '#8bc34a'
case 'fair': return '#ffc107'
case 'poor': return '#ff9800'
case 'offline': return '#f44336'
default: return '#666'
}
}
function getStatusEmoji() {
switch (quality.value) {
case 'excellent': return 'O'
case 'good': return 'O'
case 'fair': return 'O'
case 'poor': return 'O'
case 'offline': return 'O'
default: return 'O'
}
}
</script>
<template>
<div class="network-status" :style="{ backgroundColor: getStatusColor() }">
<div class="status-content">
<span class="emoji">{{ getStatusEmoji() }}</span>
<span class="text">
<span class="latency">{{ latency }}ms</span>
<span class="quality">{{ quality }}</span>
</span>
</div>
</div>
</template>
<style scoped>
.network-status {
position: fixed;
bottom: 2rem;
right: 2rem;
padding: 0.75rem 1.25rem;
border-radius: 20px;
color: white;
font-size: 0.85rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.5rem;
z-index: 40;
transition: all 0.3s;
border: 1px solid rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
}
.network-status:hover {
transform: scale(1.05);
border-color: rgba(255, 255, 255, 0.3);
box-shadow: 0 12px 40px rgba(31, 38, 135, 0.3);
}
.status-content {
display: flex;
align-items: center;
gap: 0.5rem;
}
.emoji {
font-size: 1rem;
display: inline-block;
}
.text {
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.latency {
display: block;
font-weight: 700;
font-size: 0.9rem;
}
.quality {
display: block;
font-size: 0.75rem;
opacity: 0.9;
text-transform: capitalize;
}
@media (max-width: 768px) {
.network-status {
bottom: 1rem;
right: 1rem;
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
}
.emoji {
font-size: 0.9rem;
}
}
</style>

View File

@ -52,13 +52,6 @@ export function useWebSocket(sessionId = null) {
} }
} }
function subscribe(params) {
send({
type: 'subscribe',
...params
})
}
onUnmounted(() => { onUnmounted(() => {
disconnect() disconnect()
}) })
@ -69,7 +62,6 @@ export function useWebSocket(sessionId = null) {
messages, messages,
connect, connect,
disconnect, disconnect,
send, send
subscribe
} }
} }