mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
Add web interface with admin functionality (#167)
This commit is contained in:
parent
79dea504b0
commit
a779c3803c
76 changed files with 8252 additions and 87 deletions
41
web/src/lib/components/admin/user-management.svelte
Normal file
41
web/src/lib/components/admin/user-management.svelte
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import PencilOutline from 'svelte-material-icons/PencilOutline.svelte';
|
||||
export let usersOnServer: Array<any>;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
||||
<p class="text-sm">USER LIST</p>
|
||||
|
||||
<table class="text-left w-full my-4">
|
||||
<thead class="border rounded-md mb-2 bg-gray-50 flex text-immich-primary w-full h-12 ">
|
||||
<tr class="flex w-full place-items-center">
|
||||
<th class="text-center w-1/4 font-medium text-sm">Email</th>
|
||||
<th class="text-center w-1/4 font-medium text-sm">First name</th>
|
||||
<th class="text-center w-1/4 font-medium text-sm">Last name</th>
|
||||
<th class="text-center w-1/4 font-medium text-sm">Edit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="overflow-y-auto rounded-md w-full max-h-[320px] block border">
|
||||
{#each usersOnServer as user, i}
|
||||
<tr
|
||||
class={`text-center flex place-items-center w-full border-b h-[80px] ${
|
||||
i % 2 == 0 ? 'bg-gray-100' : 'bg-immich-bg'
|
||||
}`}
|
||||
>
|
||||
<td class="text-sm px-4 w-1/4 text-ellipsis">{user.email}</td>
|
||||
<td class="text-sm px-4 w-1/4 text-ellipsis">{user.firstName}</td>
|
||||
<td class="text-sm px-4 w-1/4 text-ellipsis">{user.lastName}</td>
|
||||
<td class="text-sm px-4 w-1/4 text-ellipsis"
|
||||
><button
|
||||
class="bg-immich-primary text-gray-100 rounded-full p-3 transition-all duration-150 hover:bg-immich-primary/75"
|
||||
><PencilOutline size="20" /></button
|
||||
></td
|
||||
>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button on:click={() => dispatch('createUser')} class="immich-btn-primary">Create user</button>
|
||||
78
web/src/lib/components/forms/admin-registration-form.svelte
Normal file
78
web/src/lib/components/forms/admin-registration-form.svelte
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { sendRegistrationForm } from '$lib/auth-api';
|
||||
let error: string;
|
||||
let success: string;
|
||||
|
||||
async function registerAdmin(event: SubmitEvent) {
|
||||
error = '';
|
||||
|
||||
const formElement = event.target as HTMLFormElement;
|
||||
|
||||
const response = await sendRegistrationForm(formElement);
|
||||
|
||||
if (response.error) {
|
||||
error = JSON.stringify(response.error);
|
||||
}
|
||||
|
||||
if (response.success) {
|
||||
success = response.success;
|
||||
goto('/auth/login');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="border bg-white p-4 shadow-sm w-[500px] rounded-md py-8">
|
||||
<div class="flex flex-col place-items-center place-content-center gap-4 px-4">
|
||||
<img class="text-center" src="/immich-logo.svg" height="100" width="100" alt="immich-logo" />
|
||||
<h1 class="text-2xl text-immich-primary font-medium">Admin Registration</h1>
|
||||
<p class="text-sm border rounded-md p-4 font-mono text-gray-600">
|
||||
Since you are the first user on the system, you will be assigned as the Admin and are responsible for
|
||||
administrative tasks, and additional users will be created by you.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form on:submit|preventDefault={registerAdmin} method="post" action="" autocomplete="off">
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="email">Admin Email</label>
|
||||
<input class="immich-form-input" id="email" name="email" type="email" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="password">Admin Password</label>
|
||||
<input class="immich-form-input" id="password" name="password" type="password" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="password">First Name</label>
|
||||
<input class="immich-form-input" id="firstName" name="firstName" type="text" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="password">Last Name</label>
|
||||
<input class="immich-form-input" id="lastName" name="lastName" type="text" required />
|
||||
</div>
|
||||
|
||||
{#if error}
|
||||
<p class="text-red-400">{error}</p>
|
||||
{/if}
|
||||
|
||||
{#if success}
|
||||
<div>
|
||||
<p>Admin account has been registered</p>
|
||||
<p>
|
||||
<a href="/auth/login">Login</a>
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex w-full">
|
||||
<button
|
||||
type="submit"
|
||||
class="m-4 p-2 bg-immich-primary hover:bg-immich-primary/75 px-6 py-4 text-white rounded-md shadow-md w-full"
|
||||
>Sign Up</button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
74
web/src/lib/components/forms/create-user-form.svelte
Normal file
74
web/src/lib/components/forms/create-user-form.svelte
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<script lang="ts">
|
||||
import { sendRegistrationForm } from '$lib/auth-api';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
let error: string;
|
||||
let success: string;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
async function registerUser(event: SubmitEvent) {
|
||||
error = '';
|
||||
|
||||
const formElement = event.target as HTMLFormElement;
|
||||
|
||||
const response = await sendRegistrationForm(formElement);
|
||||
|
||||
if (response.error) {
|
||||
error = JSON.stringify(response.error);
|
||||
}
|
||||
|
||||
if (response.success) {
|
||||
success = 'New user created';
|
||||
|
||||
dispatch('user-created');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="border bg-white p-4 shadow-sm w-[500px] rounded-md py-8">
|
||||
<div class="flex flex-col place-items-center place-content-center gap-4 px-4">
|
||||
<img class="text-center" src="/immich-logo.svg" height="100" width="100" alt="immich-logo" />
|
||||
<h1 class="text-2xl text-immich-primary font-medium">Create new user</h1>
|
||||
<p class="text-sm border rounded-md p-4 font-mono text-gray-600">
|
||||
Please provide your user with the password, they will have to change it on their first sign in.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form on:submit|preventDefault={registerUser} method="post" action="/admin/api/create-user" autocomplete="off">
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="email">Email</label>
|
||||
<input class="immich-form-input" id="email" name="email" type="email" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="password">Password</label>
|
||||
<input class="immich-form-input" id="password" name="password" type="password" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="password">First Name</label>
|
||||
<input class="immich-form-input" id="firstName" name="firstName" type="text" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="password">Last Name</label>
|
||||
<input class="immich-form-input" id="lastName" name="lastName" type="text" required />
|
||||
</div>
|
||||
|
||||
{#if error}
|
||||
<p class="text-red-400">{error}</p>
|
||||
{/if}
|
||||
|
||||
{#if success}
|
||||
<p class="text-immich-primary">{success}</p>
|
||||
{/if}
|
||||
<div class="flex w-full">
|
||||
<button
|
||||
type="submit"
|
||||
class="m-4 p-2 bg-immich-primary hover:bg-immich-primary/75 px-6 py-4 text-white rounded-md shadow-md w-full"
|
||||
>Create</button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
73
web/src/lib/components/forms/login-form.svelte
Normal file
73
web/src/lib/components/forms/login-form.svelte
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { session } from '$app/stores';
|
||||
import { sendLoginForm } from '$lib/auth-api';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
let error: string;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
async function login(event: SubmitEvent) {
|
||||
error = '';
|
||||
|
||||
const formElement = event.target as HTMLFormElement;
|
||||
|
||||
const response = await sendLoginForm(formElement);
|
||||
|
||||
if (response.error) {
|
||||
error = response.error;
|
||||
}
|
||||
|
||||
if (response.needUpdate) {
|
||||
return dispatch('need-update');
|
||||
}
|
||||
|
||||
if (response.needSelectAdmin) {
|
||||
return dispatch('need-select-admin');
|
||||
}
|
||||
|
||||
if (response.success) {
|
||||
$session.user = {
|
||||
accessToken: response.user!.accessToken,
|
||||
firstName: response.user!.firstName,
|
||||
lastName: response.user!.lastName,
|
||||
isAdmin: response.user!.isAdmin,
|
||||
id: response.user!.id,
|
||||
email: response.user!.email,
|
||||
};
|
||||
|
||||
return dispatch('success');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="border bg-white p-4 shadow-sm w-[500px] rounded-md py-8">
|
||||
<div class="flex flex-col place-items-center place-content-center gap-4 px-4">
|
||||
<img class="text-center" src="/immich-logo.svg" height="100" width="100" alt="immich-logo" />
|
||||
<h1 class="text-2xl text-immich-primary font-medium">Login</h1>
|
||||
</div>
|
||||
|
||||
<form on:submit|preventDefault={login} method="post" action="" autocomplete="off">
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="email">Email</label>
|
||||
<input class="immich-form-input" id="email" name="email" type="email" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="password">Password</label>
|
||||
<input class="immich-form-input" id="password" name="password" type="password" required />
|
||||
</div>
|
||||
|
||||
{#if error}
|
||||
<p class="text-red-400 pl-4">{error}</p>
|
||||
{/if}
|
||||
|
||||
<div class="flex w-full">
|
||||
<button
|
||||
type="submit"
|
||||
class="m-4 p-2 bg-immich-primary hover:bg-immich-primary/75 px-6 py-4 text-white rounded-md shadow-md w-full font-semibold"
|
||||
>Login</button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
93
web/src/lib/components/forms/select-admin-form.svelte
Normal file
93
web/src/lib/components/forms/select-admin-form.svelte
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<script lang="ts">
|
||||
import { session } from '$app/stores';
|
||||
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
import type { ImmichUser } from '../../models/immich-user';
|
||||
import Check from 'svelte-material-icons/Check.svelte';
|
||||
|
||||
let error: string = '';
|
||||
let allUsers: Array<ImmichUser> = [];
|
||||
let selectedUserId: string;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
onMount(async () => {
|
||||
const res = await fetch('/auth/login/api/get-users', { method: 'GET' });
|
||||
const data = await res.json();
|
||||
allUsers = data.allUsers;
|
||||
});
|
||||
|
||||
const assignAdmin = async () => {
|
||||
const res = await fetch('/auth/login/api/select-admin', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
id: selectedUserId,
|
||||
isAdmin: true,
|
||||
}),
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
const data = await res.json();
|
||||
|
||||
$session.user = {
|
||||
accessToken: '',
|
||||
firstName: data.userInfo.firstName,
|
||||
lastName: data.userInfo.lastName,
|
||||
isAdmin: data.userInfo.isAdmin,
|
||||
id: data.userInfo.id,
|
||||
email: data.userInfo.email,
|
||||
};
|
||||
|
||||
dispatch('success');
|
||||
} else {
|
||||
error = JSON.stringify(await res.json());
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="border bg-white p-4 shadow-sm w-[500px] rounded-md py-8">
|
||||
<div class="flex flex-col place-items-center place-content-center gap-4 px-4">
|
||||
<img class="text-center" src="/immich-logo.svg" height="100" width="100" alt="immich-logo" />
|
||||
<h1 class="text-2xl text-immich-primary font-medium">Select Admin</h1>
|
||||
<p class="text-sm border rounded-md p-4 font-mono text-gray-600">
|
||||
There are multiple users on the server, and none have been selected to be the admin. Please assign one as the
|
||||
admin, who will be responsible for administrative tasks
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="text-xs m-4">USERS ON SERVER, CLICK TO SELECT ONE</div>
|
||||
<div class="overflow-y-auto rounded-md max-h-[300px] block border mx-4 px-4 py-2">
|
||||
{#each allUsers as user, i}
|
||||
<div
|
||||
class="p-4 flex justify-between place-items-center my-4 rounded-md hover:cursor-pointer shadow-sm bg-gray-50 hover:bg-gray-100"
|
||||
on:click={() => (selectedUserId = user.id)}
|
||||
>
|
||||
<p class="test-sm text-slate-600">{i + 1} | {user.email}</p>
|
||||
|
||||
<!-- Icon -->
|
||||
{#if selectedUserId == user.id}
|
||||
<div
|
||||
in:fade={{ duration: 100 }}
|
||||
class="border rounded-full border-gray-300 bg-immich-primary w-8 h-8 flex place-items-center place-content-center"
|
||||
>
|
||||
<Check color="white" size="24" />
|
||||
</div>
|
||||
{:else}
|
||||
<div in:fade={{ duration: 100 }} class="border rounded-full border-gray-300 w-8 h-8" />
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
{#if error}
|
||||
<div class="text-xs m-4 text-red-400">Error: {error}</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex w-full">
|
||||
<button
|
||||
type="submit"
|
||||
class="m-4 p-2 bg-immich-primary hover:bg-immich-primary/75 px-6 py-4 text-white rounded-md shadow-md w-full font-semibold"
|
||||
on:click={assignAdmin}>Assign as Admin</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
68
web/src/lib/components/forms/update-form.svelte
Normal file
68
web/src/lib/components/forms/update-form.svelte
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { session } from '$app/stores';
|
||||
import { sendUpdateForm } from '$lib/auth-api';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
let error: string;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
async function updateInfo(event: SubmitEvent) {
|
||||
error = '';
|
||||
|
||||
const formElement = event.target as HTMLFormElement;
|
||||
|
||||
const response = await sendUpdateForm(formElement);
|
||||
|
||||
if (response.error) {
|
||||
error = response.error;
|
||||
}
|
||||
|
||||
if (response.success) {
|
||||
$session.user = {
|
||||
accessToken: response.user!.accessToken,
|
||||
firstName: response.user!.firstName,
|
||||
lastName: response.user!.lastName,
|
||||
isAdmin: response.user!.isAdmin,
|
||||
id: response.user!.id,
|
||||
email: response.user!.email,
|
||||
};
|
||||
|
||||
dispatch('success');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="border bg-white p-4 shadow-sm w-[500px] rounded-md py-8">
|
||||
<div class="flex flex-col place-items-center place-content-center gap-4 px-4">
|
||||
<img class="text-center" src="/immich-logo.svg" height="100" width="100" alt="immich-logo" />
|
||||
<h1 class="text-2xl text-immich-primary font-medium">Update User Info</h1>
|
||||
<p class="text-sm border rounded-md p-4 font-mono text-gray-600">
|
||||
Your account doesn't have information about your name, please update to continue the login process.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form on:submit|preventDefault={updateInfo} method="post" action="/auth/login/update" autocomplete="off">
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="firstName">First name</label>
|
||||
<input class="immich-form-input" id="firstName" name="firstName" type="text" required />
|
||||
</div>
|
||||
|
||||
<div class="m-4 flex flex-col gap-2">
|
||||
<label class="immich-form-label" for="lastName">Last name</label>
|
||||
<input class="immich-form-input" id="lastName" name="lastName" type="text" required />
|
||||
</div>
|
||||
|
||||
{#if error}
|
||||
<p class="text-red-400 pl-4">{error}</p>
|
||||
{/if}
|
||||
|
||||
<div class="flex w-full">
|
||||
<button
|
||||
type="submit"
|
||||
class="m-4 p-2 bg-immich-primary hover:bg-immich-primary/75 px-6 py-4 text-white rounded-md shadow-md w-full font-semibold"
|
||||
>Update</button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
15
web/src/lib/components/shared/click-outside.ts
Normal file
15
web/src/lib/components/shared/click-outside.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
export function clickOutside(node: Node) {
|
||||
const handleClick = (event: any) => {
|
||||
if (!node.contains(event.target)) {
|
||||
node.dispatchEvent(new CustomEvent("outclick"));
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("click", handleClick, true);
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
document.removeEventListener("click", handleClick, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
17
web/src/lib/components/shared/full-screen-modal.svelte
Normal file
17
web/src/lib/components/shared/full-screen-modal.svelte
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<script lang="ts">
|
||||
import { clickOutside } from './click-outside';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
||||
<section
|
||||
in:fade={{ duration: 100 }}
|
||||
out:fade={{ duration: 100 }}
|
||||
class="absolute w-full h-full bg-black/40 z-[100] flex place-items-center place-content-center "
|
||||
>
|
||||
<div class="bg-immich-bg z-[9999] rounded-md" use:clickOutside on:outclick={() => dispatch('clickOutside')}>
|
||||
<slot />
|
||||
</div>
|
||||
</section>
|
||||
60
web/src/lib/components/shared/navigation-bar.svelte
Normal file
60
web/src/lib/components/shared/navigation-bar.svelte
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import type { ImmichUser } from '$lib/models/immich-user';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
export let user: ImmichUser;
|
||||
|
||||
let shouldShowAccountInfo = false;
|
||||
|
||||
const getFirstLetter = (text?: string) => {
|
||||
return text?.charAt(0).toUpperCase();
|
||||
};
|
||||
</script>
|
||||
|
||||
<section id="dashboard-navbar" class="fixed w-screen z-[100] bg-immich-bg text-sm">
|
||||
<div class="flex border place-items-center px-6 py-2 ">
|
||||
<a class="flex gap-2 place-items-center hover:cursor-pointer" href="/photos">
|
||||
<img src="/immich-logo.svg" alt="immich logo" height="35" width="35" />
|
||||
<h1 class="font-immich-title text-2xl text-immich-primary">Immich</h1>
|
||||
</a>
|
||||
<div class="flex-1 ml-24">
|
||||
<div class="w-[50%] border rounded-md bg-gray-200 px-8 py-4">Search</div>
|
||||
</div>
|
||||
<section class="flex gap-6 place-items-center">
|
||||
<!-- <div>Upload</div> -->
|
||||
|
||||
{#if user.isAdmin}
|
||||
<a
|
||||
class={`hover:text-immich-primary font-medium ${
|
||||
$page.url.pathname == '/admin' && 'text-immich-primary underline'
|
||||
}`}
|
||||
href="/admin">Administration</a
|
||||
>
|
||||
{/if}
|
||||
|
||||
<div
|
||||
on:mouseover={() => (shouldShowAccountInfo = true)}
|
||||
on:focus={() => (shouldShowAccountInfo = true)}
|
||||
on:mouseleave={() => (shouldShowAccountInfo = false)}
|
||||
>
|
||||
<button
|
||||
class="flex place-items-center place-content-center rounded-full bg-immich-primary/80 h-10 w-10 text-gray-100 hover:bg-immich-primary"
|
||||
>
|
||||
{getFirstLetter(user.firstName)}{getFirstLetter(user.lastName)}
|
||||
</button>
|
||||
|
||||
{#if shouldShowAccountInfo}
|
||||
<div
|
||||
in:fade={{ delay: 500, duration: 150 }}
|
||||
out:fade={{ delay: 200, duration: 150 }}
|
||||
class="absolute -bottom-12 right-5 border bg-gray-500 text-[12px] text-gray-100 p-2 rounded-md shadow-md"
|
||||
>
|
||||
<p>{user.firstName} {user.lastName}</p>
|
||||
<p>{user.email}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
27
web/src/lib/components/shared/side-bar-button.svelte
Normal file
27
web/src/lib/components/shared/side-bar-button.svelte
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<script lang="ts">
|
||||
export let title: string;
|
||||
export let logo: any;
|
||||
export let actionType: AdminSideBarSelection | AppSideBarSelection;
|
||||
export let isSelected: boolean;
|
||||
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import type { AdminSideBarSelection, AppSideBarSelection } from '../../models/admin-sidebar-selection';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const onButtonClicked = () => {
|
||||
dispatch('selected', {
|
||||
actionType,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<div
|
||||
on:click={onButtonClicked}
|
||||
class={`flex gap-4 place-items-center pl-5 py-3 rounded-tr-xl rounded-br-xl hover:bg-gray-200 hover:text-immich-primary hover:cursor-pointer
|
||||
${isSelected && 'bg-immich-primary/10 text-immich-primary hover:bg-immich-primary/50'}
|
||||
`}
|
||||
>
|
||||
<svelte:component this={logo} size="24" />
|
||||
<p class="font-medium text-sm">{title}</p>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue