44 <div class =" text-subtitle2 text-grey-8 flex items-center" >
55 {{ topicName }}
66 <q-badge color =" grey-4" text-color =" black" class =" q-ml-sm" >{{
7- messageType
8- }}</q-badge >
7+ messageType
8+ }}</q-badge >
99 </div >
10- <q-btn
11- v-if =" hasData && !isImage"
12- label =" Load More"
13- size =" sm"
14- flat
15- color =" primary"
16- @click =" $emit('load-more')"
17- />
10+
11+ <q-badge
12+ color =" orange-7"
13+ text-color =" white"
14+ label =" BETA"
15+ class =" text-weight-bold cursor-help"
16+ style =" font-size : 10px ; padding : 2px 6px "
17+ >
18+ <q-tooltip >
19+ Preview functionality is currently in beta.
20+ </q-tooltip >
21+ </q-badge >
1822 </div >
1923
2024 <div
3943 :topic-name =" topicName"
4044 :total-count =" totalCount"
4145 @load-required =" $emit('load-required')"
46+ @load-more =" $emit('load-more')"
4247 />
4348
4449 <div
@@ -62,7 +67,6 @@ import { computed } from 'vue';
6267import {
6368 detectPreviewType ,
6469 getViewerComponent ,
65- PreviewType ,
6670} from ' ../../services/message-factory' ;
6771
6872const properties = defineProps <{
@@ -72,6 +76,8 @@ const properties = defineProps<{
7276 totalCount: number ;
7377 isLoading: boolean ;
7478 error: string | null ;
79+ protocol? : string ;
80+ topicSize? : number ;
7581}>();
7682
7783defineEmits ([' load-more' , ' load-required' ]);
@@ -80,17 +86,23 @@ const hasData = computed(
8086 () => properties .messages && properties .messages .length > 0 ,
8187);
8288
83- // Determine the type based on the message string + sample data
89+ // --- Type Detection ---
8490const currentPreviewType = computed (() => {
8591 const sample = properties .messages ?.[0 ]?.data ;
8692 return detectPreviewType (properties .messageType , sample );
8793});
8894
89- // Helper to check if it is an image
90- const isImage = computed (() => currentPreviewType .value === PreviewType .IMAGE );
91-
92- // Get the correct component
9395const activeComponent = computed (() => {
9496 return getViewerComponent (currentPreviewType .value );
9597});
96- </script >
98+
99+ // --- Utilities ---
100+ function formatBytes(bytes : number , decimals = 1 ): string {
101+ if (! + bytes ) return ' 0 B' ;
102+ const k = 1024 ;
103+ const dm = decimals < 0 ? 0 : decimals ;
104+ const sizes = [' B' , ' KB' , ' MB' , ' GB' , ' TB' ];
105+ const i = Math .floor (Math .log (bytes ) / Math .log (k ));
106+ return ` ${parseFloat ((bytes / Math .pow (k , i )).toFixed (dm ))} ${sizes [i ]} ` ;
107+ }
108+ </script >
0 commit comments