Client - minor refactoring

This commit is contained in:
Sam 2021-11-01 20:48:22 +01:00
parent e7feb25bfa
commit 8b74138447
31 changed files with 66 additions and 82 deletions

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.c784857e.css" rel="prefetch"><link href="/static/css/main.90171b28.css" rel="prefetch"><link href="/static/css/main~workouts.c12079e7.css" rel="prefetch"><link href="/static/css/profile.23881524.css" rel="prefetch"><link href="/static/css/reset.528e2916.css" rel="prefetch"><link href="/static/css/workouts.a9a41b99.css" rel="prefetch"><link href="/static/js/admin.b2c267a7.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.44a7d380.js" rel="prefetch"><link href="/static/js/main~workouts.44a477db.js" rel="prefetch"><link href="/static/js/profile.a7cb3b48.js" rel="prefetch"><link href="/static/js/reset.607f183f.js" rel="prefetch"><link href="/static/js/workouts.4a8b05f4.js" rel="prefetch"><link href="/static/css/app.24ba011a.css" rel="preload" as="style"><link href="/static/js/app.b02bdc1f.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.61765c73.js" rel="preload" as="script"><link href="/static/css/app.24ba011a.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.61765c73.js"></script><script src="/static/js/app.b02bdc1f.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.c784857e.css" rel="prefetch"><link href="/static/css/main.4b6a4ae2.css" rel="prefetch"><link href="/static/css/main~workouts.c12079e7.css" rel="prefetch"><link href="/static/css/profile.a602fc10.css" rel="prefetch"><link href="/static/css/reset.5eaa1e50.css" rel="prefetch"><link href="/static/css/workouts.a9a41b99.css" rel="prefetch"><link href="/static/js/admin.b2c267a7.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.96af01eb.js" rel="prefetch"><link href="/static/js/main~workouts.44a477db.js" rel="prefetch"><link href="/static/js/profile.291e07db.js" rel="prefetch"><link href="/static/js/reset.60cf3dbf.js" rel="prefetch"><link href="/static/js/workouts.4a8b05f4.js" rel="prefetch"><link href="/static/css/app.24ba011a.css" rel="preload" as="style"><link href="/static/js/app.1d2a8a56.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.61765c73.js" rel="preload" as="script"><link href="/static/css/app.24ba011a.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.61765c73.js"></script><script src="/static/js/app.1d2a8a56.js"></script></body></html>

View File

@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/img/workouts/mountains.svg"
},
{
"revision": "9e86ef92a894641dfb2cb18d4eafa882",
"revision": "ea991ffce2185e4cc072abf683bedd86",
"url": "/index.html"
},
{
@ -80,7 +80,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/css/admin.c784857e.css"
},
{
"revision": "eb1b0ab18e7b390d39d4",
"revision": "7f1bfdb54f95f3215297",
"url": "/static/css/app.24ba011a.css"
},
{
@ -92,20 +92,20 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/css/leaflet.css"
},
{
"revision": "e459cb348928f86035a2",
"url": "/static/css/main.90171b28.css"
"revision": "05c628021239246381f3",
"url": "/static/css/main.4b6a4ae2.css"
},
{
"revision": "7cbc2a35623621321963",
"url": "/static/css/main~workouts.c12079e7.css"
},
{
"revision": "611a96d7197f82c08a4d",
"url": "/static/css/profile.23881524.css"
"revision": "c3fbb4741fcfd33236fb",
"url": "/static/css/profile.a602fc10.css"
},
{
"revision": "6942063225155477cb74",
"url": "/static/css/reset.528e2916.css"
"revision": "db3eca6d999a7b9aa538",
"url": "/static/css/reset.5eaa1e50.css"
},
{
"revision": "afbde641dcb3d7f75c9f",
@ -196,8 +196,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/admin.b2c267a7.js"
},
{
"revision": "eb1b0ab18e7b390d39d4",
"url": "/static/js/app.b02bdc1f.js"
"revision": "7f1bfdb54f95f3215297",
"url": "/static/js/app.1d2a8a56.js"
},
{
"revision": "bd7d183c9f68e5f4027d",
@ -224,20 +224,20 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/chunk-vendors.61765c73.js"
},
{
"revision": "e459cb348928f86035a2",
"url": "/static/js/main.44a7d380.js"
"revision": "05c628021239246381f3",
"url": "/static/js/main.96af01eb.js"
},
{
"revision": "7cbc2a35623621321963",
"url": "/static/js/main~workouts.44a477db.js"
},
{
"revision": "611a96d7197f82c08a4d",
"url": "/static/js/profile.a7cb3b48.js"
"revision": "c3fbb4741fcfd33236fb",
"url": "/static/js/profile.291e07db.js"
},
{
"revision": "6942063225155477cb74",
"url": "/static/js/reset.607f183f.js"
"revision": "db3eca6d999a7b9aa538",
"url": "/static/js/reset.60cf3dbf.js"
},
{
"revision": "afbde641dcb3d7f75c9f",

View File

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.f64af53e4d8d7da197055dd0a21b72e1.js"
"/precache-manifest.59ca4201c0d0fa2f3034655a073d8255.js"
);
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["profile"],{1655:function(e,t,c){"use strict";c("4bc8")},"36e8":function(e,t,c){"use strict";c.r(t);var r=c("7a23"),n=Object(r["withScopeId"])("data-v-41f121e3");Object(r["pushScopeId"])("data-v-41f121e3");var o={key:0,id:"profile",class:"container"};Object(r["popScopeId"])();var a=n((function(e,t,c,n,a,s){var u=Object(r["resolveComponent"])("router-view");return e.authUser.username?(Object(r["openBlock"])(),Object(r["createBlock"])("div",o,[Object(r["createVNode"])(u,{user:e.authUser},null,8,["user"])])):Object(r["createCommentVNode"])("",!0)})),s=c("dad5"),u=c("2906"),d=Object(r["defineComponent"])({name:"ProfileView",setup:function(){var e=Object(u["a"])(),t=Object(r["computed"])((function(){return e.getters[s["e"].GETTERS.AUTH_USER_PROFILE]}));return{authUser:t}}});c("1655");d.render=a,d.__scopeId="data-v-41f121e3";t["default"]=d},"4bc8":function(e,t,c){},a8b5:function(e,t,c){},ad3d:function(e,t,c){"use strict";c.r(t);var r=c("7a23"),n=Object(r["withScopeId"])("data-v-ea77cdfe");Object(r["pushScopeId"])("data-v-ea77cdfe");var o={key:0,id:"user"},a={class:"box"};Object(r["popScopeId"])();var s=n((function(e,t,c,n,s,u){var d=Object(r["resolveComponent"])("UserHeader"),i=Object(r["resolveComponent"])("UserInfos");return e.user.username?(Object(r["openBlock"])(),Object(r["createBlock"])("div",o,[Object(r["createVNode"])(d,{user:e.user},null,8,["user"]),Object(r["createVNode"])("div",a,[Object(r["createVNode"])(i,{user:e.user,"from-admin":!0},null,8,["user"])])])):Object(r["createCommentVNode"])("",!0)})),u=c("6c02"),d=c("3c44"),i=c("71a7"),p=c("dad5"),b=c("2906"),f=Object(r["defineComponent"])({name:"UserView",components:{UserHeader:d["a"],UserInfos:i["a"]},setup:function(){var e=Object(u["c"])(),t=Object(b["a"])(),c=Object(r["computed"])((function(){return t.getters[p["d"].GETTERS.USER]}));return Object(r["onBeforeMount"])((function(){e.params.username&&"string"===typeof e.params.username&&t.dispatch(p["d"].ACTIONS.GET_USER,e.params.username)})),Object(r["onBeforeUnmount"])((function(){t.dispatch(p["d"].ACTIONS.EMPTY_USER)})),{user:c}}});c("c969");f.render=s,f.__scopeId="data-v-ea77cdfe";t["default"]=f},c969:function(e,t,c){"use strict";c("a8b5")}}]);
//# sourceMappingURL=profile.291e07db.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["profile"],{"12a2":function(e,t,r){},"2b62d":function(e,t,r){"use strict";r("348d")},"32f5":function(e,t,r){"use strict";r.r(t);var c=r("7a23"),n=Object(c["withScopeId"])("data-v-5621c701");Object(c["pushScopeId"])("data-v-5621c701");var o={key:0,id:"user"},a={class:"box"};Object(c["popScopeId"])();var s=n((function(e,t,r,n,s,u){var d=Object(c["resolveComponent"])("UserHeader"),i=Object(c["resolveComponent"])("UserInfos");return e.user.username?(Object(c["openBlock"])(),Object(c["createBlock"])("div",o,[Object(c["createVNode"])(d,{user:e.user},null,8,["user"]),Object(c["createVNode"])("div",a,[Object(c["createVNode"])(i,{user:e.user,"from-admin":!0},null,8,["user"])])])):Object(c["createCommentVNode"])("",!0)})),u=r("6c02"),d=r("3c44"),i=r("71a7"),p=r("dad5"),f=r("2906"),b=Object(c["defineComponent"])({name:"UserView",components:{UserHeader:d["a"],UserInfos:i["a"]},setup:function(){var e=Object(u["c"])(),t=Object(f["a"])(),r=Object(c["computed"])((function(){return t.getters[p["d"].GETTERS.USER]}));return Object(c["onBeforeMount"])((function(){e.params.username&&"string"===typeof e.params.username&&t.dispatch(p["d"].ACTIONS.GET_USER,e.params.username)})),Object(c["onBeforeUnmount"])((function(){t.dispatch(p["d"].ACTIONS.EMPTY_USER)})),{user:r}}});r("2b62d");b.render=s,b.__scopeId="data-v-5621c701";t["default"]=b},"348d":function(e,t,r){},9126:function(e,t,r){"use strict";r.r(t);var c=r("7a23"),n=Object(c["withScopeId"])("data-v-fbf4983a");Object(c["pushScopeId"])("data-v-fbf4983a");var o={key:0,id:"profile",class:"container"};Object(c["popScopeId"])();var a=n((function(e,t,r,n,a,s){var u=Object(c["resolveComponent"])("router-view");return e.authUser.username?(Object(c["openBlock"])(),Object(c["createBlock"])("div",o,[Object(c["createVNode"])(u,{user:e.authUser},null,8,["user"])])):Object(c["createCommentVNode"])("",!0)})),s=r("dad5"),u=r("2906"),d=Object(c["defineComponent"])({name:"ProfileView",setup:function(){var e=Object(u["a"])(),t=Object(c["computed"])((function(){return e.getters[s["e"].GETTERS.AUTH_USER_PROFILE]}));return{authUser:t}}});r("fe4f");d.render=a,d.__scopeId="data-v-fbf4983a";t["default"]=d},fe4f:function(e,t,r){"use strict";r("12a2")}}]);
//# sourceMappingURL=profile.a7cb3b48.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
<div class="user-picture">
<img
v-if="authUserPictureUrl !== ''"
class="nav-profile-user-img"
class="profile-user-img"
:alt="$t('user.USER_PICTURE')"
:src="authUserPictureUrl"
/>
@ -30,7 +30,7 @@
return {
authUserPictureUrl: computed(() =>
props.user.picture
? `${getApiUrl()}users/${props.user.username}/picture?${Date.now()}`
? `${getApiUrl()}users/${props.user.username}/picture`
: ''
),
}

View File

@ -3,15 +3,7 @@
<div class="box">
<div class="workout-user-date">
<div class="workout-user">
<img
class="profile-img"
v-if="userPictureUrl !== ''"
:alt="$t('user.USER_PICTURE')"
:src="userPictureUrl"
/>
<div v-else class="no-picture">
<i class="fa fa-user-circle-o" aria-hidden="true" />
</div>
<UserPicture :user="user" />
<router-link
v-if="user.username"
class="workout-user-name"
@ -97,18 +89,19 @@
import { PropType, defineComponent, ComputedRef, computed } from 'vue'
import StaticMap from '@/components/Common/StaticMap.vue'
import UserPicture from '@/components/User/UserPicture.vue'
import { ROOT_STORE } from '@/store/constants'
import { ISport } from '@/types/sports'
import { IUserProfile } from '@/types/user'
import { IWorkout } from '@/types/workouts'
import { useStore } from '@/use/useStore'
import { getApiUrl } from '@/utils'
import { getDateWithTZ } from '@/utils/dates'
export default defineComponent({
name: 'WorkoutCard',
components: {
StaticMap,
UserPicture,
},
props: {
workout: {
@ -124,24 +117,16 @@
required: false,
},
},
setup(props) {
setup() {
const store = useStore()
const userPictureUrl: ComputedRef<string> = computed(() =>
props.user.picture
? `${getApiUrl()}/users/${props.user.username}/picture?${Date.now()}`
: ''
)
const locale: ComputedRef<Locale> = computed(
() => store.getters[ROOT_STORE.GETTERS.LOCALE]
)
return {
format,
formatDistance,
getDateWithTZ,
locale,
userPictureUrl,
}
},
})
@ -162,13 +147,14 @@
padding: $default-padding * 0.5 $default-padding;
.workout-user {
display: flex;
.profile-img {
border-radius: 50%;
height: 25px;
width: 25px;
}
.fa-user-circle-o {
font-size: 1.5em;
::v-deep(.user-picture) {
img {
height: 25px;
width: 25px;
}
.no-picture {
font-size: 1.5em;
}
}
.workout-user-name {
padding-left: 5px;

View File

@ -25,55 +25,63 @@ const routes: Array<RouteRecordRaw> = [
path: '/',
name: 'Dashboard',
component: () =>
import(/* webpackChunkName: 'main' */ '@/views/DashBoard.vue'),
import(/* webpackChunkName: 'main' */ '@/views/Dashboard.vue'),
},
{
path: '/login',
name: 'Login',
component: () =>
import(/* webpackChunkName: 'main' */ '@/views/LoginOrRegister.vue'),
import(/* webpackChunkName: 'main' */ '@/views/user/LoginOrRegister.vue'),
props: { action: 'login' },
},
{
path: '/register',
name: 'Register',
component: () =>
import(/* webpackChunkName: 'main' */ '@/views/LoginOrRegister.vue'),
import(/* webpackChunkName: 'main' */ '@/views/user/LoginOrRegister.vue'),
props: { action: 'register' },
},
{
path: '/password-reset/sent',
name: 'PasswordEmailSent',
component: () =>
import(/* webpackChunkName: 'reset' */ '@/views/PasswordResetView.vue'),
import(
/* webpackChunkName: 'reset' */ '@/views/user/PasswordResetView.vue'
),
props: { action: 'request-sent' },
},
{
path: '/password-reset/request',
name: 'PasswordResetRequest',
component: () =>
import(/* webpackChunkName: 'reset' */ '@/views/PasswordResetView.vue'),
import(
/* webpackChunkName: 'reset' */ '@/views/user/PasswordResetView.vue'
),
props: { action: 'reset-request' },
},
{
path: '/password-reset/password-updated',
name: 'PasswordUpdated',
component: () =>
import(/* webpackChunkName: 'reset' */ '@/views/PasswordResetView.vue'),
import(
/* webpackChunkName: 'reset' */ '@/views/user/PasswordResetView.vue'
),
props: { action: 'password-updated' },
},
{
path: '/password-reset',
name: 'PasswordReset',
component: () =>
import(/* webpackChunkName: 'reset' */ '@/views/PasswordResetView.vue'),
import(
/* webpackChunkName: 'reset' */ '@/views/user/PasswordResetView.vue'
),
props: { action: 'reset' },
},
{
path: '/profile',
name: 'Profile',
component: () =>
import(/* webpackChunkName: 'profile' */ '@/views/ProfileView.vue'),
import(/* webpackChunkName: 'profile' */ '@/views/user/ProfileView.vue'),
children: [
{
path: '',
@ -132,7 +140,7 @@ const routes: Array<RouteRecordRaw> = [
path: '/users/:username',
name: 'User',
component: () =>
import(/* webpackChunkName: 'profile' */ '@/views/UserView.vue'),
import(/* webpackChunkName: 'profile' */ '@/views/user/UserView.vue'),
},
{
path: '/workouts',

View File

@ -69,21 +69,14 @@
</template>
<script lang="ts">
import {
ComputedRef,
Ref,
computed,
defineComponent,
ref,
onUnmounted,
} from 'vue'
import { ComputedRef, Ref, computed, defineComponent, ref } from 'vue'
import Timeline from '@/components/Dashboard/Timeline.vue'
import UserCalendar from '@/components/Dashboard/UserCalendar/index.vue'
import UserMonthStats from '@/components/Dashboard/UserMonthStats.vue'
import UserRecords from '@/components/Dashboard/UserRecords/index.vue'
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
import { SPORTS_STORE, USER_STORE } from '@/store/constants'
import { ISport } from '@/types/sports'
import { IUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
@ -106,9 +99,6 @@
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
)
const isSelected: Ref<string> = ref('chart')
onUnmounted(() => {
store.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS)
})
function updateDisplayColumn(target: string) {
isSelected.value = target