Added submission count to gym search results.
This commit is contained in:
parent
654623ce4e
commit
cb7761bca4
|
@ -9,6 +9,7 @@ export interface GymSearchResult {
|
|||
streetAddress: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
submissionCount: number;
|
||||
}
|
||||
|
||||
export interface UserSearchResult {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<q-item-label caption lines="1">{{ gym.countryName }}</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side top>
|
||||
<q-badge color="primary" label="10k" />
|
||||
<q-badge color="primary" :label="submissionCountLabel" />
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
|
@ -14,11 +14,18 @@
|
|||
<script setup lang="ts">
|
||||
import { getGymRoute } from 'src/router/gym-routing';
|
||||
import { GymSearchResult } from 'src/api/search/models';
|
||||
import {computed} from 'vue';
|
||||
|
||||
interface Props {
|
||||
gym: GymSearchResult;
|
||||
}
|
||||
defineProps<Props>();
|
||||
const props = defineProps<Props>();
|
||||
const submissionCountLabel = computed(() => {
|
||||
const c = props.gym.submissionCount;
|
||||
if (c < 1000) return '' + c;
|
||||
if (c < 1000000) return Math.floor(c / 1000) + 'k';
|
||||
return Math.floor(c / 1000000) + 'm';
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
Loading…
Reference in New Issue