11<script lang="ts">
22import { defineComponent , ref , Ref , onMounted , computed } from ' vue' ;
3- import { getRecordings } from ' ../api/api' ;
3+ import { FileAnnotation , getRecordings , Recording , Species } from ' ../api/api' ;
44import useState from ' @use/useState' ;
55import { EditingRecording } from ' ./UploadRecording.vue' ;
66
77export default defineComponent ({
8- components: {
9- },
108 setup() {
119
12- const { sharedList, recordingList } = useState ();
10+ const { sharedList, recordingList, currentUser, configuration } = useState ();
1311 const editingRecording: Ref <EditingRecording | null > = ref (null );
1412
1513 const fetchRecordings = async () => {
@@ -30,13 +28,25 @@ export default defineComponent({
3028 return sharedList .value ;
3129 });
3230
31+ const userSubmittedAnnotation = (recording : Recording ) => {
32+ const userSubmittedAnnotations = recording .fileAnnotations .filter ((annotation : FileAnnotation ) => (
33+ annotation .owner === currentUser .value && annotation .submitted
34+ ));
35+ if (userSubmittedAnnotations .length === 0 || userSubmittedAnnotations [0 ].species .length === 0 ) {
36+ return undefined ;
37+ }
38+ return userSubmittedAnnotations [0 ].species .map ((specie : Species ) => specie .species_code ).join (' , ' );
39+ };
40+
3341 return {
3442 recordingList ,
3543 sharedList ,
3644 modifiedList ,
3745 filtered ,
3846 editingRecording ,
3947 openPanel ,
48+ userSubmittedAnnotation ,
49+ configuration ,
4050 };
4151 },
4252});
@@ -83,6 +93,15 @@ export default defineComponent({
8393 </div >
8494 </v-col >
8595 </v-row >
96+ <v-row
97+ v-if =" configuration.mark_annotations_completed_enabled && userSubmittedAnnotation(item)"
98+ dense
99+ >
100+ <v-col >
101+ <b >My label: </b >
102+ <span >{{ userSubmittedAnnotation(item) }}</span >
103+ </v-col >
104+ </v-row >
86105 </v-card >
87106 </div >
88107 </v-expansion-panel-text >
@@ -151,4 +170,4 @@ export default defineComponent({
151170.v-expansion-panel-text__wrapper {
152171 padding : 0 !important ;
153172}
154- </style >
173+ </style >
0 commit comments