Lee Morgan 2 недель назад
Родитель
Сommit
7f33191361
3 измененных файлов с 41 добавлено и 1 удалено
  1. 4 0
      src/lib/notifier.svelte.js
  2. 37 0
      src/routes/+layout.svelte
  3. 0 1
      src/routes/register/+page.svelte

+ 4 - 0
src/lib/notifier.svelte.js

@@ -3,6 +3,10 @@ let notifications = $state([]);
 export function notify(type, message){
 export function notify(type, message){
     notifications.push({type, message});
     notifications.push({type, message});
 
 
+    while(notifications.length > 3){
+        notifications.shift();
+    }
+
     setTimeout(()=>{
     setTimeout(()=>{
         notifications.shift();
         notifications.shift();
     }, 7500);
     }, 7500);

+ 37 - 0
src/routes/+layout.svelte

@@ -55,4 +55,41 @@
         height: 100%;
         height: 100%;
         width: auto;
         width: auto;
     }
     }
+
+    .notifications{
+        position: fixed;
+        top: 1rem;
+        right: 1rem;
+        z-index: 9999;
+        display: flex;
+        flex-direction: column;
+        gap: 0.5rem;
+        width: min(320px, calc(100vw - 2rem));
+        pointer-events: none;
+    }
+
+    .notifications p{
+        margin: 0;
+        padding: 0.75rem 1rem;
+        border-radius: 6px;
+        font-size: 0.9rem;
+        line-height: 1.3;
+        color: var(--color-text);
+        background: var(--color-surface-alt);
+        border: 1px solid var(--color-border);
+        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
+        pointer-events: auto;
+    }
+
+    .notifications p.success{
+        border-color: var(--color-success);
+    }
+
+    .notifications p.warning{
+        border-color: var(--color-warning);
+    }
+
+    .notifications p.error{
+        border-color: var(--color-error);
+    }
 </style>
 </style>

+ 0 - 1
src/routes/register/+page.svelte

@@ -5,7 +5,6 @@
 
 
     let {form} = $props();
     let {form} = $props();
     let nameInput;
     let nameInput;
-    $inspect(form);
 
 
     $effect(()=>{
     $effect(()=>{
         nameInput?.focus();
         nameInput?.focus();