From 5254b859d233a082794919ddbaac794f209d8525 Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Tue, 24 Mar 2026 19:13:19 -0400 Subject: [PATCH] refactor: improvemets Signed-off-by: Sebastian Krupinski --- core/src/App.vue | 2 + core/src/components/shared/SharedSnackbar.vue | 29 +++++++++++ core/src/composables/useSnackbar.ts | 50 ++++++++++++++++-- core/src/shared/index.ts | 1 + .../Service/ServiceBaseInterface.php | 52 +++++++++++++++++-- .../Service/ServiceMutableInterface.php | 6 ++- 6 files changed, 130 insertions(+), 10 deletions(-) create mode 100644 core/src/components/shared/SharedSnackbar.vue diff --git a/core/src/App.vue b/core/src/App.vue index c26ae6a..90f7a91 100644 --- a/core/src/App.vue +++ b/core/src/App.vue @@ -1,11 +1,13 @@ + + \ No newline at end of file diff --git a/core/src/composables/useSnackbar.ts b/core/src/composables/useSnackbar.ts index 5b4a3c9..b6113d0 100644 --- a/core/src/composables/useSnackbar.ts +++ b/core/src/composables/useSnackbar.ts @@ -2,7 +2,7 @@ * Simple snackbar/toast notification composable * Uses Vuetify's snackbar component */ -import { ref } from 'vue' +import { nextTick, ref } from 'vue' export interface SnackbarOptions { message: string @@ -10,21 +10,60 @@ export interface SnackbarOptions { timeout?: number } +interface SnackbarState { + message: string + color: string + timeout: number +} + const snackbarVisible = ref(false) const snackbarMessage = ref('') const snackbarColor = ref('info') const snackbarTimeout = ref(3000) +const snackbarQueue = ref([]) + +function showNextSnackbar() { + if (snackbarVisible.value || snackbarQueue.value.length === 0) { + return + } + + const nextSnackbar = snackbarQueue.value.shift() + + if (!nextSnackbar) { + return + } + + snackbarMessage.value = nextSnackbar.message + snackbarColor.value = nextSnackbar.color + snackbarTimeout.value = nextSnackbar.timeout + snackbarVisible.value = true +} export function useSnackbar() { const showSnackbar = (options: SnackbarOptions) => { - snackbarMessage.value = options.message - snackbarColor.value = options.color || 'info' - snackbarTimeout.value = options.timeout || 3000 - snackbarVisible.value = true + + const notification = { + message: options.message, + color: options.color || 'info', + timeout: options.timeout || 3000, + } + + if (!snackbarVisible.value && snackbarQueue.value.length === 0) { + snackbarMessage.value = notification.message + snackbarColor.value = notification.color + snackbarTimeout.value = notification.timeout + snackbarVisible.value = true + return + } + + snackbarQueue.value = [...snackbarQueue.value, notification] } const hideSnackbar = () => { snackbarVisible.value = false + void nextTick(() => { + showNextSnackbar() + }) } return { @@ -32,6 +71,7 @@ export function useSnackbar() { snackbarMessage, snackbarColor, snackbarTimeout, + snackbarQueue, showSnackbar, hideSnackbar, } diff --git a/core/src/shared/index.ts b/core/src/shared/index.ts index 34d4fb9..6df6a8d 100644 --- a/core/src/shared/index.ts +++ b/core/src/shared/index.ts @@ -16,6 +16,7 @@ export { useLayoutStore } from '../stores/layoutStore' // Composables export { useUser } from '../composables/useUser' export { useClipboard } from '../composables/useClipboard' +export { useSnackbar } from '../composables/useSnackbar' // Services export { userService } from '../services/user/userService' diff --git a/shared/lib/Resource/Documents/Service/ServiceBaseInterface.php b/shared/lib/Resource/Documents/Service/ServiceBaseInterface.php index eb1a293..063d641 100644 --- a/shared/lib/Resource/Documents/Service/ServiceBaseInterface.php +++ b/shared/lib/Resource/Documents/Service/ServiceBaseInterface.php @@ -132,7 +132,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface { public function entityList(string|int|null $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array; /** - * Creates a filter builder for messages + * Creates a filter builder for entities * * @since 2025.05.01 * @@ -141,7 +141,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface { public function entityListFilter(): IFilter; /** - * Creates a sort builder for messages + * Creates a sort builder for entities * * @since 2025.05.01 * @@ -150,7 +150,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface { public function entityListSort(): ISort; /** - * Creates a range builder for messages + * Creates a range builder for entities * * @since 2025.05.01 * @@ -209,4 +209,50 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface { */ public function entityRead(string|int|null $collection, string|int $identifier): ?string; + /** + * Lists messages in a collection + * + * @since 2025.05.01 + * + * @param string|int|null $collection Collection ID + * @param IFilter|null $filter Optional filter criteria + * @param ISort|null $sort Optional sort order + * @param IRange|null $range Optional pagination + * @param array|null $properties Optional message properties to fetch + * + * @return array Nodes indexed by ID + */ + public function nodeList(string|int|null $collection, bool $recursive = false, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array; + + /** + * Creates a filter builder for nodes + * + * @since 2025.05.01 + * + * @return IFilter + */ + public function nodeListFilter(): IFilter; + + /** + * Creates a sort builder for nodes + * + * @since 2025.05.01 + * + * @return ISort + */ + public function nodeListSort(): ISort; + + /** + * Gets incremental changes since last sync + * + * @since 2025.05.01 + * + * @param string|int|null $collection Collection ID + * @param string $signature Sync token from previous sync + * @param string $detail Detail level: 'ids', 'minimal', 'full' + * + * @return array ['signature' => string, 'added' => array, 'modified' => array, 'removed' => array] + */ + public function nodeDelta(string|int|null $collection, string $signature, string $detail = 'ids'): Delta; + } diff --git a/shared/lib/Resource/Documents/Service/ServiceMutableInterface.php b/shared/lib/Resource/Documents/Service/ServiceMutableInterface.php index e2cc5ee..1b67e2c 100644 --- a/shared/lib/Resource/Documents/Service/ServiceMutableInterface.php +++ b/shared/lib/Resource/Documents/Service/ServiceMutableInterface.php @@ -9,14 +9,16 @@ declare(strict_types=1); namespace KTXF\Resource\Documents\Service; +use KTXF\Resource\Provider\ResourceServiceMutateInterface; + /** - * Chrono Service Mutable Interface + * Documents Service Mutable Interface * * Extends base service interface with setter methods for mutable properties. * Used for service configuration and updates. * * @since 2025.05.01 */ -interface ServiceMutableInterface extends ServiceBaseInterface { +interface ServiceMutableInterface extends ServiceBaseInterface, ResourceServiceMutateInterface { } -- 2.39.5