Skip to content

Commit

Permalink
Optimized list display and refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
IrisOlfermann committed Oct 2, 2023
1 parent 5acbb44 commit 7d2e919
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
7 changes: 5 additions & 2 deletions src/Resources/src/api/getParticipationsByDate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useApi from '@/api/api';
import type { DateTime } from '@/api/getDashboardData';
import { onMounted, reactive, readonly, ref } from 'vue';
import { onMounted, onUnmounted, reactive, readonly, ref } from 'vue';
import type { Dictionary } from '../../types/types';

export type ListData = {
Expand All @@ -19,13 +19,16 @@ const listDataState = reactive<ListData>({
});

export function useParticipantsByDayData(date: string){
console.log(date);
const loaded = ref(false)

onMounted(async () => {
await getListData();
});

onUnmounted(() => {
listDataState.data = {};
});

async function getListData() {

const { response: listData, request, error } = useApi<ListData>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- eslint-disable vue/html-closing-bracket-spacing -->
<template>
<Dialog
:open="openParticipantsModal"
Expand Down Expand Up @@ -43,15 +42,13 @@ import ParticipantsListByDay from '@/views/ParticipantsListByDay.vue';
import { useComponentHeights } from '@/services/useComponentHeights';
import { onMounted, onUnmounted } from 'vue';
import { DateTime } from '@/api/getDashboardData';
const { participationsState, loadShowParticipations, activatePeriodicFetch, disablePeriodicFetch } = getShowParticipations();
const { loadShowParticipations, activatePeriodicFetch, disablePeriodicFetch } = getShowParticipations();
const { addWindowHeightListener, removeWindowHeightListener } = useComponentHeights();
const progress = useProgress().start();
const { t } = useI18n();
const loaded = ref(false);
const props = defineProps<{

Check warning on line 53 in src/Resources/src/components/dashboard/ParticipantsListModal.vue

View workflow job for this annotation

GitHub Actions / FE Asset Linting

'props' is assigned a value but never used
openParticipantsModal: boolean,
Expand Down
28 changes: 11 additions & 17 deletions src/Resources/src/views/ParticipantsListByDay.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<template>
<table >
<tbody >
<template v-for="(participant, slotName) in listData.data" :key="String(slotName)">
<tr v-for="(participations, participantName, index) in participant" :key="index"
<table>
<tbody>
<template
v-for="(participant, slotName) in listData.data"
:key="String(slotName)"
>
<tr
v-for="(participations, participantName, index) in participant"
:key="index"
:class="[index === 0 ? 'border-gray-300' : 'border-gray-200', 'border-t']">

Check warning on line 11 in src/Resources/src/views/ParticipantsListByDay.vue

View workflow job for this annotation

GitHub Actions / FE Asset Linting

Expected 1 line break before closing bracket, but no line breaks found
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-primary sm:pl-6">
<td
class="text-primary whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium sm:pl-6">

Check warning on line 13 in src/Resources/src/views/ParticipantsListByDay.vue

View workflow job for this annotation

GitHub Actions / FE Asset Linting

Invalid Tailwind CSS classnames order
{{ String(participantName) }}
</td>
</tr>
Expand All @@ -16,26 +22,14 @@
<script setup lang="ts">
import { useParticipantsByDayData } from '@/api/getParticipationsByDate';
import { useProgress } from '@marcoschulte/vue3-progress';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
const progress = useProgress().start()
const { t, locale } = useI18n()
const props = defineProps<{
date: string,
}>();
console.log(props.date)
const { listData } = useParticipantsByDayData(props.date);
// const participationCount = computed(() => {
// const count: number[] = [];
// Object.values(listData.meals).forEach(meal => {
// count.push(meal.participations ? meal.participations : 0);
// })
// return count;
// })
progress.finish()
</script>

0 comments on commit 7d2e919

Please sign in to comment.