refactor: remove EAInvite flag

This commit is contained in:
liyasthomas
2021-10-03 15:49:04 +05:30
parent ccdd4963cd
commit 7f501241f0
5 changed files with 43 additions and 60 deletions

View File

@@ -7,7 +7,7 @@
:selected="true" :selected="true"
/> />
<SmartTab <SmartTab
v-if="currentUser && currentUser.eaInvited && !doc" v-if="currentUser && !doc"
:id="'team-collections'" :id="'team-collections'"
:label="`${$t('collection.team_collections')}`" :label="`${$t('collection.team_collections')}`"
> >

View File

@@ -44,7 +44,7 @@ const {
$toast, $toast,
} = useContext() } = useContext()
const $t = i18n.t.bind(i18n) const t = i18n.t.bind(i18n)
defineProps<{ defineProps<{
show: boolean show: boolean
@@ -66,7 +66,7 @@ const addNewTeam = () =>
(err) => { (err) => {
// err is of type "invalid_name" | GQLError<Err> // err is of type "invalid_name" | GQLError<Err>
if (err === "invalid_name") { if (err === "invalid_name") {
$toast.error($t("team.name_length_insufficient").toString(), { $toast.error(t("team.name_length_insufficient").toString(), {
icon: "error_outline", icon: "error_outline",
}) })
} else { } else {

View File

@@ -36,6 +36,13 @@
@edit-team="editTeam(team, team.id)" @edit-team="editTeam(team, team.id)"
/> />
</div> </div>
<div
v-if="!myTeams.loading && E.isLeft(myTeams.data)"
class="flex items-center flex-col"
>
<i class="mb-4 material-icons">help_outline</i>
{{ $t("error.something_went_wrong") }}
</div>
</div> </div>
<TeamsAdd :show="showModalAdd" @hide-modal="displayModalAdd(false)" /> <TeamsAdd :show="showModalAdd" @hide-modal="displayModalAdd(false)" />
<!-- ¯\_(ツ)_/¯ --> <!-- ¯\_(ツ)_/¯ -->

View File

@@ -28,10 +28,6 @@ export interface UserInfo {
* URL to the profile photo of the user (or null if none available) * URL to the profile photo of the user (or null if none available)
*/ */
photoURL: string | null photoURL: string | null
/**
* Whether the user has access to Early Access features
*/
eaInvited: boolean
} }
/** /**
@@ -65,7 +61,6 @@ async function updateUserInfo() {
displayName displayName
email email
photoURL photoURL
eaInvited
} }
} }
`, `,
@@ -76,7 +71,6 @@ async function updateUserInfo() {
displayName: data.me.displayName, displayName: data.me.displayName,
email: data.me.email, email: data.me.email,
photoURL: data.me.photoURL, photoURL: data.me.photoURL,
eaInvited: data.me.eaInvited,
}) })
} catch (e) { } catch (e) {
currentUserInfo$.next(null) currentUserInfo$.next(null)

View File

@@ -47,9 +47,7 @@
<div class="flex items-center"> <div class="flex items-center">
<SmartToggle <SmartToggle
:on="SYNC_COLLECTIONS" :on="SYNC_COLLECTIONS"
@change=" @change="toggleSetting('syncCollections')"
toggleSettings('syncCollections', !SYNC_COLLECTIONS)
"
> >
{{ $t("settings.sync_collections") }} {{ $t("settings.sync_collections") }}
</SmartToggle> </SmartToggle>
@@ -57,9 +55,7 @@
<div class="flex items-center"> <div class="flex items-center">
<SmartToggle <SmartToggle
:on="SYNC_ENVIRONMENTS" :on="SYNC_ENVIRONMENTS"
@change=" @change="toggleSetting('syncEnvironments')"
toggleSettings('syncEnvironments', !SYNC_ENVIRONMENTS)
"
> >
{{ $t("settings.sync_environments") }} {{ $t("settings.sync_environments") }}
</SmartToggle> </SmartToggle>
@@ -67,7 +63,7 @@
<div class="flex items-center"> <div class="flex items-center">
<SmartToggle <SmartToggle
:on="SYNC_HISTORY" :on="SYNC_HISTORY"
@change="toggleSettings('syncHistory', !SYNC_HISTORY)" @change="toggleSetting('syncHistory')"
> >
{{ $t("settings.sync_history") }} {{ $t("settings.sync_history") }}
</SmartToggle> </SmartToggle>
@@ -75,11 +71,7 @@
</div> </div>
</section> </section>
</SmartTab> </SmartTab>
<SmartTab <SmartTab :id="'teams'" :label="$t('team.title')">
v-if="currentBackendUser && currentBackendUser.eaInvited"
:id="'teams'"
:label="$t('team.title')"
>
<AppSection label="teams"> <AppSection label="teams">
<Teams /> <Teams />
</AppSection> </AppSection>
@@ -92,47 +84,37 @@
</div> </div>
</template> </template>
<script lang="ts"> <script setup lang="ts">
import { defineComponent } from "@nuxtjs/composition-api" import {
import { currentUserInfo$ } from "~/helpers/teams/BackendUserInfo" ref,
useContext,
useMeta,
defineComponent,
} from "@nuxtjs/composition-api"
import { currentUser$ } from "~/helpers/fb/auth" import { currentUser$ } from "~/helpers/fb/auth"
import { useReadonlyStream } from "~/helpers/utils/composables" import { useReadonlyStream } from "~/helpers/utils/composables"
import { applySetting, SettingsType, useSetting } from "~/newstore/settings" import { toggleSetting, useSetting } from "~/newstore/settings"
import { KeysMatching } from "~/types/ts-utils"
export default defineComponent({ const {
setup() { app: { i18n },
return { } = useContext()
SYNC_COLLECTIONS: useSetting("syncCollections"),
SYNC_ENVIRONMENTS: useSetting("syncEnvironments"), const t = i18n.t.bind(i18n)
SYNC_HISTORY: useSetting("syncHistory"),
currentUser: useReadonlyStream(currentUser$, currentUser$.value), const showLogin = ref(false)
currentBackendUser: useReadonlyStream(
currentUserInfo$, const SYNC_COLLECTIONS = useSetting("syncCollections")
currentUserInfo$.value const SYNC_ENVIRONMENTS = useSetting("syncEnvironments")
), const SYNC_HISTORY = useSetting("syncHistory")
} const currentUser = useReadonlyStream(currentUser$, null)
},
data() { useMeta({
return { title: `${t("navigation.profile")} • Hoppscotch`,
showLogin: false, })
} </script>
},
head() { <script lang="ts">
return { export default defineComponent({
title: `${this.$t("navigation.profile")} • Hoppscotch`, head: {},
}
},
methods: {
applySetting<K extends keyof SettingsType>(key: K, value: SettingsType[K]) {
applySetting(key, value)
},
toggleSettings<K extends KeysMatching<SettingsType, boolean>>(
name: K,
value: SettingsType[K]
) {
this.applySetting(name, value)
},
},
}) })
</script> </script>