From 24d4e8c81f51c03551d05fdb4c38faa267d36e09 Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Tue, 26 Dec 2023 16:07:08 +0100 Subject: [PATCH 01/12] Added login comp and login page --- src/components/elements/LoginComponent.vue | 12 ++++++++++++ src/components/partials/PageMenu.vue | 7 ++----- src/layouts/AppLayout.vue | 2 +- src/router/index.ts | 7 +++++++ src/views/LoginPage.vue | 11 +++++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 src/components/elements/LoginComponent.vue create mode 100644 src/views/LoginPage.vue diff --git a/src/components/elements/LoginComponent.vue b/src/components/elements/LoginComponent.vue new file mode 100644 index 00000000..c5f5bcf1 --- /dev/null +++ b/src/components/elements/LoginComponent.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/partials/PageMenu.vue b/src/components/partials/PageMenu.vue index afc49934..bff29307 100644 --- a/src/components/partials/PageMenu.vue +++ b/src/components/partials/PageMenu.vue @@ -9,10 +9,7 @@ >Download Gameclient - + @@ -42,11 +39,11 @@ From e54c5e13749585d00cf576eea335e694aa6a472c Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Thu, 28 Dec 2023 11:42:13 +0100 Subject: [PATCH 02/12] login page works now --- package-lock.json | 8 +- package.json | 2 +- src/components/elements/LoginComponent.vue | 18 +++- src/components/modals/HCaptchaModal.vue | 2 +- src/def-composables/useLogin.ts | 99 ++++++++++++++++++++++ src/views/LoginPage.vue | 61 +++++++++++-- 6 files changed, 175 insertions(+), 15 deletions(-) create mode 100644 src/def-composables/useLogin.ts diff --git a/package-lock.json b/package-lock.json index 3e5782f7..33b539af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@cosmjs/launchpad": "^0.27.0", "@cosmjs/proto-signing": "^0.27.1", "@cosmjs/stargate": "^0.27.1", - "@hcaptcha/vue3-hcaptcha": "^1.0.1", + "@hcaptcha/vue3-hcaptcha": "^1.3.0", "@headlessui/tailwindcss": "^0.2.0", "@headlessui/vue": "^1.7.16", "@ignt/vue-library": "^0.4.3", @@ -751,9 +751,9 @@ } }, "node_modules/@hcaptcha/vue3-hcaptcha": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@hcaptcha/vue3-hcaptcha/-/vue3-hcaptcha-1.0.1.tgz", - "integrity": "sha512-WFA11dW9aXtMdbKSDTkwR3g5uEl2EU1J0sIbHWhWn53LJkqmvDnU/nZX02nOY8cZM/nOJ1+ZTqW0nkE+3baDRw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@hcaptcha/vue3-hcaptcha/-/vue3-hcaptcha-1.3.0.tgz", + "integrity": "sha512-IEonS6JiYdU7uy6aeib8cYtMO4nj8utwStbA9bWHyYbOvOvhpkV+AW8vfSKh6SntYxqle/TRwhv+kU9p92CfsA==", "dependencies": { "vue": "^3.2.19" }, diff --git a/package.json b/package.json index d59459c8..9c21a2e8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "@cosmjs/launchpad": "^0.27.0", "@cosmjs/proto-signing": "^0.27.1", "@cosmjs/stargate": "^0.27.1", - "@hcaptcha/vue3-hcaptcha": "^1.0.1", + "@hcaptcha/vue3-hcaptcha": "^1.3.0", "@headlessui/tailwindcss": "^0.2.0", "@headlessui/vue": "^1.7.16", "@ignt/vue-library": "^0.4.3", diff --git a/src/components/elements/LoginComponent.vue b/src/components/elements/LoginComponent.vue index c5f5bcf1..85af5941 100644 --- a/src/components/elements/LoginComponent.vue +++ b/src/components/elements/LoginComponent.vue @@ -1,12 +1,22 @@ diff --git a/src/components/modals/HCaptchaModal.vue b/src/components/modals/HCaptchaModal.vue index 4dce00ba..4a73fbf7 100644 --- a/src/components/modals/HCaptchaModal.vue +++ b/src/components/modals/HCaptchaModal.vue @@ -7,7 +7,7 @@ From 3525f6a69226266a2ac140dd3f5aab546a783263 Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Fri, 29 Dec 2023 00:08:29 +0100 Subject: [PATCH 03/12] Added auto login --- src/components/elements/LoginComponent.vue | 31 +++++++++++++++------- src/def-composables/useLogin.ts | 20 +++++++++----- src/views/LoginPage.vue | 18 ++++--------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/components/elements/LoginComponent.vue b/src/components/elements/LoginComponent.vue index 85af5941..f4713df2 100644 --- a/src/components/elements/LoginComponent.vue +++ b/src/components/elements/LoginComponent.vue @@ -1,22 +1,33 @@ diff --git a/src/def-composables/useLogin.ts b/src/def-composables/useLogin.ts index a7133359..f96c7393 100644 --- a/src/def-composables/useLogin.ts +++ b/src/def-composables/useLogin.ts @@ -4,17 +4,16 @@ import {useAddress} from "@/def-composables/useAddress"; import {env} from "@/env"; import {useNotifications} from "@/def-composables/useNotifications"; import type {Key} from "@keplr-wallet/types"; -import {useClient} from "@/composables/useClient"; import {useQuery} from "@/def-composables/useQuery"; -import {useLoggedIn} from "@/def-composables/useLoggedIn"; import { Client } from "decentralcardgame-cardchain-client-ts"; +import { ref } from "vue"; const useLoginInstance = () => { const {connectToKeplr, isKeplrAvailable, getKeplrAccParams} = useKeplr() const router = useRouter() - const {address} = useAddress() const {notifyFail, notifyInfo, notifySuccess} = useNotifications() const { queryQUser } = useQuery() + const isSignUpRequired = ref(true) const tryLogin = () => { signUpRequired().then((required) => { @@ -47,16 +46,20 @@ const useLoginInstance = () => { return true } + const checkSignUpRequired = () => { + return signUpRequired().then(value => { + isSignUpRequired.value = value + return value + }) + } + const onVerify = (res: any) => { - console.log(res) return getKeplrAccParams(env.chainId).then((value: Key) => { const data = { address: value.bech32Address, token: res, alias: value.name, }; - - console.log(data) const request = new Request(env.faucetNode, { method: "POST", @@ -68,6 +71,7 @@ const useLoginInstance = () => { return fetch(request).then((response) => { console.log("response", response); + checkSignUpRequired() if (response.status === 401) { notifyFail("Error", "Error captcha. Please reload page."); @@ -86,7 +90,9 @@ const useLoginInstance = () => { }); }; - return {login, signUpRequired, tryLogin, onVerify} + checkSignUpRequired() + + return {login, checkSignUpRequired, isSignUpRequired, tryLogin, onVerify} } let loginInstance: ReturnType; diff --git a/src/views/LoginPage.vue b/src/views/LoginPage.vue index 0cfa4217..04afa205 100644 --- a/src/views/LoginPage.vue +++ b/src/views/LoginPage.vue @@ -2,9 +2,9 @@

- {{ state.signUp ? "Sign up" : "Log in" }} + {{ isSignUpRequired ? "Sign up" : "Log in" }}

- Login with keplr
@@ -12,7 +12,7 @@

You have to sign up first

@@ -40,23 +40,15 @@ import { onMounted, reactive } from "vue"; import { env } from "@/env"; const { isKeplrAvailable } = useKeplr(); -const { login, signUpRequired, onVerify } = useLogin(); +const { checkSignUpRequired, login, isSignUpRequired, onVerify } = useLogin(); const initialState: { - signUp: Boolean; siteKey: string; } = { - signUp: false, siteKey: env.faucetSiteKey, }; const state = reactive(initialState); -const checkSignUp = () => { - console.log("yes") - signUpRequired().then((value) => (state.signUp = value)); -} - -onMounted(checkSignUp); - +onMounted(checkSignUpRequired); From e0df41d221963b84b40eda27352e92076f5e20f8 Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Fri, 29 Dec 2023 00:17:20 +0100 Subject: [PATCH 04/12] removed captcha modal --- src/components/modals/HCaptchaModal.vue | 90 ------------------------- 1 file changed, 90 deletions(-) delete mode 100644 src/components/modals/HCaptchaModal.vue diff --git a/src/components/modals/HCaptchaModal.vue b/src/components/modals/HCaptchaModal.vue deleted file mode 100644 index 4a73fbf7..00000000 --- a/src/components/modals/HCaptchaModal.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - From ca27b604637ae307ee17dff1816771bec304d79c Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Sun, 31 Dec 2023 18:17:58 +0100 Subject: [PATCH 05/12] Added base userview --- src/components/elements/CCProfileIcon.vue | 12 -- src/components/elements/LoginComponent.vue | 14 +- src/def-composables/useLogin.ts | 6 + src/router/index.ts | 2 +- src/views/{UserView.vue => UserView 1.vue} | 0 src/views/UserView/UserView.vue | 198 ++++++++++++++++++ .../UserView/UserViewHeadingContainer.vue | 6 + 7 files changed, 219 insertions(+), 19 deletions(-) delete mode 100644 src/components/elements/CCProfileIcon.vue rename src/views/{UserView.vue => UserView 1.vue} (100%) create mode 100644 src/views/UserView/UserView.vue create mode 100644 src/views/UserView/UserViewHeadingContainer.vue diff --git a/src/components/elements/CCProfileIcon.vue b/src/components/elements/CCProfileIcon.vue deleted file mode 100644 index 5a09fcfc..00000000 --- a/src/components/elements/CCProfileIcon.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/elements/LoginComponent.vue b/src/components/elements/LoginComponent.vue index f4713df2..abc9ddba 100644 --- a/src/components/elements/LoginComponent.vue +++ b/src/components/elements/LoginComponent.vue @@ -8,7 +8,9 @@ :src="loggedIn ? loggedInProfilePic : Profile" alt="PP" /> - {{isSignUpRequired ? "Log in / Sign up" : loggedIn ? "Profile" : "Login"}} + {{ + isSignUpRequired ? "Log in / Sign up" : loggedIn ? "Profile" : "Login" + }} @@ -17,17 +19,17 @@ import Profile from "@/assets/figma/Profile.png"; import { useProfilePic } from "@/def-composables/useProfilePic"; import { useLoggedIn } from "@/def-composables/useLoggedIn"; import { useLogin } from "@/def-composables/useLogin"; -import {onMounted} from "vue"; +import { onMounted } from "vue"; const { loggedInProfilePic } = useProfilePic(); const { loggedIn } = useLoggedIn(); const { tryLogin, isSignUpRequired, checkSignUpRequired } = useLogin(); onMounted(() => { - checkSignUpRequired().then(value => { + checkSignUpRequired().then((value) => { if (!value) { - tryLogin() + tryLogin(); } - }) -}) + }); +}); diff --git a/src/def-composables/useLogin.ts b/src/def-composables/useLogin.ts index f96c7393..a2e21c81 100644 --- a/src/def-composables/useLogin.ts +++ b/src/def-composables/useLogin.ts @@ -7,6 +7,7 @@ import type {Key} from "@keplr-wallet/types"; import {useQuery} from "@/def-composables/useQuery"; import { Client } from "decentralcardgame-cardchain-client-ts"; import { ref } from "vue"; +import {useLoggedIn} from "@/def-composables/useLoggedIn"; const useLoginInstance = () => { const {connectToKeplr, isKeplrAvailable, getKeplrAccParams} = useKeplr() @@ -14,8 +15,13 @@ const useLoginInstance = () => { const {notifyFail, notifyInfo, notifySuccess} = useNotifications() const { queryQUser } = useQuery() const isSignUpRequired = ref(true) + const {loggedIn} = useLoggedIn() + const {address} = useAddress() const tryLogin = () => { + if (loggedIn.value) { + router.push({name: "UserView", params: {id: address.value}}) + } signUpRequired().then((required) => { console.log(required) if (!required) { diff --git a/src/router/index.ts b/src/router/index.ts index 1a4f7e57..fb8e6e07 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -10,7 +10,7 @@ const LandingPage = () => import('@/views/LandingPage.vue') const ImprintPage = () => import('@/views/ImprintPage.vue') const TeamPage = () => import('@/views/TeamPage.vue') const VotingPage = () => import('@/views/VotingPage.vue') -const UserView = () => import('@/views/UserView.vue') +const UserView = () => import('@/views/UserView/UserView.vue') const CardView = () => import('@/views/AdvancedCardViewPage.vue') const GameclientAuthz = () => import("@/views/GameClientAuthzPage.vue") const Demo = () => import("@/views/Demo.vue") diff --git a/src/views/UserView.vue b/src/views/UserView 1.vue similarity index 100% rename from src/views/UserView.vue rename to src/views/UserView 1.vue diff --git a/src/views/UserView/UserView.vue b/src/views/UserView/UserView.vue new file mode 100644 index 00000000..3ef29053 --- /dev/null +++ b/src/views/UserView/UserView.vue @@ -0,0 +1,198 @@ + + + diff --git a/src/views/UserView/UserViewHeadingContainer.vue b/src/views/UserView/UserViewHeadingContainer.vue new file mode 100644 index 00000000..73bd90e2 --- /dev/null +++ b/src/views/UserView/UserViewHeadingContainer.vue @@ -0,0 +1,6 @@ + \ No newline at end of file From ca5d6ff404da4c63e673138f9f45f92f488e9eba Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Sun, 14 Jan 2024 22:25:16 +0100 Subject: [PATCH 06/12] Added profilepic component and made userview more mobild friendly --- package-lock.json | 6 ++-- .../elements/CCButton/RouterCCButton.vue | 2 +- src/components/elements/LoginComponent.vue | 6 ++-- .../elements/ProfilePicComponent.vue | 26 ++++++++++++++++ src/views/UserView/UserView.vue | 30 ++++++++++++++----- 5 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 src/components/elements/ProfilePicComponent.vue diff --git a/package-lock.json b/package-lock.json index 33b539af..0737f55b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2227,9 +2227,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001481", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", - "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==", + "version": "1.0.30001576", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", + "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", "dev": true, "funding": [ { diff --git a/src/components/elements/CCButton/RouterCCButton.vue b/src/components/elements/CCButton/RouterCCButton.vue index ee162226..1ea1c9dc 100644 --- a/src/components/elements/CCButton/RouterCCButton.vue +++ b/src/components/elements/CCButton/RouterCCButton.vue @@ -8,6 +8,7 @@ diff --git a/src/components/elements/LoginComponent.vue b/src/components/elements/LoginComponent.vue index abc9ddba..656e7e8d 100644 --- a/src/components/elements/LoginComponent.vue +++ b/src/components/elements/LoginComponent.vue @@ -3,8 +3,9 @@ class="text-white font-bold uppercase flex hover:underline my-auto" @click="tryLogin" > - PP @@ -20,6 +21,7 @@ import { useProfilePic } from "@/def-composables/useProfilePic"; import { useLoggedIn } from "@/def-composables/useLoggedIn"; import { useLogin } from "@/def-composables/useLogin"; import { onMounted } from "vue"; +import ProfilePicComponent from "@/components/elements/ProfilePicComponent.vue"; const { loggedInProfilePic } = useProfilePic(); const { loggedIn } = useLoggedIn(); diff --git a/src/components/elements/ProfilePicComponent.vue b/src/components/elements/ProfilePicComponent.vue new file mode 100644 index 00000000..6f23b366 --- /dev/null +++ b/src/components/elements/ProfilePicComponent.vue @@ -0,0 +1,26 @@ + + diff --git a/src/views/UserView/UserView.vue b/src/views/UserView/UserView.vue index 3ef29053..a82dc717 100644 --- a/src/views/UserView/UserView.vue +++ b/src/views/UserView/UserView.vue @@ -1,12 +1,22 @@