mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge branch 'users' of github.com:appwrite/appwrite-console-poc into storage
This commit is contained in:
@@ -3,13 +3,15 @@
|
||||
|
||||
export let value: string;
|
||||
|
||||
let showTooltip = 'none';
|
||||
|
||||
const copy = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(value);
|
||||
addNotification({
|
||||
message: 'Copied to clipboard.',
|
||||
type: 'success'
|
||||
});
|
||||
showTooltip = 'block';
|
||||
setTimeout(() => {
|
||||
showTooltip = 'none';
|
||||
}, 1000);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
@@ -21,7 +23,12 @@
|
||||
|
||||
<div class="input-text-wrapper is-with-end-button">
|
||||
<input {value} type="text" class="input-text" disabled />
|
||||
<button type="button" class="input-button" aria-label="Click to copy." on:click={copy}>
|
||||
<button type="button" class="input-button tooltip" aria-label="Click to copy." on:click={copy}>
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
<div class="tootip">
|
||||
<span class="tooltip-popup" style={`display: ${showTooltip}`} role="tooltip">
|
||||
Copied
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
+18
-1
@@ -1,4 +1,21 @@
|
||||
import type { Models } from 'src/sdk';
|
||||
import { writable } from 'svelte/store';
|
||||
import { sdkForConsole } from './sdk';
|
||||
|
||||
export const user = writable<Models.User<Record<string, unknown>>>();
|
||||
function createUserStore() {
|
||||
const { subscribe, set } = writable<Models.User<Record<string, unknown>>>();
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
set,
|
||||
fetchUser: async () => {
|
||||
try {
|
||||
set(await sdkForConsole.account.get());
|
||||
} catch (error) {
|
||||
//TODO: take care what happens here
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const user = createUserStore();
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { onMount } from 'svelte';
|
||||
import Notifications from '$lib/layout/notifications.svelte';
|
||||
@@ -16,7 +15,7 @@
|
||||
onMount(async () => {
|
||||
try {
|
||||
if (!$user) {
|
||||
user.set(await sdkForConsole.account.get());
|
||||
user.fetchUser();
|
||||
}
|
||||
|
||||
if (!$page.url.pathname.startsWith('/console')) {
|
||||
|
||||
@@ -37,11 +37,13 @@
|
||||
{#each response.logs as log}
|
||||
<TableRow>
|
||||
<TableCellText title="Client">
|
||||
<img
|
||||
height="32"
|
||||
width="32"
|
||||
src={`/icons/color/${log?.clientName.toLocaleLowerCase()}.svg`}
|
||||
alt={log.clientName} />
|
||||
<div class="image-item">
|
||||
<img
|
||||
height="20"
|
||||
width="20"
|
||||
src={`/icons/color/${log?.clientName.toLocaleLowerCase()}.svg`}
|
||||
alt={log.clientName} />
|
||||
</div>
|
||||
<span class="">
|
||||
<p>
|
||||
{log.clientName}
|
||||
|
||||
@@ -37,11 +37,13 @@
|
||||
{#each response.logs as log}
|
||||
<TableRow>
|
||||
<TableCellText title="Client">
|
||||
<img
|
||||
height="50"
|
||||
width="50"
|
||||
src={`/icons/color/${log?.clientName.toLocaleLowerCase()}.svg`}
|
||||
alt={log.clientName} />
|
||||
<div class="image-item">
|
||||
<img
|
||||
height="20"
|
||||
width="20"
|
||||
src={`/icons/color/${log?.clientName.toLocaleLowerCase()}.svg`}
|
||||
alt={log.clientName} />
|
||||
</div>
|
||||
<p>
|
||||
{log.clientName}
|
||||
{log.clientVersion}
|
||||
|
||||
@@ -50,11 +50,13 @@
|
||||
{#each response.sessions as session}
|
||||
<TableRow>
|
||||
<TableCellText title="Client">
|
||||
<img
|
||||
height="32"
|
||||
width="32"
|
||||
src={`/icons/color/${session?.clientName.toLocaleLowerCase()}.svg`}
|
||||
alt={session.clientName} />
|
||||
<div class="image-item">
|
||||
<img
|
||||
height="20"
|
||||
width="20"
|
||||
src={`/icons/color/${session?.clientName.toLocaleLowerCase()}.svg`}
|
||||
alt={session.clientName} />
|
||||
</div>
|
||||
<span class="">
|
||||
<p>
|
||||
{session.clientName}
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
import { Button, Form, FormItem, InputEmail, InputPassword } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { user } from '$lib/stores/user';
|
||||
|
||||
let mail: string, pass: string;
|
||||
|
||||
const login = async () => {
|
||||
try {
|
||||
await sdkForConsole.account.createSession(mail, pass);
|
||||
user.fetchUser();
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: 'Successfully logged in.'
|
||||
|
||||
Reference in New Issue
Block a user