feat: init loading states, minor ui improvements
This commit is contained in:
@@ -29,6 +29,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="sendingInvites"
|
||||||
|
class="flex p-4 items-center justify-center"
|
||||||
|
>
|
||||||
|
<SmartSpinner />
|
||||||
|
</div>
|
||||||
<div v-else class="flex flex-col px-2">
|
<div v-else class="flex flex-col px-2">
|
||||||
<div class="flex flex-1 justify-between items-center">
|
<div class="flex flex-1 justify-between items-center">
|
||||||
<label for="memberList" class="pb-4 px-4">
|
<label for="memberList" class="pb-4 px-4">
|
||||||
@@ -375,6 +381,8 @@ const sendInvitesResult = ref<
|
|||||||
}>
|
}>
|
||||||
>([])
|
>([])
|
||||||
|
|
||||||
|
const sendingInvites = ref<boolean>(false)
|
||||||
|
|
||||||
const sendInvites = async () => {
|
const sendInvites = async () => {
|
||||||
const validationResult = pipe(
|
const validationResult = pipe(
|
||||||
newInvites.value,
|
newInvites.value,
|
||||||
@@ -400,6 +408,8 @@ const sendInvites = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendingInvites.value = true
|
||||||
|
|
||||||
sendInvitesResult.value = await pipe(
|
sendInvitesResult.value = await pipe(
|
||||||
A.sequence(T.task)(validationResult.value),
|
A.sequence(T.task)(validationResult.value),
|
||||||
T.chain(
|
T.chain(
|
||||||
@@ -423,9 +433,12 @@ const sendInvites = async () => {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)()
|
)()
|
||||||
|
|
||||||
|
sendingInvites.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const hideModal = () => {
|
const hideModal = () => {
|
||||||
|
sendingInvites.value = false
|
||||||
sendInvitesResult.value = []
|
sendInvitesResult.value = []
|
||||||
newInvites.value = []
|
newInvites.value = []
|
||||||
emit("hide-modal")
|
emit("hide-modal")
|
||||||
|
|||||||
@@ -478,10 +478,13 @@
|
|||||||
"exit_disabled": "Only owner cannot exit the team",
|
"exit_disabled": "Only owner cannot exit the team",
|
||||||
"invalid_email_format": "Email format is invalid",
|
"invalid_email_format": "Email format is invalid",
|
||||||
"invalid_member_permission": "Please provide a valid permission to the team member",
|
"invalid_member_permission": "Please provide a valid permission to the team member",
|
||||||
|
"invalid_invite_link": "Invalid invite link",
|
||||||
|
"invalid_invite_link_description": "The link you followed is invalid. Contact your team owner.",
|
||||||
"invite": "Invite",
|
"invite": "Invite",
|
||||||
"invite_more": "Invite more",
|
"invite_more": "Invite more",
|
||||||
"invite_tooltip": "Invite people to this workspace",
|
"invite_tooltip": "Invite people to this workspace",
|
||||||
"invited_to_team": "{owner} invited you to join {team}",
|
"invited_to_team": "{owner} invited you to join {team}",
|
||||||
|
"join": "Invitation accepted",
|
||||||
"join_beta": "Join the beta program to access teams.",
|
"join_beta": "Join the beta program to access teams.",
|
||||||
"join_team": "Join {team}",
|
"join_team": "Join {team}",
|
||||||
"left": "You left the team",
|
"left": "You left the team",
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
"lint:script": "eslint --ext .ts,.js,.vue --ignore-path .gitignore",
|
"lint:script": "eslint --ext .ts,.js,.vue --ignore-path .gitignore",
|
||||||
"lint:style": "stylelint **/*.{css,scss,vue} --ignore-path .gitignore",
|
"lint:style": "stylelint **/*.{css,scss,vue} --ignore-path .gitignore",
|
||||||
"lint": "pnpm run lint:script && pnpm run lint:style",
|
"lint": "pnpm run lint:script && pnpm run lint:style",
|
||||||
"lintfix": "eslint --ext .ts,.js,.vue --ignore-path .gitignore --fix",
|
"lintfix:script": "eslint --fix --ext .ts,.js,.vue --ignore-path .gitignore",
|
||||||
|
"lintfix:style": "stylelint --fix **/*.{css,scss,vue} --ignore-path .gitignore",
|
||||||
|
"lintfix": "pnpm run lintfix:script && pnpm run lintfix:style",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"do-dev": "pnpm run dev",
|
"do-dev": "pnpm run dev",
|
||||||
"do-build-prod": "pnpm run generate",
|
"do-build-prod": "pnpm run generate",
|
||||||
|
|||||||
@@ -1,26 +1,45 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col min-h-screen items-center justify-center">
|
<div class="flex flex-col min-h-screen items-center justify-between">
|
||||||
<h1 class="heading">{{ $t("team.join_team", { team: "Tesla" }) }}</h1>
|
<div
|
||||||
<p class="text-secondaryLight mt-2">
|
v-if="invalidLink"
|
||||||
{{ $t("team.invited_to_team", { owner: "Elon Musk", team: "Tesla" }) }}
|
class="flex flex-1 items-center justify-center flex-col"
|
||||||
</p>
|
>
|
||||||
<div v-if="currentUser === null" class="mt-8">
|
<h1 class="heading text-center">
|
||||||
<ButtonPrimary
|
{{ $t("team.invalid_invite_link") }}
|
||||||
:label="$t('auth.login_to_hoppscotch')"
|
</h1>
|
||||||
@click.native="showLogin = true"
|
<p class="text-center">
|
||||||
|
{{ $t("team.invalid_invite_link_description") }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div v-else class="flex-col flex-1 p-4 flex items-center justify-center">
|
||||||
|
<h1 class="heading">{{ $t("team.join_team", { team: "Tesla" }) }}</h1>
|
||||||
|
<p class="text-secondaryLight mt-2">
|
||||||
|
{{ $t("team.invited_to_team", { owner: "Elon Musk", team: "Tesla" }) }}
|
||||||
|
</p>
|
||||||
|
<div v-if="currentUser === null" class="mt-8">
|
||||||
|
<ButtonPrimary
|
||||||
|
:label="$t('auth.login_to_hoppscotch')"
|
||||||
|
@click.native="showLogin = true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else class="mt-8">
|
||||||
|
<ButtonPrimary
|
||||||
|
:label="$t('team.join_team', { team: 'Tesla' })"
|
||||||
|
:loading="loading"
|
||||||
|
:disabled="revokedLink"
|
||||||
|
@click.native="joinTeam"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<pre v-if="error" class="p-4 text-red-500">{{ error }}</pre>
|
||||||
|
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
|
||||||
|
</div>
|
||||||
|
<div class="p-4">
|
||||||
|
<ButtonSecondary
|
||||||
|
class="tracking-wide !font-bold !text-secondaryDark"
|
||||||
|
label="HOPPSCOTCH"
|
||||||
|
to="/"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="mt-8">
|
|
||||||
<ButtonPrimary
|
|
||||||
:label="$t('team.join_team', { team: 'Tesla' })"
|
|
||||||
@click.native="joinTeam"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<!-- <SmartSpinner v-if="loading" />
|
|
||||||
<SmartLoadingIndicator v-else />
|
|
||||||
<pre v-if="error">{{ error }}</pre>
|
|
||||||
TODO: revoked invite link -->
|
|
||||||
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -39,17 +58,37 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
invalidLink: false,
|
||||||
showLogin: false,
|
showLogin: false,
|
||||||
// loading : false
|
loading: false,
|
||||||
// error : null
|
revokedLink: false,
|
||||||
|
error: null,
|
||||||
|
teamID: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
initializeFirebase()
|
initializeFirebase()
|
||||||
},
|
},
|
||||||
async mounted() {},
|
mounted() {
|
||||||
|
this.teamID = this.$route.query.id
|
||||||
|
this.invalidLink = !this.teamID
|
||||||
|
// TODO: check revokeTeamInvitation
|
||||||
|
// TODO: check login user already a member
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
joinTeam() {},
|
joinTeam() {
|
||||||
|
this.loading = true
|
||||||
|
// TODO: run join team mutation
|
||||||
|
// TODO: show success toast and redirect to home page / error toast
|
||||||
|
// this.$router.push({ path: "/" })
|
||||||
|
// $toast.success(`${t("team.join")}`, {
|
||||||
|
// icon: "person",
|
||||||
|
// })
|
||||||
|
// this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||||
|
// icon: "error_outline",
|
||||||
|
// })
|
||||||
|
// console.error(e)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user