Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

New notification design

Smaug67395fc7da53dd55
diff --git a/frontend/app/components/Notification.vue b/frontend/app/components/Notification.vue
index cf6e7ee2..325bca8e 100644
--- a/frontend/app/components/Notification.vue
+++ b/frontend/app/components/Notification.vue
@@ -1,21 +1,46 @@
<template>
<TransitionGroup name="notification-slide" tag="div" class="notification-container">
<div v-for="notification in notifications" :key="notification.id" class="notification" :class="notification.type">
+ <div class="icon-wrapper">
+ <svg v-if="notification.type === 'success'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <path d="M20 6L9 17l-5-5" stroke-linecap="round" stroke-linejoin="round" />
+ </svg>
+ <svg v-else-if="notification.type === 'error'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <circle cx="12" cy="12" r="10" />
+ <line x1="15" y1="9" x2="9" y2="15" />
+ <line x1="9" y1="9" x2="15" y2="15" />
+ </svg>
+ <svg v-else-if="notification.type === 'warning'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" />
+ <line x1="12" y1="9" x2="12" y2="13" />
+ <line x1="12" y1="17" x2="12.01" y2="17" />
+ </svg>
+ <svg v-else viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <circle cx="12" cy="12" r="10" />
+ <line x1="12" y1="16" x2="12" y2="12" />
+ <line x1="12" y1="8" x2="12.01" y2="8" />
+ </svg>
+ </div>
<div class="content">
- <div class="header">
- <p class="title">{{ notification.title }}</p>
- <span class="btn" aria-label="Close" @click="close(notification.id)">&times;</span>
- </div>
+ <p class="title">{{ notification.title }}</p>
<p v-if="notification.message" class="message">{{ notification.message }}</p>
</div>
+ <button class="close-btn" aria-label="Close" @click="close(notification.id)">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
+ <line x1="18" y1="6" x2="6" y2="18" />
+ <line x1="6" y1="6" x2="18" y2="18" />
+ </svg>
+ </button>
+ <div class="progress-bar" :style="{ animationDuration: (notification.timeout || 3000) + 'ms' }" />
</div>
</TransitionGroup>
</template>
<script setup lang="ts">
-const notifications = computed(() => [...useNotifications().notifications.value].reverse()); // Create a copy before reversing
+const notifications = computed(() => [...useNotifications().notifications.value].reverse());
const close = (id: number) => useNotifications().remove(id);
</script>
+
<style scoped lang="scss">
.notification-container {
position: fixed;
@@ -24,108 +49,173 @@ const close = (id: number) => useNotifications().remove(id);
z-index: 1000;
display: flex;
flex-direction: column;
- gap: 15px;
+ gap: 12px;
}
.notification {
position: relative;
display: flex;
- width: 360px;
- padding: 16px 18px;
- border-radius: 8px;
- color: white;
- box-shadow: 0 2px 10px var(--shadow);
+ width: 380px;
+ padding: 14px 16px;
+ border-radius: 12px;
+ border: 1px solid var(--border-color);
+ background: var(--bg-color);
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
align-items: flex-start;
- animation: fade-in 0.3s ease;
- backdrop-filter: blur(12px);
gap: 12px;
+ overflow: hidden;
}
-.header {
+.icon-wrapper {
display: flex;
- width: 100%;
+ width: 36px;
+ height: 36px;
+ min-width: 36px;
+ border-radius: 10px;
align-items: center;
- justify-content: space-between;
+ justify-content: center;
+
+ svg {
+ width: 20px;
+ height: 20px;
+ }
}
-p {
- margin: 0;
- font-size: 14px;
- line-height: 1.4;
+.content {
+ flex: 1;
+ min-width: 0;
+ padding-top: 2px;
+ text-align: left;
}
.title {
- font-weight: 500;
+ margin: 0;
+ font-size: 14px;
+ font-weight: 600;
+ line-height: 1.4;
+ color: var(--font-color-dark);
}
.message {
- opacity: 0.8;
- margin-top: 4px;
+ margin: 4px 0 0;
+ font-size: 13px;
+ line-height: 1.4;
+ color: var(--font-color-light);
}
-.btn {
- position: absolute;
- top: 5px;
- right: 15px;
+.close-btn {
+ display: flex;
+ width: 28px;
+ height: 28px;
+ padding: 0;
border: none;
- font-size: 25px;
- color: white;
- opacity: 0.6;
+ border-radius: 8px;
+ background: transparent;
+ color: var(--font-color-light);
cursor: pointer;
+ align-items: center;
+ justify-content: center;
+ transition: all 0.15s ease;
+ flex-shrink: 0;
+
+ svg {
+ width: 16px;
+ height: 16px;
+ }
+
+ &:hover {
+ background: var(--bg-contrast);
+ color: var(--font-color);
+ }
+}
+
+.progress-bar {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ height: 3px;
+ width: 100%;
+ background: currentColor;
+ opacity: 0.3;
+ transform-origin: left;
+ animation: shrink linear forwards;
+}
+
+@keyframes shrink {
+ from {
+ transform: scaleX(1);
+ }
+ to {
+ transform: scaleX(0);
+ }
}
/* Notification types */
.success {
- background: var(--green);
+ .icon-wrapper {
+ background: var(--green-bg);
+ color: var(--green);
+ }
+ .progress-bar {
+ background: var(--green);
+ }
}
.error {
- background: var(--red);
+ .icon-wrapper {
+ background: var(--red-bg);
+ color: var(--red);
+ }
+ .progress-bar {
+ background: var(--red);
+ }
}
.warning {
- background: var(--yellow);
+ .icon-wrapper {
+ background: var(--yellow-bg);
+ color: var(--yellow);
+ }
+ .progress-bar {
+ background: var(--yellow);
+ }
}
.info {
- background: var(--blue);
+ .icon-wrapper {
+ background: var(--blue-bg);
+ color: var(--blue);
+ }
+ .progress-bar {
+ background: var(--blue);
+ }
}
/* Transitions */
-.notification-slide-enter-active,
+.notification-slide-enter-active {
+ transition: all 0.3s cubic-bezier(0.21, 1.02, 0.73, 1);
+}
+
.notification-slide-leave-active {
- transition: opacity 0.3s ease, transform 0.3s ease;
+ transition: all 0.2s cubic-bezier(0.06, 0.71, 0.55, 1);
}
-.notification-enter-from {
+.notification-slide-enter-from {
opacity: 0;
transform: translateX(100%);
}
-.notification-enter-to {
- opacity: 1;
- transform: translateX(0);
-}
-
-.notification-leave-from {
- opacity: 1;
- transform: translateX(0);
-}
-
-.notification-leave-to {
+.notification-slide-leave-to {
opacity: 0;
transform: translateX(100%);
}
-@keyframes fade-in {
- from {
- opacity: 0;
- transform: translateY(20px);
- }
+.notification-slide-move {
+ transition: transform 0.3s cubic-bezier(0.21, 1.02, 0.73, 1);
+}
- to {
- opacity: 1;
- transform: translateY(0);
- }
+/* Dark mode adjustments */
+:global(.dark-mode) .notification {
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}
</style>