-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10b7dd8
commit 653e639
Showing
15 changed files
with
374 additions
and
27 deletions.
There are no files selected for viewing
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,24 @@ | ||
<script lang="ts"> | ||
import type { User } from '$lib/types/user'; | ||
import IconIC from '$lib/components/icons/IconIC.svelte'; | ||
import IconNFID from '$lib/components/icons/IconNFID.svelte'; | ||
interface Props { | ||
user: User; | ||
withText?: boolean; | ||
} | ||
let { user, withText = false }: Props = $props(); | ||
let { data } = $derived(user); | ||
let { provider } = $derived(data); | ||
</script> | ||
|
||
{#if provider === 'internet_identity'} | ||
<IconIC title="Internet Identity" />{#if withText} | ||
Internet Identity{/if} | ||
{:else if provider === 'nfid'} | ||
<IconNFID />{#if withText} | ||
NFID{/if} | ||
{/if} |
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
19 changes: 19 additions & 0 deletions
19
src/frontend/src/lib/components/icons/IconVisibility.svelte
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,19 @@ | ||
<!-- source: https://fonts.google.com/icons?selected=Material+Icons+Outlined:visibility:&icon.size=24&icon.color=%23000000&icon.query=visi&icon.set=Material+Icons --> | ||
<script lang="ts"> | ||
interface Props { | ||
size?: string; | ||
} | ||
let { size = '24px' }: Props = $props(); | ||
</script> | ||
|
||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
height={size} | ||
width={size} | ||
fill="currentColor" | ||
viewBox="0 0 24 24" | ||
><path d="M0 0h24v24H0V0z" fill="none" /><path | ||
d="M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z" | ||
/></svg | ||
> |
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
121 changes: 121 additions & 0 deletions
121
src/frontend/src/lib/components/modals/UserDetailsModal.svelte
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,121 @@ | ||
<script lang="ts"> | ||
import type { JunoModalDetail, JunoModalShowUserDetail } from '$lib/types/modal'; | ||
import Modal from '$lib/components/ui/Modal.svelte'; | ||
import { i18n } from '$lib/stores/i18n.store'; | ||
import Canister from '$lib/components/canister/Canister.svelte'; | ||
import Value from '$lib/components/ui/Value.svelte'; | ||
import Identifier from '$lib/components/ui/Identifier.svelte'; | ||
import UserProvider from '$lib/components/auth/UserProvider.svelte'; | ||
import { formatToDate } from '$lib/utils/date.utils'; | ||
interface Props { | ||
detail: JunoModalDetail; | ||
onclose: () => void; | ||
} | ||
let { detail, onclose }: Props = $props(); | ||
let { user, usages } = $derived(detail as JunoModalShowUserDetail); | ||
let { owner, created_at, updated_at } = $derived(user); | ||
</script> | ||
|
||
<Modal on:junoClose={onclose}> | ||
<h2>{$i18n.users.user_details}</h2> | ||
|
||
<div class="card-container columns-3 no-border"> | ||
<div> | ||
<Value> | ||
{#snippet label()} | ||
{$i18n.users.identifier} | ||
{/snippet} | ||
<Identifier small={false} identifier={owner.toText()} /> | ||
</Value> | ||
|
||
<Value> | ||
{#snippet label()} | ||
{$i18n.users.provider} | ||
{/snippet} | ||
<p class="provider"><UserProvider {user} withText /></p> | ||
</Value> | ||
</div> | ||
|
||
<div class="timestamps"> | ||
<Value> | ||
{#snippet label()} | ||
{$i18n.users.created} | ||
{/snippet} | ||
<p>{formatToDate(created_at)}</p> | ||
</Value> | ||
|
||
<Value> | ||
{#snippet label()} | ||
{$i18n.users.updated} | ||
{/snippet} | ||
<p>{formatToDate(updated_at)}</p> | ||
</Value> | ||
</div> | ||
|
||
{#if usages.length > 0} | ||
<div class="chart"> | ||
<Value> | ||
{#snippet label()} | ||
{$i18n.core.usage} | ||
{/snippet} | ||
|
||
<div class="table-container"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th> {$i18n.collections.title} </th> | ||
<th> {$i18n.users.persistence} </th> | ||
<th> {$i18n.users.changes} </th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
{#each usages as usage} | ||
<tr> | ||
<td>{usage.collection}</td> | ||
<td | ||
>{'Db' in usage.collectionType | ||
? $i18n.datastore.title | ||
: $i18n.storage.title}</td | ||
> | ||
<td>{usage.usage?.changes_count ?? 0}</td> | ||
</tr> | ||
{/each} | ||
</tbody> | ||
</table> | ||
</div> | ||
</Value> | ||
</div> | ||
{/if} | ||
</div> | ||
</Modal> | ||
|
||
<style lang="scss"> | ||
@use '../../styles/mixins/media'; | ||
.card-container { | ||
padding: var(--padding-2x) var(--padding-2x) 0 0; | ||
} | ||
.provider { | ||
display: inline-flex; | ||
gap: var(--padding); | ||
} | ||
.timestamps { | ||
grid-column: 2 / 4; | ||
} | ||
.chart { | ||
grid-column: 1 / 4; | ||
margin: var(--padding-2x) 0; | ||
} | ||
.table-container { | ||
margin: var(--padding) 0 0; | ||
} | ||
</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
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
Oops, something went wrong.