1+ <script setup>
2+ import { ref , onMounted } from ' vue'
3+
4+ const { ipcRenderer } = window .electron
5+ const conversions = ref ([])
6+ const isLoading = ref (false )
7+ // Function to fetch history data
8+ const refreshHistory = async () => {
9+ isLoading .value = true
10+ try {
11+ const result = await ipcRenderer .invoke (' db:get-data' )
12+ if (result .success ) {
13+ conversions .value = result .conversions
14+ } else {
15+ console .error (' Failed to load conversions:' , result .error )
16+ }
17+ } catch (error) {
18+ console .error (' Error loading conversion history:' , error)
19+ } finally {
20+ isLoading .value = false
21+ }
22+ }
23+ onMounted (async () => {
24+ await refreshHistory ()
25+ })
26+ </script >
27+
128<template >
2- <img src =" ../assets/not-ready.svg" alt =" " >
3- <h2 class =" text-orange-600" >History Under construction</h2 >
29+ <div class =" mt-2 flex justify-end" >
30+ <button
31+ class =" btn btn-sm btn-primary btn-outline"
32+ @click =" refreshHistory"
33+ :disabled =" isLoading"
34+ >
35+ {{ isLoading ? 'Loading...' : 'Refresh History' }}
36+ </button >
37+ </div >
38+ <div class =" container p-4" >
39+ <div v-if =" isLoading" class =" w-full" >
40+ <div class =" skeleton h-8 w-full mb-4" ></div >
41+ <div class =" skeleton h-8 w-full mb-2" ></div >
42+ <div class =" skeleton h-8 w-full mb-2" ></div >
43+ <div class =" skeleton h-8 w-full mb-2" ></div >
44+ </div >
45+
46+ <div v-else class =" overflow-x-auto rounded-box border border-base-content/5 bg-base-100 max-h-[calc(100vh-9rem)] overflow-y-auto" >
47+ <table class =" table w-full" >
48+ <thead >
49+ <tr >
50+ <th >Filename</th >
51+ <th >Format</th >
52+ <th >Resolution</th >
53+ <th >Size</th >
54+ <th >Date</th >
55+ </tr >
56+ </thead >
57+ <tbody >
58+ <tr v-if =" conversions.length === 0" >
59+ <td colspan =" 5" class =" text-center py-4" >No conversion history found</td >
60+ </tr >
61+ <tr v-for =" conv in conversions" :key =" conv.id" class =" hover:bg-base-200" >
62+ <td >{{ conv.filename }}</td >
63+ <td >{{ conv.format?.toUpperCase() }}</td >
64+ <td >{{ conv.resolution || 'N/A' }}</td >
65+ <td >{{ conv.size }}</td >
66+ <td >{{ new Date(conv.created_at).toLocaleString() }}</td >
67+ </tr >
68+ </tbody >
69+ </table >
70+ </div >
71+ </div >
472</template >
0 commit comments