From 08db8b718c9a453cd3da1138522fde44d7657b17 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Thu, 16 Feb 2023 19:06:44 +0100 Subject: [PATCH] Removed old pages, added users search. --- gymboard-app/src/api/search/models.ts | 3 + .../components/ExerciseSubmissionListItem.vue | 12 ++- .../components/UserSearchResultListItem.vue | 30 +++++++ gymboard-app/src/i18n/en-US/index.ts | 3 + gymboard-app/src/i18n/nl-NL/index.ts | 3 + gymboard-app/src/layouts/MainLayout.vue | 2 +- gymboard-app/src/pages/AboutPage.vue | 14 ---- .../{IndexPage.vue => GymSearchPage.vue} | 0 gymboard-app/src/pages/TestingPage.vue | 33 -------- gymboard-app/src/pages/UserPage.vue | 1 + gymboard-app/src/pages/UserSearchPage.vue | 84 +++++++++++++++++++ gymboard-app/src/pages/gym/GymHomePage.vue | 1 + .../src/pages/gym/GymLeaderboardsPage.vue | 1 + gymboard-app/src/router/routes.ts | 10 +-- .../src/main/resources/sql/select-users.sql | 2 +- 15 files changed, 142 insertions(+), 57 deletions(-) create mode 100644 gymboard-app/src/components/UserSearchResultListItem.vue delete mode 100644 gymboard-app/src/pages/AboutPage.vue rename gymboard-app/src/pages/{IndexPage.vue => GymSearchPage.vue} (100%) delete mode 100644 gymboard-app/src/pages/TestingPage.vue create mode 100644 gymboard-app/src/pages/UserSearchPage.vue diff --git a/gymboard-app/src/api/search/models.ts b/gymboard-app/src/api/search/models.ts index 224a4f4..ecc728a 100644 --- a/gymboard-app/src/api/search/models.ts +++ b/gymboard-app/src/api/search/models.ts @@ -15,4 +15,7 @@ export interface GymSearchResult { export interface UserSearchResult { id: string; name: string; + submissionCount: number; + accountPrivate: boolean; + locale: string; } diff --git a/gymboard-app/src/components/ExerciseSubmissionListItem.vue b/gymboard-app/src/components/ExerciseSubmissionListItem.vue index 7c39d5a..36bcb33 100644 --- a/gymboard-app/src/components/ExerciseSubmissionListItem.vue +++ b/gymboard-app/src/components/ExerciseSubmissionListItem.vue @@ -5,9 +5,12 @@ {{ submission.rawWeight }} {{ WeightUnitUtil.toAbbreviation(submission.weightUnit) }} {{ submission.exercise.displayName }} - + {{ submission.user.name }} + + {{ submission.gym.displayName }} + {{ submission.performedAt.setLocale($i18n.locale).toLocaleString(DateTime.DATETIME_MED) }} @@ -21,8 +24,13 @@ import { DateTime } from 'luxon'; interface Props { submission: ExerciseSubmission; + showName?: boolean; + showGym?: boolean; } -defineProps(); +withDefaults(defineProps(), { + showName: true, + showGym: true, +}); diff --git a/gymboard-app/src/components/UserSearchResultListItem.vue b/gymboard-app/src/components/UserSearchResultListItem.vue new file mode 100644 index 0000000..e433225 --- /dev/null +++ b/gymboard-app/src/components/UserSearchResultListItem.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/gymboard-app/src/i18n/en-US/index.ts b/gymboard-app/src/i18n/en-US/index.ts index 6389ee7..765bf9f 100644 --- a/gymboard-app/src/i18n/en-US/index.ts +++ b/gymboard-app/src/i18n/en-US/index.ts @@ -48,6 +48,9 @@ export default { accountPrivate: 'This account is private.', recentLifts: 'Recent Lifts', }, + userSearchPage: { + searchHint: 'Search for a user' + }, userSettingsPage: { title: 'Account Settings', password: 'Password', diff --git a/gymboard-app/src/i18n/nl-NL/index.ts b/gymboard-app/src/i18n/nl-NL/index.ts index c8b31d6..d83c6f4 100644 --- a/gymboard-app/src/i18n/nl-NL/index.ts +++ b/gymboard-app/src/i18n/nl-NL/index.ts @@ -48,6 +48,9 @@ export default { accountPrivate: 'Dit account is privaat.', recentLifts: 'Recente liften', }, + userSearchPage: { + searchHint: 'Zoek een gebruiker' + }, userSettingsPage: { title: 'Account instellingen', password: 'Wachtwoord', diff --git a/gymboard-app/src/layouts/MainLayout.vue b/gymboard-app/src/layouts/MainLayout.vue index c4f881e..54cf531 100644 --- a/gymboard-app/src/layouts/MainLayout.vue +++ b/gymboard-app/src/layouts/MainLayout.vue @@ -27,7 +27,7 @@ Gyms Global Leaderboard - Testing Page + Users About diff --git a/gymboard-app/src/pages/AboutPage.vue b/gymboard-app/src/pages/AboutPage.vue deleted file mode 100644 index 83fe221..0000000 --- a/gymboard-app/src/pages/AboutPage.vue +++ /dev/null @@ -1,14 +0,0 @@ - - diff --git a/gymboard-app/src/pages/IndexPage.vue b/gymboard-app/src/pages/GymSearchPage.vue similarity index 100% rename from gymboard-app/src/pages/IndexPage.vue rename to gymboard-app/src/pages/GymSearchPage.vue diff --git a/gymboard-app/src/pages/TestingPage.vue b/gymboard-app/src/pages/TestingPage.vue deleted file mode 100644 index 4ae6ca7..0000000 --- a/gymboard-app/src/pages/TestingPage.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/gymboard-app/src/pages/UserPage.vue b/gymboard-app/src/pages/UserPage.vue index 166e544..d237304 100644 --- a/gymboard-app/src/pages/UserPage.vue +++ b/gymboard-app/src/pages/UserPage.vue @@ -19,6 +19,7 @@ v-for="sub in recentSubmissions" :submission="sub" :key="sub.id" + :show-name="false" /> diff --git a/gymboard-app/src/pages/UserSearchPage.vue b/gymboard-app/src/pages/UserSearchPage.vue new file mode 100644 index 0000000..f7e471c --- /dev/null +++ b/gymboard-app/src/pages/UserSearchPage.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/gymboard-app/src/pages/gym/GymHomePage.vue b/gymboard-app/src/pages/gym/GymHomePage.vue index c32dafe..5df2aec 100644 --- a/gymboard-app/src/pages/gym/GymHomePage.vue +++ b/gymboard-app/src/pages/gym/GymHomePage.vue @@ -34,6 +34,7 @@ v-for="sub in recentSubmissions" :submission="sub" :key="sub.id" + :show-gym="false" /> diff --git a/gymboard-app/src/pages/gym/GymLeaderboardsPage.vue b/gymboard-app/src/pages/gym/GymLeaderboardsPage.vue index a86d500..133f12e 100644 --- a/gymboard-app/src/pages/gym/GymLeaderboardsPage.vue +++ b/gymboard-app/src/pages/gym/GymLeaderboardsPage.vue @@ -22,6 +22,7 @@ v-for="sub in submissions" :submission="sub" :key="sub.id" + :show-gym="false" /> diff --git a/gymboard-app/src/router/routes.ts b/gymboard-app/src/router/routes.ts index 35f2e7e..5cbebfa 100644 --- a/gymboard-app/src/router/routes.ts +++ b/gymboard-app/src/router/routes.ts @@ -1,12 +1,10 @@ import { RouteRecordRaw } from 'vue-router'; import MainLayout from 'layouts/MainLayout.vue'; -import IndexPage from 'pages/IndexPage.vue'; -import AboutPage from 'pages/AboutPage.vue'; +import GymSearchPage from 'pages/GymSearchPage.vue'; import GymPage from 'pages/gym/GymPage.vue'; import GymSubmissionPage from 'pages/gym/GymSubmissionPage.vue'; import GymHomePage from 'pages/gym/GymHomePage.vue'; import GymLeaderboardsPage from 'pages/gym/GymLeaderboardsPage.vue'; -import TestingPage from 'pages/TestingPage.vue'; import LoginPage from 'pages/auth/LoginPage.vue'; import RegisterPage from 'pages/auth/RegisterPage.vue'; import RegistrationSuccessPage from 'pages/auth/RegistrationSuccessPage.vue'; @@ -14,6 +12,7 @@ import ActivationPage from 'pages/auth/ActivationPage.vue'; import SubmissionPage from 'pages/SubmissionPage.vue'; import UserPage from 'pages/UserPage.vue'; import UserSettingsPage from 'pages/auth/UserSettingsPage.vue'; +import UserSearchPage from 'pages/UserSearchPage.vue'; const routes: RouteRecordRaw[] = [ // Auth-related pages, which live outside the main layout. @@ -27,8 +26,8 @@ const routes: RouteRecordRaw[] = [ path: '/', component: MainLayout, children: [ - { path: '', component: IndexPage }, - { path: 'testing', component: TestingPage }, + { path: '', component: GymSearchPage }, + { path: 'users', component: UserSearchPage }, { path: 'users/:userId', children: [ @@ -48,7 +47,6 @@ const routes: RouteRecordRaw[] = [ ], }, { path: 'submissions/:submissionId', component: SubmissionPage }, - { path: 'about', component: AboutPage }, ], }, diff --git a/gymboard-search/src/main/resources/sql/select-users.sql b/gymboard-search/src/main/resources/sql/select-users.sql index 6df9427..282a217 100644 --- a/gymboard-search/src/main/resources/sql/select-users.sql +++ b/gymboard-search/src/main/resources/sql/select-users.sql @@ -5,7 +5,7 @@ SELECT ( SELECT COUNT(id) FROM submission - WHERE submission.id = u.id + WHERE submission.user_id = u.id ) as submission_count, p.account_private as account_private, p.locale as locale