Skip to content

Commit

Permalink
Fix empty search message (#389)
Browse files Browse the repository at this point in the history
* chore: init public/protected selection button

* chore: init layout protected courses

* fix: little layout

* chore: private option for course

* chore: start link generation screen

* chore: backend creation of invitation link

* chore: refactor link generation logic + save service link

* chore: search based on invitation link

* fix: link expire date

* chore: start translations

* fix: stepper content translated

* fix: cleanup + linting

* fix: service tests

* fix: translation

* fix: arrows

* fix: empty slot value for search results

* fix: space
  • Loading branch information
BramMeir authored May 2, 2024
1 parent d3800a3 commit 443dd0c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 53 deletions.
3 changes: 2 additions & 1 deletion frontend/src/assets/lang/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@
},
"noCourses": {
"student": "No courses found. Register for a public course using the search function, or use an invitation link from a teacher.",
"teacher": "No courses found. Create a new course with the button below."
"teacher": "No courses found. Create a new course with the button below.",
"search": "No courses found for the given search criteria."
},
"noResults": "No results.",
"noIncomingProjects": "No projects with a deadline within 7 days.",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/assets/lang/app/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@
},
"noCourses": {
"student": "Geen vakken gevonden. Schrijf in op een openbaar vak met de zoekfunctie, of gebruik een uitnodiginslink van een lesgever.",
"teacher": "Geen vakken gevonden. Maak een vak aan met onderstaande knop."
"teacher": "Geen vakken gevonden. Maak een vak aan met onderstaande knop.",
"search": "Geen vakken gevonden voor de gegeven zoekcriteria."
},
"noResults": "Geen resultaten.",
"noIncomingProjects": "Geen projecten met een deadline binnen de 7 dagen.",
Expand Down
98 changes: 49 additions & 49 deletions frontend/src/views/courses/SearchCourseView.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
<script setup lang="ts">
import SelectButton from 'primevue/selectbutton';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import PublicSearchCourseView from './search/PublicSearchCourseView.vue';
import ProtectedSearchCourseView from './search/ProtectedSearchCourseView.vue';
/* Composable injections */
const { t } = useI18n();
/* State of the public/protected course */
const publicCourses = ref<boolean>(true);
/* Options for the select button */
const options = computed(() => [
{ label: t('components.button.public'), value: true },
{ label: t('components.button.protected'), value: false },
]);
</script>

<template>
<!-- If the public option is set, display the search option for all the public courses -->
<PublicSearchCourseView v-if="publicCourses">
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</PublicSearchCourseView>

<!-- If the protected option is set, display the search option for all the protected courses -->
<ProtectedSearchCourseView v-else>
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</ProtectedSearchCourseView>
</template>

<style scoped lang="scss"></style>
<script setup lang="ts">
import SelectButton from 'primevue/selectbutton';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import PublicSearchCourseView from './search/PublicSearchCourseView.vue';
import ProtectedSearchCourseView from './search/ProtectedSearchCourseView.vue';
/* Composable injections */
const { t } = useI18n();
/* State of the public/protected course */
const publicCourses = ref<boolean>(true);
/* Options for the select button */
const options = computed(() => [
{ label: t('components.button.public'), value: true },
{ label: t('components.button.protected'), value: false },
]);
</script>

<template>
<!-- If the public option is set, display the search option for all the public courses -->
<PublicSearchCourseView v-if="publicCourses">
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</PublicSearchCourseView>

<!-- If the protected option is set, display the search option for all the protected courses -->
<ProtectedSearchCourseView v-else>
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</ProtectedSearchCourseView>
</template>

<style scoped lang="scss"></style>
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ onMounted(async () => {
</span>

<!-- Founded courses -->
<CourseGeneralList class="mt-3" :courses="pagination?.results ?? null" :cols="3" />
<CourseGeneralList class="mt-3" :courses="pagination?.results ?? null" :cols="3">
<template #empty>
<p>{{ t('components.list.noCourses.search') }}</p>
</template>
</CourseGeneralList>
</div>
</div>
</BaseLayout>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/views/courses/search/PublicSearchCourseView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ onMounted(async () => {
{{ t('views.courses.search.results', [pagination.count]) }}
</p>

<CourseGeneralList class="mt-3" :courses="pagination?.results ?? null" :cols="3" />
<CourseGeneralList class="mt-3" :courses="pagination?.results ?? null" :cols="3">
<template #empty>
<p>{{ t('components.list.noCourses.search') }}</p>
</template>
</CourseGeneralList>
<Paginator :rows="pageSize" :total-records="pagination?.count" v-model:first="first" />
</div>
Expand Down

0 comments on commit 443dd0c

Please sign in to comment.