2020-03-11 05:06:30 +13:00
|
|
|
<script>
|
2020-03-23 02:59:42 +13:00
|
|
|
import { onMount } from "svelte"
|
2020-04-01 00:16:03 +13:00
|
|
|
import { store, backendUiStore } from "builderStore"
|
|
|
|
import api from "builderStore/api"
|
2020-03-11 05:06:30 +13:00
|
|
|
import getIcon from "../common/icon"
|
|
|
|
import { CheckIcon } from "../common/Icons"
|
|
|
|
|
|
|
|
const getPage = (s, name) => {
|
|
|
|
const props = s.pages[name]
|
|
|
|
return { name, props }
|
|
|
|
}
|
|
|
|
|
2020-03-23 02:59:42 +13:00
|
|
|
$: currentAppInfo = {
|
|
|
|
appname: $store.appname,
|
2020-03-28 05:58:32 +13:00
|
|
|
instanceId: $backendUiStore.selectedDatabase.id,
|
2020-03-23 02:59:42 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
async function fetchUsers() {
|
2020-04-21 03:17:11 +12:00
|
|
|
const FETCH_USERS_URL = `/api/${currentAppInfo.instanceId}/users`
|
2020-03-28 05:58:32 +13:00
|
|
|
const response = await api.get(FETCH_USERS_URL)
|
2020-04-24 01:37:08 +12:00
|
|
|
const users = await response.json()
|
2020-03-26 10:47:17 +13:00
|
|
|
backendUiStore.update(state => {
|
|
|
|
state.users = users
|
|
|
|
return state
|
|
|
|
})
|
2020-03-23 02:59:42 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
onMount(fetchUsers)
|
2020-03-11 05:06:30 +13:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="root">
|
|
|
|
<ul>
|
2020-04-24 01:37:08 +12:00
|
|
|
{#each $backendUiStore.users as user}
|
2020-03-11 05:06:30 +13:00
|
|
|
<li>
|
|
|
|
<i class="ri-user-4-line" />
|
2020-03-28 05:58:32 +13:00
|
|
|
<button class:active={user.id === $store.currentUserId}>
|
|
|
|
{user.name}
|
|
|
|
</button>
|
2020-03-11 05:06:30 +13:00
|
|
|
</li>
|
|
|
|
{/each}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.root {
|
|
|
|
padding-bottom: 10px;
|
|
|
|
font-size: 0.9rem;
|
|
|
|
color: var(--secondary50);
|
|
|
|
font-weight: bold;
|
|
|
|
position: relative;
|
|
|
|
padding-left: 1.8rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
li {
|
|
|
|
margin: 0.5rem 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
|
|
|
margin: 0 0 0 6px;
|
|
|
|
padding: 0;
|
|
|
|
border: none;
|
|
|
|
font-family: Roboto;
|
2020-04-03 05:11:38 +13:00
|
|
|
font-size: 13px;
|
2020-03-11 05:06:30 +13:00
|
|
|
outline: none;
|
|
|
|
cursor: pointer;
|
2020-03-28 05:58:32 +13:00
|
|
|
background: rgba(0, 0, 0, 0);
|
2020-03-11 05:06:30 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
.active {
|
|
|
|
font-weight: 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
display: inline-block;
|
|
|
|
width: 14px;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
</style>
|