Client - improve calendar display on mobile + fix

This commit is contained in:
Sam 2021-10-01 17:40:58 +02:00
parent 5856599377
commit 7157f53298
15 changed files with 59 additions and 10 deletions

View File

@ -7,7 +7,7 @@
<img <img
class="profile-img" class="profile-img"
v-if="userPictureUrl !== ''" v-if="userPictureUrl !== ''"
alt="User picture" :alt="t('user.USER_PICTURE')"
:src="userPictureUrl" :src="userPictureUrl"
/> />
<div v-else class="no-picture"> <div v-else class="no-picture">

View File

@ -157,6 +157,13 @@
} }
.calendar-cell:last-child { .calendar-cell:last-child {
border-right: 0; border-right: 0;
@media screen and (max-width: $small-limit) {
.calendar-workouts {
.more-workouts {
left: -45px;
}
}
}
} }
.disabled-cell { .disabled-cell {
color: var(--app-color-light); color: var(--app-color-light);
@ -168,5 +175,15 @@
background: var(--calendar-today-color); background: var(--calendar-today-color);
} }
} }
@media screen and (max-width: $small-limit) {
.calendar-row:last-child {
.calendar-workouts {
.more-workouts {
top: inherit;
bottom: 20px;
}
}
}
}
} }
</style> </style>

View File

@ -73,8 +73,9 @@
@media screen and (max-width: $small-limit) { @media screen and (max-width: $small-limit) {
.sport-img { .sport-img {
width: 14px; padding: 3px;
height: 14px; width: 20px;
height: 20px;
} }
sup { sup {
.custom-fa-small { .custom-fa-small {

View File

@ -112,7 +112,7 @@
left: 0; left: 0;
min-width: 60px; min-width: 60px;
@media screen and (max-width: $small-limit) { @media screen and (max-width: $small-limit) {
min-width: 40px; min-width: 70px;
} }
margin-bottom: 20px; margin-bottom: 20px;

View File

@ -71,8 +71,8 @@
font-size: 0.9em; font-size: 0.9em;
.sport-img { .sport-img {
padding-right: $default-padding; padding-right: $default-padding;
height: 18px; height: 20px;
width: 18px; width: 20px;
} }
} }
.card-content { .card-content {
@ -93,6 +93,16 @@
} }
} }
} }
@media screen and (max-width: $small-limit) {
font-size: 1em;
.card-title {
font-size: 1em;
.sport-img {
height: 22px;
width: 22px;
}
}
}
} }
} }
</style> </style>

View File

@ -40,7 +40,7 @@
<img <img
v-if="authUserPictureUrl !== ''" v-if="authUserPictureUrl !== ''"
class="nav-profile-user-img" class="nav-profile-user-img"
alt="User picture" :alt="t('user.USER_PICTURE')"
:src="authUserPictureUrl" :src="authUserPictureUrl"
/> />
<div v-else class="no-picture"> <div v-else class="no-picture">

View File

@ -7,5 +7,6 @@
"PASSWORD-CONFIRM": "Confirm Password", "PASSWORD-CONFIRM": "Confirm Password",
"REGISTER": "Register", "REGISTER": "Register",
"REGISTER_DISABLED": "Sorry, registration is disabled.", "REGISTER_DISABLED": "Sorry, registration is disabled.",
"USER_PICTURE": "user picture",
"USERNAME": "Username" "USERNAME": "Username"
} }

View File

@ -8,5 +8,6 @@
"PASSWORD-CONFIRM": "Confirmation du mot de passe", "PASSWORD-CONFIRM": "Confirmation du mot de passe",
"REGISTER": "S'inscrire", "REGISTER": "S'inscrire",
"REGISTER_DISABLED": "Désolé, les inscriptions sont désactivées.", "REGISTER_DISABLED": "Désolé, les inscriptions sont désactivées.",
"USER_PICTURE": "photo de l'utilisateur",
"USERNAME": "Nom d'utilisateur" "USERNAME": "Nom d'utilisateur"
} }

View File

@ -47,6 +47,7 @@ export const actions: ActionTree<IWorkoutsState, IRootState> &
context: ActionContext<IWorkoutsState, IRootState>, context: ActionContext<IWorkoutsState, IRootState>,
payload: IWorkoutsPayload payload: IWorkoutsPayload
): void { ): void {
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_CALENDAR_WORKOUTS)
getWorkouts(context, payload, 'CALENDAR_WORKOUTS') getWorkouts(context, payload, 'CALENDAR_WORKOUTS')
}, },
[WORKOUTS_STORE.ACTIONS.GET_USER_WORKOUTS]( [WORKOUTS_STORE.ACTIONS.GET_USER_WORKOUTS](

View File

@ -16,6 +16,7 @@ export enum WorkoutsGetters {
export enum WorkoutsMutations { export enum WorkoutsMutations {
EMPTY_WORKOUTS = 'EMPTY_WORKOUTS', EMPTY_WORKOUTS = 'EMPTY_WORKOUTS',
EMPTY_CALENDAR_WORKOUTS = 'EMPTY_CALENDAR_WORKOUTS',
EMPTY_WORKOUT = 'EMPTY_WORKOUT', EMPTY_WORKOUT = 'EMPTY_WORKOUT',
SET_CALENDAR_WORKOUTS = 'SET_CALENDAR_WORKOUTS', SET_CALENDAR_WORKOUTS = 'SET_CALENDAR_WORKOUTS',
SET_USER_WORKOUTS = 'SET_USER_WORKOUTS', SET_USER_WORKOUTS = 'SET_USER_WORKOUTS',

View File

@ -44,6 +44,9 @@ export const mutations: MutationTree<IWorkoutsState> & TWorkoutsMutations = {
) { ) {
state.workoutData.loading = loading state.workoutData.loading = loading
}, },
[WORKOUTS_STORE.MUTATIONS.EMPTY_CALENDAR_WORKOUTS](state: IWorkoutsState) {
state.calendar_workouts = []
},
[WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS](state: IWorkoutsState) { [WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS](state: IWorkoutsState) {
state.calendar_workouts = [] state.calendar_workouts = []
state.user_workouts = [] state.user_workouts = []

View File

@ -78,6 +78,7 @@ export type TWorkoutsMutations<S = IWorkoutsState> = {
state: S, state: S,
loading: boolean loading: boolean
): void ): void
[WORKOUTS_STORE.MUTATIONS.EMPTY_CALENDAR_WORKOUTS](state: S): void
[WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS](state: S): void [WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS](state: S): void
[WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT](state: S): void [WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT](state: S): void
} }

View File

@ -58,7 +58,7 @@ export const getCalendarStartAndEnd = (
const weekStartsOn = weekStartingMonday ? 1 : 0 const weekStartsOn = weekStartingMonday ? 1 : 0
return { return {
start: startOfWeek(monthStart, { weekStartsOn }), start: startOfWeek(monthStart, { weekStartsOn }),
end: endOfWeek(monthEnd), end: endOfWeek(monthEnd, { weekStartsOn }),
} }
} }

View File

@ -146,6 +146,7 @@
} }
@media screen and (max-width: $small-limit) { @media screen and (max-width: $small-limit) {
padding-bottom: 60px;
.dashboard-container { .dashboard-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -144,17 +144,29 @@ describe('dateIncrement', () => {
describe('getCalendarStartAndEnd', () => { describe('getCalendarStartAndEnd', () => {
const testsParams = [ const testsParams = [
{ {
description: 'returns empty string if no date provided', description: 'returns start and end dates for calendar',
inputDate: 'September 5, 2021 20:00:00', inputDate: 'September 5, 2021 20:00:00',
inputWeekStartingMonday: false,
expectedStartDate: 'August 29, 2021 00:00:00', expectedStartDate: 'August 29, 2021 00:00:00',
expectedEndDate: 'October 2, 2021 23:59:59.999', expectedEndDate: 'October 2, 2021 23:59:59.999',
}, },
{
description:
'returns start and end dates for calendar when week starts on Monday',
inputDate: 'April 1, 2021 20:00:00',
inputWeekStartingMonday: true,
expectedStartDate: 'March 29, 2021 00:00:00',
expectedEndDate: 'May 2, 2021 23:59:59.999',
},
] ]
testsParams.map((testParams) => testsParams.map((testParams) =>
it(testParams.description, () => { it(testParams.description, () => {
const date: Date = new Date(testParams.inputDate) const date: Date = new Date(testParams.inputDate)
const results = getCalendarStartAndEnd(date, false) const results = getCalendarStartAndEnd(
date,
testParams.inputWeekStartingMonday
)
assert.deepEqual(results.start, new Date(testParams.expectedStartDate)) assert.deepEqual(results.start, new Date(testParams.expectedStartDate))
assert.deepEqual(results.end, new Date(testParams.expectedEndDate)) assert.deepEqual(results.end, new Date(testParams.expectedEndDate))
}) })