Skip to content

Commit d7d7562

Browse files
committed
Refactor Transcriptions Index component for improved readability and layout
1 parent 3f1cb38 commit d7d7562

File tree

1 file changed

+17
-83
lines changed

1 file changed

+17
-83
lines changed

resources/js/Pages/Transcriptions/Index.vue

Lines changed: 17 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
<div class="py-12">
1414
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
1515
<div class="flex justify-between mb-6">
16-
<Pagination
17-
class="hidden sm:block"
18-
:links="transcriptions.links"
19-
/>
16+
<Pagination class="hidden sm:block" :links="transcriptions.links"/>
2017

2118
<PrimaryButton @click="showModal = true">
2219
<i class="fas fa-plus mr-2"></i> Create transcription
@@ -44,25 +41,12 @@
4441
</tr>
4542
</thead>
4643
<tbody>
47-
<tr
48-
v-if="
49-
!transcriptions ||
50-
!transcriptions.data ||
51-
transcriptions.data.length === 0
52-
"
53-
>
54-
<td
55-
colspan="5"
56-
class="text-white px-4 py-8 text-center bg-gray-700 rounded-lg"
57-
>
44+
<tr v-if="!transcriptions || !transcriptions.data || transcriptions.data.length === 0">
45+
<td colspan="5" class="text-white px-4 py-8 text-center bg-gray-700 rounded-lg">
5846
No transcriptions found.
5947
</td>
6048
</tr>
61-
<tr
62-
v-else
63-
v-for="transcription in transcriptions.data"
64-
:key="transcription.id"
65-
>
49+
<tr v-else v-for="transcription in transcriptions.data" :key="transcription.id">
6650
<td class="text-white px-4 py-2">
6751
{{ transcription.title }}
6852
</td>
@@ -72,74 +56,28 @@
7256
}}
7357
</td>
7458
<td class="text-white px-4 py-2">
75-
<span
76-
v-if="
77-
transcription.language === 'en'
78-
"
79-
>
59+
<span v-if="transcription.language === 'en'">
8060
🇺🇸
8161
</span>
82-
<span
83-
v-else-if="
84-
transcription.language === 'es'
85-
"
86-
>
62+
<span v-else-if="transcription.language === 'es'">
8763
🇪🇸
8864
</span>
8965
{{ transcription.language }}
9066
</td>
91-
<td
92-
class="text-white px-4 py-2 space-x-2 text-center"
93-
>
94-
<div
95-
class="flex space-x-2 justify-center"
96-
>
97-
<AudioPlayer
98-
:audioUrl="
99-
transcription.audioUrl
100-
"
101-
v-model:isPlaying="
102-
transcription.isPlaying
103-
"
104-
/>
67+
<td class="text-white px-4 py-2 space-x-2 text-center">
68+
<div class="flex space-x-2 justify-center">
69+
<AudioPlayer :audioUrl="transcription.audioUrl" v-model:isPlaying="transcription.isPlaying"/>
10570
<DropdownMenu>
106-
<PrimaryButton
107-
@click="
108-
viewTranscription(
109-
transcription.slug
110-
)
111-
"
112-
class="bg-blue-500 hover:bg-blue-700 text-white w-full text-left"
113-
>
114-
<i
115-
class="fas fa-eye mr-2"
116-
></i>
71+
<PrimaryButton @click="viewTranscription(transcription.slug)" class="bg-blue-500 hover:bg-blue-700 text-white w-full text-left">
72+
<i class="fas fa-eye mr-2"></i>
11773
View PDF
11874
</PrimaryButton>
119-
<PrimaryButton
120-
@click="
121-
downloadTranscription(
122-
transcription.slug
123-
)
124-
"
125-
class="bg-green-500 hover:bg-green-700 text-white w-full text-left"
126-
>
127-
<i
128-
class="fas fa-download mr-2"
129-
></i>
75+
<PrimaryButton @click="downloadTranscription(transcription.slug)" class="bg-green-500 hover:bg-green-700 text-white w-full text-left">
76+
<i class="fas fa-download mr-2"></i>
13077
Download PDF
13178
</PrimaryButton>
132-
<PrimaryButton
133-
@click="
134-
deletetranscription(
135-
transcription.slug
136-
)
137-
"
138-
class="bg-red-500 hover:bg-red-700 text-white w-full text-left"
139-
>
140-
<i
141-
class="fas fa-trash mr-2"
142-
></i>
79+
<PrimaryButton @click="deletetranscription(transcription.slug)" class="bg-red-500 hover:bg-red-700 text-white w-full text-left">
80+
<i class="fas fa-trash mr-2"></i>
14381
Delete
14482
</PrimaryButton>
14583
</DropdownMenu>
@@ -158,11 +96,7 @@
15896

15997
<!-- Modal for Form -->
16098
<Modal :show="showModal" @close="showModal = false">
161-
<Form
162-
:submitAction="submitForm"
163-
buttonText="Generate Transcription"
164-
:errors="errors"
165-
/>
99+
<Form :submitAction="submitForm" buttonText="Generate Transcription" :errors="errors"/>
166100
</Modal>
167101
</AuthenticatedLayout>
168102
</template>
@@ -178,7 +112,7 @@ import Form from "@/Pages/Transcriptions/Form.vue";
178112
import { Head, router, usePage } from "@inertiajs/vue3";
179113
import Swal from "sweetalert2";
180114
import { ref, onMounted, watch } from "vue";
181-
import eventBus from "@/Components/eventBus.js"; // Import the event bus
115+
import eventBus from "@/Components/eventBus.js";
182116
183117
defineProps({
184118
transcriptions: {

0 commit comments

Comments
 (0)