mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
started working on the user page
This commit is contained in:
1 parent
4234ce220d
commit
ea33c53284
1 file changed
+69
-21
@@ -2,14 +2,18 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Card, Copy } from '$lib/components';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import { Avatar, Card } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Container } from '$lib/layout';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { user } from './store';
|
||||
|
||||
const getAvatar = (name: string) =>
|
||||
sdkForProject.avatars.getInitials(name, 128, 128).toString();
|
||||
|
||||
const deleteUser = async (id: string) => {
|
||||
try {
|
||||
if (!confirm('Are you sure you want to delete that user?')) return;
|
||||
@@ -22,30 +26,74 @@
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<h1>Overview</h1>
|
||||
<Card>
|
||||
<Copy value={$user.$id} />
|
||||
<p><img src={getAvatar($user.name)} alt={$user.name} class="avatar" /></p>
|
||||
<p>{$user.$id}</p>
|
||||
<p>Member since {$user.registration}</p>
|
||||
<p>{$user.emailVerification ? 'Verified' : 'Unverified'}</p>
|
||||
<p>{$user.email}</p>
|
||||
<div class="u-flex u-main-space-between u-gap-12 common-section">
|
||||
<div class="user-profile-button">
|
||||
<Avatar
|
||||
size={50}
|
||||
name={$user.name}
|
||||
src={sdkForConsole.avatars.getInitials($user.name, 50, 50).toString()} />
|
||||
<span class="user-profile-info">
|
||||
<h6 class="heading-level-6">{$user.name}</h6>
|
||||
<span class="title">{$user.email}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<Pill>{$user.emailVerification ? 'Verified' : 'Unverified'}</Pill>
|
||||
<p>Joined on {toLocaleDate($user.registration)}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex u-main-space-end u-gap-12 common-section">
|
||||
<Button text>Block Account</Button>
|
||||
<Button secondary>Verify Account</Button>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<h1>Preferences</h1>
|
||||
<Card>
|
||||
{#each Object.entries($user.prefs) as [key, value]}
|
||||
<p>{key}: {value}</p>
|
||||
{:else}
|
||||
No user preferences found.
|
||||
{/each}
|
||||
<div class="u-flex u-main-space-between u-gap-12 common-section">
|
||||
<div>
|
||||
<h6 class="heading-level-6">User Preferences</h6>
|
||||
<p>
|
||||
You can update your user preferences by storing information on the user's
|
||||
objects so they can easily be shared across devices and sessions.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
{#each Object.entries($user.prefs) as [key, value]}
|
||||
<p>{key}: {value}</p>
|
||||
{:else}
|
||||
No user preferences found.
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex u-main-space-end common-section">
|
||||
<Button secondary>Update</Button>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<h1>Danger Zone</h1>
|
||||
<Card>
|
||||
<p>This is the area where you can delete this user.</p>
|
||||
<p>By deleting this user you will lose all data associated with this user.</p>
|
||||
<p>PLEASE NOTE: User deletion is irreversible.</p>
|
||||
<Button on:click={() => deleteUser($user.$id)}>Delete User</Button>
|
||||
<div class="u-flex u-main-space-between u-gap-12 common-section">
|
||||
<div>
|
||||
<h6 class="heading-level-6">Danger Zone</h6>
|
||||
<p>
|
||||
The user will be permanently deleted, including all data associated with this
|
||||
user. This action is irreversible.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="user-profile-button">
|
||||
<Avatar
|
||||
size={50}
|
||||
name={$user.name}
|
||||
src={sdkForConsole.avatars.getInitials($user.name, 50, 50).toString()} />
|
||||
<span class="user-profile-info">
|
||||
<h6 class="heading-level-6">{$user.name}</h6>
|
||||
<span class="title">{$user.email}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex u-main-space-end common-section">
|
||||
<!-- <Button secondary on:click={() => deleteUser($user.$id)}>Delete</Button> -->
|
||||
<Button secondary on:click={() => console.log('open modal')}>Delete</Button>
|
||||
</div>
|
||||
</Card>
|
||||
</Container>
|
||||
Reference in new issue
Block a user