Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add info message in Single Select Mode #515

Merged
merged 5 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/MessageBox.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div data-cy="message-box">
<div class="t-flex t-items-center t-justify-center">
<BaseIcon
:class="`t-text-${color}`"
Expand Down Expand Up @@ -28,7 +28,7 @@
type: String,
default: () => '',
},
title: String,

Check warning on line 31 in src/components/MessageBox.vue

View workflow job for this annotation

GitHub Actions / build (18)

Prop 'title' requires default value to be set

Check warning on line 31 in src/components/MessageBox.vue

View workflow job for this annotation

GitHub Actions / build (20)

Prop 'title' requires default value to be set
type: {
type: String,
default: () => '',
Expand Down
29 changes: 25 additions & 4 deletions src/components/annotations/variants/VariantsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</div>
<MessageBox
v-else
:message="$t('no_annotations_in_view')"
:title="$t('no_annotations_available')"
:message="getVariantsListInfoMessage()"
:title="getVariantsListInfoTitle()"
type="info"
/>
</template>
Expand All @@ -28,13 +28,16 @@
<script setup lang="ts">
import { computed } from 'vue';
import VariantItem from "@/components/annotations/variants/VariantItem.vue";
import {useAnnotationsStore} from "@/stores/annotations";
import { useAnnotationsStore } from "@/stores/annotations";
import MessageBox from "@/components/MessageBox.vue";
import * as Utils from '@/utils/annotations'
import i18n from '@/i18n'
import { useConfigStore } from '@/stores/config';

const annotationStore = useAnnotationsStore();
const configStore = useConfigStore()


const lang = computed<string>(() => configStore.config.lang)
const activeAnnotations = computed<ActiveAnnotation>(() => annotationStore.activeAnnotations);
const visibleAnnotations = computed<Annotation[]>(() => annotationStore.visibleAnnotations);

Expand Down Expand Up @@ -63,6 +66,24 @@ function getWitnessColor(witness: string) {
return annotationStore.variantItemsColors[witness];
}

function getVariantsListInfoMessage(): string {
if (annotationStore.filteredAnnotations.length === 0) {
return i18n[lang.value]['no_annotations_in_view']
}
if (annotationStore.isSingleSelectMode) {
return i18n[lang.value]['single_select_mode_info_message']
}
}

function getVariantsListInfoTitle(): string {
if (annotationStore.filteredAnnotations.length === 0) {
return i18n[lang.value]['no_annotations_available']
}
if (annotationStore.isSingleSelectMode) {
return i18n[lang.value]['single_select_mode']
}
}


function showLineSeparator(visibleAnnotations, i) {
if (visibleAnnotations[i+1]) {
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/de/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,6 @@ export default {
witnesses_details: 'Infos zu Textzeugen',
variants_details: 'Infos zu Varianten',
witnesses_selected: 'Textzeugen ausgewählt',
single_select_mode: 'Single Select Mode'
single_select_mode: 'Single Select Mode',
single_select_mode_info_message: 'Bitte wählen Sie die Varianten aus dem grau unterlegten Text im Text Panel'
paulpestov marked this conversation as resolved.
Show resolved Hide resolved
};
3 changes: 2 additions & 1 deletion src/i18n/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@ export default {
witnesses_details: 'Witnesses Details',
variants_details: 'Variants Details',
witnesses_selected: 'Witnesses selected',
single_select_mode: 'Single Select Mode'
single_select_mode: 'Single Select Mode',
single_select_mode_info_message: 'Please select variant items from the grey highlighted text in Text Panel'
paulpestov marked this conversation as resolved.
Show resolved Hide resolved
};
7 changes: 2 additions & 5 deletions tests/cypress/e2e/variants.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ const selectors = {
cy
.get('.panels-wrapper .panel:nth-child(4) .panel-body')
.find('div[id="pv_id_6_2_content"]')
.children().eq(0)
.children().eq(1) // annotation content
.children().eq(0).should('not.have.class', 'annotations-list')
.find('span').contains('No Annotations available')
.find('div[data-cy="message-box"]')
})

describe('VariantsAnnotation', () => {
Expand Down Expand Up @@ -562,4 +559,4 @@ const selectors = {
})
})
})
});
});
Loading