feat: teams modal wrapper

This commit is contained in:
liyasthomas
2021-10-03 18:14:52 +05:30
parent e82a4a1d23
commit 41be5cc4a8
5 changed files with 87 additions and 37 deletions

View File

@@ -47,49 +47,65 @@
:label="$t('header.login')" :label="$t('header.login')"
@click.native="showLogin = true" @click.native="showLogin = true"
/> />
<span v-else class="px-2"> <div v-else class="space-x-2 inline-flex items-center">
<tippy ref="user" interactive trigger="click" theme="popover" arrow> <ButtonPrimary
<template #trigger> v-tippy="{ theme: 'tooltip' }"
<ProfilePicture :title="$t('team.invite_tooltip')"
v-if="currentUser.photoURL" :label="$t('team.invite')"
v-tippy="{ svg="user-plus"
theme: 'tooltip', class="
}" !bg-green-400
:url="currentUser.photoURL" !text-green-500
:alt="currentUser.displayName" !bg-opacity-10
:title="currentUser.displayName" !hover:bg-opacity-10 !hover:text-green-600 !hover:bg-green-600
indicator "
:indicator-styles="isOnLine ? 'bg-green-500' : 'bg-red-500'" @click.native="showTeamsModal = true"
/> />
<ButtonSecondary <span class="px-2">
v-else <tippy ref="user" interactive trigger="click" theme="popover" arrow>
v-tippy="{ theme: 'tooltip' }" <template #trigger>
:title="$t('header.account')" <ProfilePicture
class="rounded" v-if="currentUser.photoURL"
v-tippy="{
theme: 'tooltip',
}"
:url="currentUser.photoURL"
:alt="currentUser.displayName"
:title="currentUser.displayName"
indicator
:indicator-styles="isOnLine ? 'bg-green-500' : 'bg-red-500'"
/>
<ButtonSecondary
v-else
v-tippy="{ theme: 'tooltip' }"
:title="$t('header.account')"
class="rounded"
svg="user"
/>
</template>
<SmartItem
to="/profile"
svg="user" svg="user"
:label="$t('navigation.profile')"
@click.native="$refs.user.tippy().hide()"
/> />
</template> <SmartItem
<SmartItem to="/settings"
to="/profile" svg="settings"
svg="user" :label="$t('navigation.settings')"
:label="$t('navigation.profile')" @click.native="$refs.user.tippy().hide()"
@click.native="$refs.user.tippy().hide()" />
/> <FirebaseLogout @confirm-logout="$refs.user.tippy().hide()" />
<SmartItem </tippy>
to="/settings" </span>
svg="settings" </div>
:label="$t('navigation.settings')"
@click.native="$refs.user.tippy().hide()"
/>
<FirebaseLogout @confirm-logout="$refs.user.tippy().hide()" />
</tippy>
</span>
</div> </div>
</header> </header>
<AppAnnouncement v-if="!isOnLine" /> <AppAnnouncement v-if="!isOnLine" />
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" /> <FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
<AppSupport :show="showSupport" @hide-modal="showSupport = false" /> <AppSupport :show="showSupport" @hide-modal="showSupport = false" />
<AppPowerSearch :show="showSearch" @hide-modal="showSearch = false" /> <AppPowerSearch :show="showSearch" @hide-modal="showSearch = false" />
<TeamsModal :show="showTeamsModal" @hide-modal="showTeamsModal = false" />
</div> </div>
</template> </template>
@@ -127,6 +143,7 @@ export default defineComponent({
showInstallPrompt: null, showInstallPrompt: null,
showLogin: false, showLogin: false,
isOnLine: navigator.onLine, isOnLine: navigator.onLine,
showTeamsModal: false,
} }
}, },
async mounted() { async mounted() {

View File

@@ -0,0 +1,26 @@
<template>
<SmartModal
v-if="show"
:title="$t('app.invite_your_friends')"
@close="$emit('hide-modal')"
>
<template #body>
<Teams :modal="true" />
</template>
</SmartModal>
</template>
<script>
import { defineComponent } from "@nuxtjs/composition-api"
export default defineComponent({
props: {
show: Boolean,
},
methods: {
hideModal() {
this.$emit("hide-modal")
},
},
})
</script>

View File

@@ -26,7 +26,8 @@
</div> </div>
<div <div
v-else-if="!myTeams.loading && E.isRight(myTeams.data)" v-else-if="!myTeams.loading && E.isRight(myTeams.data)"
class="grid gap-4 sm:grid-cols-3 md:grid-cols-4" class="grid gap-4"
:class="modal ? 'grid-cols-1' : 'sm:grid-cols-3 md:grid-cols-4'"
> >
<TeamsTeam <TeamsTeam
v-for="(team, index) in myTeams.data.right.myTeams" v-for="(team, index) in myTeams.data.right.myTeams"
@@ -69,6 +70,10 @@ import { useGQLQuery } from "~/helpers/backend/GQLClient"
import { MyTeamsQueryError } from "~/helpers/backend/QueryErrors" import { MyTeamsQueryError } from "~/helpers/backend/QueryErrors"
import { TeamMemberRole } from "~/helpers/backend/types/TeamMemberRole" import { TeamMemberRole } from "~/helpers/backend/types/TeamMemberRole"
defineProps<{
modal: boolean
}>()
const showModalAdd = ref(false) const showModalAdd = ref(false)
const showModalEdit = ref(false) const showModalEdit = ref(false)
const editingTeam = ref<any>({}) // TODO: Check this out const editingTeam = ref<any>({}) // TODO: Check this out

View File

@@ -472,6 +472,8 @@
"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",
"invite": "Invite",
"invite_tooltip": "Invite people to this workspace",
"join_beta": "Join the beta program to access teams.", "join_beta": "Join the beta program to access teams.",
"left": "You left the team", "left": "You left the team",
"member_removed": "User removed", "member_removed": "User removed",

View File

@@ -73,7 +73,7 @@
</SmartTab> </SmartTab>
<SmartTab :id="'teams'" :label="$t('team.title')"> <SmartTab :id="'teams'" :label="$t('team.title')">
<AppSection label="teams"> <AppSection label="teams">
<Teams /> <Teams :modal="false" />
</AppSection> </AppSection>
</SmartTab> </SmartTab>
</SmartTabs> </SmartTabs>