Client - remove useless Cards

This commit is contained in:
Sam 2021-10-05 19:02:08 +02:00
parent 1ebced48c4
commit 9bc6422620
9 changed files with 609 additions and 649 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="card"> <div class="card">
<div class="card-title" :class="{ 'without-title': withoutTitle }"> <div class="card-title">
<slot name="title"></slot> <slot name="title"></slot>
</div> </div>
<div class="card-content"> <div class="card-content">
@ -13,12 +13,6 @@
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
export default defineComponent({ export default defineComponent({
name: 'Card', name: 'Card',
props: {
withoutTitle: {
type: Boolean,
default: false,
},
},
}) })
</script> </script>
@ -30,10 +24,6 @@
border-radius: $border-radius; border-radius: $border-radius;
margin: $default-margin; margin: $default-margin;
.without-title {
display: none;
}
.card-title { .card-title {
font-weight: bold; font-weight: bold;
border-bottom: solid 1px var(--card-border-color); border-bottom: solid 1px var(--card-border-color);

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="no-workouts"> <div class="no-workouts box">
<div> <div>
{{ t('workouts.NO_WORKOUTS') }} {{ t('workouts.NO_WORKOUTS') }}
<router-link to="/workouts/add"> <router-link to="/workouts/add">
@ -27,9 +27,5 @@
.no-workouts { .no-workouts {
display: flex; display: flex;
justify-content: center; justify-content: center;
border: solid 1px var(--card-border-color);
border-radius: $border-radius;
padding: $default-padding;
margin: $default-margin;
} }
</style> </style>

View File

@ -1,7 +1,6 @@
<template> <template>
<div class="timeline-workout"> <div class="timeline-workout">
<Card :without-title="true"> <div class="box">
<template #content>
<div class="workout-user-date"> <div class="workout-user-date">
<div class="workout-user"> <div class="workout-user">
<img <img
@ -72,8 +71,7 @@
<span v-if="workout">{{ workout.distance }} km</span> <span v-if="workout">{{ workout.distance }} km</span>
</div> </div>
</div> </div>
</template> </div>
</Card>
</div> </div>
</template> </template>
@ -82,7 +80,6 @@
import { PropType, defineComponent, ComputedRef, computed } from 'vue' import { PropType, defineComponent, ComputedRef, computed } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Card from '@/components/Common/Card.vue'
import SportImage from '@/components/Common/SportImage/index.vue' import SportImage from '@/components/Common/SportImage/index.vue'
import StaticMap from '@/components/Common/StaticMap.vue' import StaticMap from '@/components/Common/StaticMap.vue'
import { ROOT_STORE } from '@/store/constants' import { ROOT_STORE } from '@/store/constants'
@ -96,7 +93,6 @@
export default defineComponent({ export default defineComponent({
name: 'WorkoutCard', name: 'WorkoutCard',
components: { components: {
Card,
StaticMap, StaticMap,
SportImage, SportImage,
}, },
@ -145,9 +141,7 @@
.timeline-workout { .timeline-workout {
margin-bottom: $default-margin * 2; margin-bottom: $default-margin * 2;
::v-deep(.card) { .box {
.card-content {
display: flex;
flex-direction: column; flex-direction: column;
padding: 0; padding: 0;
.workout-user-date { .workout-user-date {
@ -180,7 +174,7 @@
.no-map { .no-map {
line-height: 150px; line-height: 150px;
} }
.bg-map-image { ::v-deep(.bg-map-image) {
height: 150px; height: 150px;
} }
} }
@ -199,6 +193,7 @@
width: 33%; width: 33%;
} }
} }
.workout-map, .workout-map,
.workout-data { .workout-data {
cursor: pointer; cursor: pointer;
@ -211,5 +206,4 @@
} }
} }
} }
}
</style> </style>

View File

@ -1,7 +1,6 @@
<template> <template>
<div id="user-calendar"> <div id="user-calendar">
<Card class="calendar-card" :without-title="true"> <div class="calendar-card box">
<template #content>
<CalendarHeader <CalendarHeader
:day="day" :day="day"
locale-options="enGB" locale-options="enGB"
@ -18,8 +17,7 @@
:workouts="calendarWorkouts" :workouts="calendarWorkouts"
:weekStartingMonday="user.weekm" :weekStartingMonday="user.weekm"
/> />
</template> </div>
</Card>
</div> </div>
</template> </template>
@ -34,7 +32,6 @@
onBeforeMount, onBeforeMount,
} from 'vue' } from 'vue'
import Card from '@/components/Common/Card.vue'
import CalendarCells from '@/components/Dashboard/UserCalendar/CalendarCells.vue' import CalendarCells from '@/components/Dashboard/UserCalendar/CalendarCells.vue'
import CalendarDays from '@/components/Dashboard/UserCalendar/CalendarDays.vue' import CalendarDays from '@/components/Dashboard/UserCalendar/CalendarDays.vue'
import CalendarHeader from '@/components/Dashboard/UserCalendar/CalendarHeader.vue' import CalendarHeader from '@/components/Dashboard/UserCalendar/CalendarHeader.vue'
@ -51,7 +48,6 @@
CalendarCells, CalendarCells,
CalendarDays, CalendarDays,
CalendarHeader, CalendarHeader,
Card,
}, },
props: { props: {
sports: { sports: {

View File

@ -1,8 +1,6 @@
<template> <template>
<div class="user-stat-card"> <div class="user-stat-card">
<Card :without-title="true"> <div class="stat-content box">
<template #content>
<div class="stat-content">
<div class="stat-icon"> <div class="stat-icon">
<i class="fa" :class="`fa-${icon}`" /> <i class="fa" :class="`fa-${icon}`" />
</div> </div>
@ -11,20 +9,14 @@
<div class="stat">{{ text }}</div> <div class="stat">{{ text }}</div>
</div> </div>
</div> </div>
</template>
</Card>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import Card from '@/components/Common/Card.vue'
export default defineComponent({ export default defineComponent({
name: 'UserStatCard', name: 'UserStatCard',
components: {
Card,
},
props: { props: {
icon: { icon: {
type: String, type: String,
@ -56,6 +48,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
padding: $default-padding $default-padding * 2;
.stat-icon { .stat-icon {
width: 30%; width: 30%;

View File

@ -1,7 +1,6 @@
<template> <template>
<div class="workouts-filters"> <div class="workouts-filters">
<Card :without-title="true"> <div class="box">
<template #content>
<div class="form"> <div class="form">
<div class="form-items-group"> <div class="form-items-group">
<div class="form-item"> <div class="form-item">
@ -129,8 +128,7 @@
{{ t('buttons.FILTER') }} {{ t('buttons.FILTER') }}
</button> </button>
</div> </div>
</template> </div>
</Card>
</div> </div>
</template> </template>
@ -138,15 +136,11 @@
import { computed, ComputedRef, defineComponent, PropType } from 'vue' import { computed, ComputedRef, defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Card from '@/components/Common/Card.vue'
import { ISport } from '@/types/sports' import { ISport } from '@/types/sports'
import { translateSports } from '@/utils/sports' import { translateSports } from '@/utils/sports'
export default defineComponent({ export default defineComponent({
name: 'WorkoutsFilters', name: 'WorkoutsFilters',
components: {
Card,
},
props: { props: {
sports: { sports: {
type: Object as PropType<ISport[]>, type: Object as PropType<ISport[]>,
@ -181,9 +175,6 @@
@import '~@/scss/base.scss'; @import '~@/scss/base.scss';
.workouts-filters { .workouts-filters {
::v-deep(.card) {
.card-content {
padding: $default-padding;
.form { .form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -303,6 +294,4 @@
} }
} }
} }
}
}
</style> </style>

View File

@ -1,7 +1,6 @@
<template> <template>
<div class="workouts-list"> <div class="workouts-list">
<Card :without-title="true"> <div class="box" :class="{ 'empty-table': workouts.length === 0 }">
<template #content>
<div class="workouts-table"> <div class="workouts-table">
<table> <table>
<thead> <thead>
@ -91,8 +90,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</template> </div>
</Card>
<NoWorkouts v-if="workouts.length === 0" /> <NoWorkouts v-if="workouts.length === 0" />
<div v-if="moreWorkoutsExist" class="more-workouts"> <div v-if="moreWorkoutsExist" class="more-workouts">
<button @click="loadMoreWorkouts"> <button @click="loadMoreWorkouts">
@ -116,7 +114,6 @@
} from 'vue' } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Card from '@/components/Common/Card.vue'
import NoWorkouts from '@/components/Common/NoWorkouts.vue' import NoWorkouts from '@/components/Common/NoWorkouts.vue'
import SportImage from '@/components/Common/SportImage/index.vue' import SportImage from '@/components/Common/SportImage/index.vue'
import StaticMap from '@/components/Common/StaticMap.vue' import StaticMap from '@/components/Common/StaticMap.vue'
@ -131,7 +128,6 @@
export default defineComponent({ export default defineComponent({
name: 'WorkoutsList', name: 'WorkoutsList',
components: { components: {
Card,
NoWorkouts, NoWorkouts,
SportImage, SportImage,
StaticMap, StaticMap,
@ -212,11 +208,14 @@
margin-bottom: 50px; margin-bottom: 50px;
width: 100%; width: 100%;
::v-deep(.card) { .box {
.card-content { @media screen and (max-width: $small-limit) {
margin-bottom: 15px; &.empty-table {
display: none;
}
}
.workouts-table { .workouts-table {
margin-bottom: 15px;
/* responsive table, adapted from: */ /* responsive table, adapted from: */
/* https://uglyduck.ca/making-tables-responsive-with-minimal-css/ */ /* https://uglyduck.ca/making-tables-responsive-with-minimal-css/ */
table { table {
@ -335,7 +334,6 @@
} }
} }
} }
}
.more-workouts { .more-workouts {
display: flex; display: flex;

View File

@ -86,6 +86,13 @@ button {
} }
.box {
border: solid 1px var(--card-border-color);
border-radius: $border-radius;
padding: $default-padding;
margin: $default-margin;
}
.container { .container {
display: flex; display: flex;
margin-left: auto; margin-left: auto;

View File

@ -1,38 +1,36 @@
<template> <template>
<div id="dashboard" v-if="authUser.username && sports.length > 0"> <div id="dashboard" v-if="authUser.username && sports.length > 0">
<div class="container mobile-menu"> <div class="container mobile-menu">
<Card :without-title="true"> <div class="box">
<template #content> <div
<button
class="mobile-menu-item" class="mobile-menu-item"
:class="{ 'is-selected': isSelected === 'chart' }" :class="{ 'is-selected': isSelected === 'chart' }"
@click="updateDisplayColumn('chart')" @click="updateDisplayColumn('chart')"
> >
<i class="fa fa-bar-chart" aria-hidden="true" /> <i class="fa fa-bar-chart" aria-hidden="true" />
</button> </div>
<button <div
class="mobile-menu-item" class="mobile-menu-item"
:class="{ 'is-selected': isSelected === 'calendar' }" :class="{ 'is-selected': isSelected === 'calendar' }"
@click="updateDisplayColumn('calendar')" @click="updateDisplayColumn('calendar')"
> >
<i class="fa fa-calendar" aria-hidden="true" /> <i class="fa fa-calendar" aria-hidden="true" />
</button> </div>
<button <div
class="mobile-menu-item" class="mobile-menu-item"
:class="{ 'is-selected': isSelected === 'timeline' }" :class="{ 'is-selected': isSelected === 'timeline' }"
@click="updateDisplayColumn('timeline')" @click="updateDisplayColumn('timeline')"
> >
<i class="fa fa-map-o" aria-hidden="true" /> <i class="fa fa-map-o" aria-hidden="true" />
</button> </div>
<button <div
class="mobile-menu-item" class="mobile-menu-item"
:class="{ 'is-selected': isSelected === 'records' }" :class="{ 'is-selected': isSelected === 'records' }"
@click="updateDisplayColumn('records')" @click="updateDisplayColumn('records')"
> >
<i class="fa fa-trophy" aria-hidden="true" /> <i class="fa fa-trophy" aria-hidden="true" />
</button> </div>
</template> </div>
</Card>
</div> </div>
<div class="container"> <div class="container">
<UserStatsCards :user="authUser" /> <UserStatsCards :user="authUser" />
@ -77,7 +75,6 @@
onUnmounted, onUnmounted,
} from 'vue' } from 'vue'
import Card from '@/components/Common/Card.vue'
import Timeline from '@/components/Dashboard/Timeline/index.vue' import Timeline from '@/components/Dashboard/Timeline/index.vue'
import UserCalendar from '@/components/Dashboard/UserCalendar/index.vue' import UserCalendar from '@/components/Dashboard/UserCalendar/index.vue'
import UserMonthStats from '@/components/Dashboard/UserMonthStats.vue' import UserMonthStats from '@/components/Dashboard/UserMonthStats.vue'
@ -91,7 +88,6 @@
export default defineComponent({ export default defineComponent({
name: 'Dashboard', name: 'Dashboard',
components: { components: {
Card,
Timeline, Timeline,
UserCalendar, UserCalendar,
UserMonthStats, UserMonthStats,
@ -161,17 +157,19 @@
} }
.mobile-menu { .mobile-menu {
display: flex; display: flex;
::v-deep(.card) { .box {
width: 100%;
.card-content {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 0; padding: 0;
width: 100%;
.mobile-menu-item { .mobile-menu-item {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
border: none; border: none;
border-radius: $border-radius;
box-shadow: none; box-shadow: none;
font-size: 0.95em;
padding: $default-padding; padding: $default-padding;
width: 25%; width: 25%;
@ -188,7 +186,6 @@
} }
} }
} }
}
.is-hidden { .is-hidden {
display: none; display: none;
} }