You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-06-23 04:38:12 +02:00
Added limit on total of file upload on web
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
|
||||
import {
|
||||
ImmichNotification,
|
||||
notificationList,
|
||||
notificationController,
|
||||
NotificationType
|
||||
} from '$lib/components/shared-components/notification/notification';
|
||||
import { onMount } from 'svelte';
|
||||
@ -50,8 +50,8 @@
|
||||
|
||||
onMount(() => {
|
||||
setTimeout(() => {
|
||||
notificationList.removeNotificationById(notificationInfo.id);
|
||||
}, 2500);
|
||||
notificationController.removeNotificationById(notificationInfo.id);
|
||||
}, 3000);
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -66,5 +66,5 @@
|
||||
<h2 style:color={primaryColor()} class="font-medium">{notificationInfo.type.toString()}</h2>
|
||||
</div>
|
||||
|
||||
<p class="text-sm pl-[28px] pr-[16px]">{notificationInfo.message} {notificationInfo.id}</p>
|
||||
<p class="text-sm pl-[28px] pr-[16px]">{notificationInfo.message}</p>
|
||||
</div>
|
||||
|
@ -1,19 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { notificationList } from './notification';
|
||||
import { ImmichNotification, notificationController } from './notification';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import NotificationCard from './notification-card.svelte';
|
||||
import { flip } from 'svelte/animate';
|
||||
import { quintOut } from 'svelte/easing';
|
||||
|
||||
let notificationList: ImmichNotification[] = [];
|
||||
|
||||
notificationController.notificationList.subscribe((list) => {
|
||||
notificationList = list;
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if $notificationList?.length > 0}
|
||||
{#if notificationList.length > 0}
|
||||
<section
|
||||
transition:fade={{ duration: 250 }}
|
||||
id="notification-list"
|
||||
class="absolute right-5 top-[80px] z-[99999999]"
|
||||
>
|
||||
{#each $notificationList as notificationInfo (notificationInfo.id)}
|
||||
{#each notificationList as notificationInfo (notificationInfo.id)}
|
||||
<div animate:flip={{ duration: 250, easing: quintOut }}>
|
||||
<NotificationCard {notificationInfo} />
|
||||
</div>
|
||||
|
@ -12,25 +12,25 @@ export class ImmichNotification {
|
||||
}
|
||||
|
||||
function createNotificationList() {
|
||||
const { set, update, subscribe } = writable<ImmichNotification[]>([]);
|
||||
const notificationList = writable<ImmichNotification[]>([]);
|
||||
|
||||
const show = ({ message = '', type = NotificationType.Info }) => {
|
||||
const notification = new ImmichNotification();
|
||||
notification.message = message;
|
||||
notification.type = type;
|
||||
|
||||
update((currentList) => [...currentList, notification]);
|
||||
notificationList.update((currentList) => [...currentList, notification]);
|
||||
};
|
||||
|
||||
const removeNotificationById = (id: number) => {
|
||||
update((currentList) => currentList.filter((n) => n.id != id));
|
||||
notificationList.update((currentList) => currentList.filter((n) => n.id != id));
|
||||
};
|
||||
|
||||
return {
|
||||
show,
|
||||
removeNotificationById,
|
||||
subscribe
|
||||
notificationList
|
||||
};
|
||||
}
|
||||
|
||||
export const notificationList = createNotificationList();
|
||||
export const notificationController = createNotificationList();
|
||||
|
Reference in New Issue
Block a user