Skip to content

Commit ac7cfd7

Browse files
committed
Show the current user's submitted label in sidebar
1 parent aa57d87 commit ac7cfd7

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

client/src/components/RecordingAnnotationEditor.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default defineComponent({
118118
));
119119
120120
const submissionTooltip = computed(() => {
121-
if (props.submittedAnnotationId !== props.annotation?.id) {
121+
if (props.submittedAnnotationId !== undefined && props.submittedAnnotationId !== props.annotation?.id) {
122122
return 'You have already submitted a different annotation for this recording.';
123123
}
124124
if (props.annotation && props.annotation.submitted) {
@@ -234,7 +234,7 @@ export default defineComponent({
234234
<v-btn
235235
flat
236236
color="primary"
237-
:disabled="annotation.submitted || annotation.id !== submittedAnnotationId"
237+
:disabled="annotation.submitted || (submittedAnnotationId !== undefined && annotation.id !== submittedAnnotationId)"
238238
@click="submitAnnotation"
239239
>
240240
Submit

client/src/components/RecordingList.vue

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<script lang="ts">
22
import { defineComponent, ref, Ref, onMounted, computed } from 'vue';
3-
import { getRecordings } from '../api/api';
3+
import { FileAnnotation, getRecordings, Recording, Species } from '../api/api';
44
import useState from '@use/useState';
55
import { EditingRecording } from './UploadRecording.vue';
66
77
export 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

Comments
 (0)