22import MaterialRipple from " @/components/misc/MaterialRipple.vue" ;
33import { ref , shallowRef , useTemplateRef , watchEffect } from " vue" ;
44import { useDebounceFn , useEventListener } from " @vueuse/core" ;
5+ import { revealItemInDir } from " @tauri-apps/plugin-opener" ;
6+ import { appDataDir , join } from " @tauri-apps/api/path" ;
57
68const target = useTemplateRef (" target" );
79const focused = ref <boolean >(false );
810const found = shallowRef <Array <number >>([]);
911const position = ref (1 );
1012
11- const { searchLogs, scrollToIndex } = defineProps <{
12- " searchLogs" : (search : string ) => Array <number >;
13- " scrollToIndex" : (index : number ) => void ;
13+ const { searchLogs, scrollToIndex, horizontalScroll, toggleHorizontalScroll } = defineProps <{
14+ " searchLogs" : (search : string ) => Array <number >;
15+ " scrollToIndex" : (index : number ) => void ;
16+ " horizontalScroll" : boolean ;
17+ " toggleHorizontalScroll" : () => void ;
1418}>();
1519
1620function focusSearch(): void {
@@ -57,6 +61,12 @@ function handleEnter(event: KeyboardEvent): void {
5761 );
5862}
5963
64+ async function viewInExplorer(): Promise <void > {
65+ const latestLogAbsolutePath = await join (await appDataDir (), " logs" , " latest.log" );
66+
67+ await revealItemInDir (latestLogAbsolutePath );
68+ }
69+
6070const handleInput = useDebounceFn ((event : Event ): void => {
6171 const target = event ?.target as HTMLInputElement ;
6272
@@ -85,12 +95,12 @@ watchEffect(() => {
8595 </script >
8696
8797<template >
88- <div class =" h-8 w-full flex flex-nowrap gap-2" >
98+ <div class =" h-8 w-full flex flex-wrap gap-2 overflow-x-auto " >
8999 <div
90100 @click =" focusSearch"
91101 :class =" [
92102 focused ? 'cursor-text' : 'cursor-pointer',
93- 'relative w-40 flex flex-nowrap items-center gap-2 rounded-md bg-neutral-800 pl-2',
103+ 'shrink-0 relative w-40 flex flex-nowrap items-center gap-2 rounded-md bg-neutral-800 pl-2',
94104 ]"
95105 >
96106 <div :class =" [
@@ -112,7 +122,7 @@ watchEffect(() => {
112122 />
113123 <MaterialRipple :disabled =" focused" />
114124 </div >
115- <div class =" flex flex-nowrap bg-neutral-800 items-center h-full rounded-md text-sm text-neutral-400" >
125+ <div class =" shrink-0 flex flex-nowrap bg-neutral-800 items-center h-full rounded-md text-sm text-neutral-400" >
116126 <button
117127 @click =" incrementIndex"
118128 class =" relative grid size-6 ml-1 place-items-center rounded-md transition-[color] hover:text-white"
@@ -139,12 +149,29 @@ watchEffect(() => {
139149 of {{ found.length }} matches
140150 </p >
141151 </div >
142- <button class =" relative grid px-2 w-fit flex flex-nowrap gap-2 items-center h-full place-items-center rounded-md bg-neutral-800" >
152+ <button
153+ @click =" viewInExplorer"
154+ class =" shrink-0 relative grid px-2 w-fit flex flex-nowrap gap-2 items-center h-full place-items-center rounded-md bg-neutral-800"
155+ >
143156 <span :class =" ['i-lucide-external-link block size-4']" ></span >
144157 <span class =" block" >
145158 View in Explorer
146159 </span >
147160 <MaterialRipple />
148161 </button >
162+ <button
163+ @click =" toggleHorizontalScroll"
164+ :class =" [
165+ horizontalScroll ? 'invert' : '',
166+ 'shrink-0 relative grid px-2 w-fit flex flex-nowrap gap-2 bg-neutral-800',
167+ 'items-center h-full place-items-center rounded-md transition-[filter]',
168+ ]"
169+ >
170+ <span :class =" ['i-lucide-text-wrap block size-4']" ></span >
171+ <span class =" block" >
172+ Line Breaks
173+ </span >
174+ <MaterialRipple />
175+ </button >
149176 </div >
150177</template >
0 commit comments