Skip to content

Commit

Permalink
fix: update labels
Browse files Browse the repository at this point in the history
  • Loading branch information
caro3801 committed Aug 28, 2024
1 parent d48e1dd commit af63360
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 20 deletions.
50 changes: 44 additions & 6 deletions src/components/BatchSearch/BatchSearchCardActions.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<script setup>
import { useI18n } from 'vue-i18n'
import { computed } from 'vue'
import { PhosphorIcon } from '@icij/murmur-next'
import DSDropdown from '@/components/DSDropdown'
import ButtonIcon from '@/components/Button/ButtonIcon'
defineOptions({ name: 'BatchSearchCardActions' })
const props = defineProps({
uuid: { type: String },
nbResults: { type: Number },
nbDocuments: { type: Number },
nbQueries: { type: Number },
projects: { type: Array }
})
const emit = defineEmits(['downloadDocuments', 'downloadQueries', 'downloadQueriesWithoutResults'])
const { t } = useI18n()
const actions = {
Expand Down Expand Up @@ -39,13 +43,27 @@ const actions = {
}
const seeAllDocumentsLabel = t('batchSearchCard.seeAllDocuments')
const downloadLabel = t('batchSearchCard.downloadLabel', { n: props.nbResults })
const downloadDocumentsLabel = t('batchSearchCard.downloadDocumentsLabel', { n: props.nbDocuments })
const noDocuments = computed(() => {
return props.nbDocuments === 0
})
const noDocumentsLabel = t('batchSearchCard.seeAllDocuments')
const downloadQueriesLabel = t('batchSearchCard.downloadQueriesLabel', { n: props.nbQueries })
const downloadQueriesWithoutResultsLabel = t('batchSearchCard.downloadQueriesWithoutResultsLabel')
const indices = computed(() => {
return props.projects.join(',')
})
const to = { name: 'batch-tasks.view.results', params: { indices: indices.value, uuid: props.uuid } }
const launchDownload = () => {
alert('Launch download uuid: ' + props.uuid)
const downloadDocuments = () => {
emit('downloadDocuments')
}
const downloadQueries = () => {
emit('downloadQueries')
}
const downloadQueriesWithoutResults = () => {
emit('downloadQueriesWithoutResults')
}
</script>

Expand All @@ -59,6 +77,7 @@ const launchDownload = () => {
:label="action.label"
size="sm"
variant="outline-secondary"
class="border-0"
@click="$emit(action.event, { uuid })"
/>
</div>
Expand All @@ -74,12 +93,31 @@ const launchDownload = () => {
</div>
<div class="d-inline-flex flex-sm-row flex-column">
<button-icon
:disabled="noDocuments"
icon-left="download-simple"
variant="outline-primary"
class="batch-search-card-actions__download text-nowrap"
@click="launchDownload"
>{{ downloadLabel }}</button-icon
@click="downloadDocuments"
>{{ noDocuments ? noDocumentsLabel : downloadDocumentsLabel }}</button-icon
>
</div>
<div class="d-inline-flex flex-sm-row flex-column">
<button-icon
icon-left="download-simple"
variant="outline-primary"
class="d-inline-flex flex-nowrap"
@click="downloadQueries"
>
<span>{{ downloadQueriesLabel }}</span>
</button-icon>
<button-icon
icon-left="download-simple"
variant="outline-primary"
class="d-inline-flex flex-nowrap"
@click="downloadQueriesWithoutResults"
>
<span>{{ downloadQueriesWithoutResultsLabel }}</span>
</button-icon>
</div>
</div>
</template>
Expand Down
15 changes: 8 additions & 7 deletions src/components/BatchSearch/BatchSearchCardDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import BatchSearchCardDetailsEntry from '@/components/BatchSearch/BatchSearchCar
import DisplayDatetime from '@/components/Display/DisplayDatetime'
import DisplayUser from '@/components/Display/DisplayUser'
import ProjectLink from '@/components/Project/ProjectLink'
import ButtonIcon from '@/components/Button/ButtonIcon'
defineOptions({ name: 'BatchSearchCardDetails' })
Expand All @@ -33,7 +34,7 @@ const dateItem = computed(() => {
return { icon: 'calendar-blank', label: t('batchSearchCardDetails.date'), value: props.date }
})
const authorItem = computed(() => {
return { icon: 'user-gear', label: t('batchSearchCardDetails.author'), value: props.author }
return { icon: 'user', label: t('batchSearchCardDetails.author'), value: props.author }
})
const visibilityPrivate = 'eye-slash'
const visibilityPublic = 'eye'
Expand All @@ -50,16 +51,16 @@ const visibilityItem = computed(() => {
return { icon: visibilityIcon.value, label: t('batchSearchCardDetails.visibility'), value: visibilityValue.value }
})
const phraseMatchOff = 'toggle-left'
const phraseMatchOn = 'toggle-right'
const phraseMatchIcon = computed(() => {
return props.phraseMatch ? phraseMatchOn : phraseMatchOff
})
const phraseMatchIcon = 'quotes'
const phraseMatchValue = computed(() => {
return props.phraseMatch ? t('batchSearchCardDetails.phraseMatchOn') : t('batchSearchCardDetails.phraseMatchOff')
})
const phraseMatchItem = computed(() => {
return { icon: phraseMatchIcon.value, label: t('batchSearchCardDetails.phraseMatch'), value: phraseMatchValue.value }
return {
icon: phraseMatchIcon,
label: t('batchSearchCardDetails.phraseMatch'),
value: phraseMatchValue.value
}
})
const fuzzinessValue = computed(() => {
Expand Down
17 changes: 10 additions & 7 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,10 @@
},
"batchSearchCard": {
"seeAllDocuments": "See all documents",
"downloadLabel": "Download {n} documents"
"downloadDocumentsLabel": "Download {n} documents",
"noDocumentsLabel": "No documents found",
"downloadQueriesLabel": "Download {n} queries",
"downloadQueriesWithoutResultsLabel": "Download {n} queries without results"
},
"batchSearchCardActions": {
"rename": "Rename",
Expand All @@ -922,13 +925,13 @@
"visibilityPrivate":"Private",
"visibilityShared": "Shared",
"visibility":"Visibility",
"phraseMatchOn": "Phrase match: on",
"phraseMatchOff":"Phrase match: off",
"phraseMatchOn": "Do phrase match: yes",
"phraseMatchOff":"Do phrase match: no",
"phraseMatch": "Phrase match",
"proximity": "Proximity",
"proximityValue":"Proximity: {n}",
"fuzziness": "Fuzziness",
"fuzzinessValue":"Fuzziness: {n}",
"proximity": "Proximity - Sentence changes",
"proximityValue":"Sentence changes: {n} | Sentence change: {n} | Sentence changes: {n}",
"fuzziness": "Fuzziness - Spelling changes",
"fuzzinessValue":"Spelling changes: {n} | Spelling change: {n} | Spelling changes: {n}",
"projects":"Projects",
"description": "Description",
"descriptionEdit": "Edit"
Expand Down

0 comments on commit af63360

Please sign in to comment.