Skip to content

Commit

Permalink
@Loading on teamquery
Browse files Browse the repository at this point in the history
  • Loading branch information
rbjornstad committed Oct 2, 2023
1 parent 9124c0a commit aeebf66
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ type Team implements Node {
apps(after: Cursor, before: Cursor, first: Int, last: Int): AppConnection!
deployKey: DeploymentKey!
deployments(after: Cursor, before: Cursor, first: Int, last: Int, limit: Int): DeploymentConnection!
description: String
description: String!
githubRepositories(after: Cursor, first: Int): GithubRepositoryConnection!
id: ID!
members(after: Cursor, before: Cursor, first: Int, last: Int): TeamMemberConnection!
Expand Down
2 changes: 1 addition & 1 deletion src/routes/team/[team]/(teamTabs)/+layout.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query TeamRoles($team: String!) {
team(name: $team) {
team(name: $team) @loading {
viewerIsAdmin
viewerIsMember
}
Expand Down
20 changes: 13 additions & 7 deletions src/routes/team/[team]/(teamTabs)/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<script lang="ts">
import { page } from '$app/stores';
import Tabs from '$lib/Tabs.svelte';
import { PendingValue } from '$houdini';
import Loading from '$lib/Loading.svelte';
import Tab from '$lib/Tab.svelte';
import Tabs from '$lib/Tabs.svelte';
import { replacer } from '$lib/replacer';
import type { PageData } from './$houdini';
Expand Down Expand Up @@ -39,12 +41,16 @@
{#each nav as { tab, routeId }}
<Tab href={replacer(routeId, { team })} active={currentRoute == routeId} title={tab} />
{/each}
{#if $TeamRoles.data?.team.viewerIsMember || $TeamRoles.data?.team.viewerIsAdmin}
<Tab
href={replacer('/team/[team]/(teamTabs)/settings', { team })}
active={currentRoute == '/team/[team]/(teamTabs)/settings'}
title="Settings"
/>
{#if $TeamRoles.data}
{#if $TeamRoles.data.team === PendingValue}
<Loading />
{:else if $TeamRoles.data.team.viewerIsMember || $TeamRoles.data.team.viewerIsAdmin}
<Tab
href={replacer('/team/[team]/(teamTabs)/settings', { team })}
active={currentRoute == '/team/[team]/(teamTabs)/settings'}
title="Settings"
/>
{/if}
{/if}
</Tabs>
<div class="container">
Expand Down

0 comments on commit aeebf66

Please sign in to comment.