some small app changes
This commit is contained in:
parent
2e1370392e
commit
55f20a5a1d
|
|
@ -95,7 +95,7 @@ const logoutUser = () => {
|
||||||
<ion-icon slot="icon-only" :icon="chevronBack"></ion-icon>
|
<ion-icon slot="icon-only" :icon="chevronBack"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>Menu Content</ion-title>
|
<ion-title>User Menu</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ export class BullpenSessionService extends ApiService<Bullpen> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public findByPitcherId(id: number, page: number, size: number): Promise<Pageable<Bullpen>> {
|
public fetchAllByUser(id: number, page: number, size: number): Promise<Pageable<Bullpen>> {
|
||||||
return api
|
return api
|
||||||
.get('/bullpen_session', { params: {
|
.get('/bullpen_session', { params: {
|
||||||
user: id,
|
user: id,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, ref} from 'vue';
|
import {computed, ref, reactive} from 'vue';
|
||||||
import {
|
import {
|
||||||
IonPage,
|
IonPage,
|
||||||
IonHeader,
|
IonHeader,
|
||||||
|
|
@ -7,24 +7,33 @@ import {
|
||||||
IonTitle,
|
IonTitle,
|
||||||
IonContent,
|
IonContent,
|
||||||
IonAvatar,
|
IonAvatar,
|
||||||
IonButton,
|
|
||||||
IonButtons,
|
IonButtons,
|
||||||
IonIcon,
|
IonIcon,
|
||||||
IonMenuButton,
|
IonMenuButton,
|
||||||
IonFab,
|
IonFab,
|
||||||
IonFabButton
|
IonFabButton,
|
||||||
|
IonInfiniteScroll,
|
||||||
|
IonInfiniteScrollContent,
|
||||||
|
InfiniteScrollCustomEvent,
|
||||||
|
IonList,
|
||||||
|
IonItem,
|
||||||
|
IonLabel, IonBadge,
|
||||||
} from '@ionic/vue';
|
} from '@ionic/vue';
|
||||||
import {
|
import {
|
||||||
playOutline,
|
playOutline,
|
||||||
statsChartOutline,
|
statsChartOutline,
|
||||||
personOutline,
|
personOutline,
|
||||||
|
baseball,
|
||||||
add,
|
add,
|
||||||
personAddOutline
|
personAddOutline, baseballOutline
|
||||||
} from 'ionicons/icons';
|
} from 'ionicons/icons';
|
||||||
import {useStore} from "vuex";
|
import {useStore} from "vuex";
|
||||||
import {useRouter} from "vue-router";
|
import {useRouter} from "vue-router";
|
||||||
import BullpenSessionService from "@/services/BullpenSessionService";
|
import BullpenSessionService from "@/services/BullpenSessionService";
|
||||||
import TokenService from "@/services/TokenService";
|
import TokenService from "@/services/TokenService";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import Bullpen from "@/types/Bullpen";
|
||||||
|
import PitchType from "@/types/PitchType";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
@ -60,6 +69,39 @@ const addPlayer = () => {
|
||||||
router.push({ path: '/player/create' });
|
router.push({ path: '/player/create' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const items = reactive<Bullpen[]>([]);
|
||||||
|
const page = ref(0);
|
||||||
|
|
||||||
|
const generateItems = () => {
|
||||||
|
BullpenSessionService
|
||||||
|
.fetchAllByUser(user.value.id, page.value, 10)
|
||||||
|
.then((bullpens) => {
|
||||||
|
++page.value;
|
||||||
|
bullpens.data.forEach((bullpen: Bullpen) => {
|
||||||
|
items.push(bullpen);
|
||||||
|
})
|
||||||
|
}, error => {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatDate = (date: Date) => {
|
||||||
|
return dayjs(date).format('YYYY.MM.DD HH:mm');
|
||||||
|
}
|
||||||
|
|
||||||
|
// const determinePitchTypeName = (id: number): string => {
|
||||||
|
// const pitchType = store.state.pitchTypes.find((pitchType: PitchType) => pitchType.id === id);
|
||||||
|
//
|
||||||
|
// return pitchType?.name ?? 'Unknown';
|
||||||
|
// }
|
||||||
|
|
||||||
|
const ionInfinite = (event: InfiniteScrollCustomEvent) => {
|
||||||
|
generateItems();
|
||||||
|
setTimeout(() => event.target.complete(), 500);
|
||||||
|
};
|
||||||
|
|
||||||
|
generateItems();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -75,7 +117,24 @@ const addPlayer = () => {
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content class="ion-padding">
|
<ion-content>
|
||||||
|
<ion-list>
|
||||||
|
<ion-item v-for="(bullpen, index) in items" :key="index">
|
||||||
|
<ion-icon aria-hidden="true" :icon="baseball" slot="start"></ion-icon>
|
||||||
|
<ion-label>Bullpen from ({{formatDate(bullpen.startedAt)}})</ion-label>
|
||||||
|
<!-- <ion-list v-for="(pitch, index) in bullpen.pitches" :key="index">-->
|
||||||
|
<!-- <ion-item>-->
|
||||||
|
<!-- <ion-icon slot="start" :icon="baseballOutline" class="icon-login"></ion-icon>-->
|
||||||
|
<!-- <ion-label>{{determinePitchTypeName(pitch.pitchTypeId)}}</ion-label>-->
|
||||||
|
<!-- <ion-badge>{{pitch.aimedArea}}</ion-badge>-->
|
||||||
|
<!-- <ion-badge>{{pitch.hitArea}}</ion-badge>-->
|
||||||
|
<!-- </ion-item>-->
|
||||||
|
<!-- </ion-list>-->
|
||||||
|
</ion-item>
|
||||||
|
</ion-list>
|
||||||
|
<ion-infinite-scroll @ionInfinite="ionInfinite">
|
||||||
|
<ion-infinite-scroll-content></ion-infinite-scroll-content>
|
||||||
|
</ion-infinite-scroll>
|
||||||
<!-- <div class="user-container">-->
|
<!-- <div class="user-container">-->
|
||||||
<!-- <ion-avatar class="user-avatar">-->
|
<!-- <ion-avatar class="user-avatar">-->
|
||||||
<!-- <template v-if="userImage">-->
|
<!-- <template v-if="userImage">-->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue