This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show list of teams in submenu (#87)
* feat: show list of teams in submenu * feat: show active team in create menu * styles refactoring to reach TeamSelect and VisArchive * feat: user can switch active team via submenu * ui: fix styles in vis archive * show active team in hello world view * check if user.teams exists * show active team in hello world page * add "(private)" to no team * bump service-utils
- Loading branch information
Showing
10 changed files
with
158 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script> | ||
import SvgIcon from 'layout/partials/SvgIcon.svelte'; | ||
import { getContext } from 'svelte'; | ||
import { patch } from '@datawrapper/shared/httpReq'; | ||
const user = getContext('user'); | ||
async function select(team) { | ||
await patch('/v3/me/settings', { | ||
payload: { | ||
activeTeam: team ? team.id : null | ||
} | ||
}); | ||
$user.activeTeam = team; | ||
$user.teams.forEach(t => { | ||
t.active = team && t.id === team.id; | ||
}); | ||
$user = $user; | ||
} | ||
</script> | ||
|
||
{#if $user.teams && $user.teams.length} | ||
{#each $user.teams as team} | ||
<a | ||
href="#/select-team/{team.id}" | ||
class="navbar-item team-select" | ||
class:is-active-team={team.active} | ||
on:click|preventDefault={() => select(team)} | ||
> | ||
<SvgIcon icon="team{team.active ? '-check' : ''}" size="20px" /> | ||
{team.name} | ||
</a> | ||
{/each} | ||
<a | ||
href="#/select-team/none" | ||
on:click|preventDefault={() => select(null)} | ||
class="navbar-item team-select" | ||
class:is-active-team={!$user.activeTeam} | ||
> | ||
<SvgIcon icon="user{!$user.activeTeam ? '-check' : ''}" size="20px" /> No team | ||
<span class="has-text-grey">(private)</span> | ||
</a> | ||
{:else} | ||
<a class="navbar-item" href="/account/teams"> Create a team </a> | ||
{/if} | ||
|
||
<style> | ||
.team-select :global(.icon) { | ||
color: var(--color-dw-gray-50) !important; | ||
} | ||
.team-select.is-active-team { | ||
cursor: default; | ||
} | ||
.team-select.is-active-team :global(.icon) { | ||
color: var(--color-dw-blue-medium) !important; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters