diff --git a/src/lib/components/Toast.svelte b/src/lib/components/Toast.svelte
new file mode 100644
index 0000000..ed7ef95
--- /dev/null
+++ b/src/lib/components/Toast.svelte
@@ -0,0 +1,114 @@
+
+
+
+ {#each toastState.messages as msg (msg.id)}
+
+
+ {#if msg.type === 'success'}
+
+ {:else if msg.type === 'error'}
+
+ {:else}
+
+ {/if}
+
{msg.text}
+
+
+
+ {/each}
+
+
+
diff --git a/src/lib/stores/toast.svelte.ts b/src/lib/stores/toast.svelte.ts
new file mode 100644
index 0000000..4a6f08c
--- /dev/null
+++ b/src/lib/stores/toast.svelte.ts
@@ -0,0 +1,34 @@
+export type ToastType = 'success' | 'error' | 'info';
+
+export interface ToastMessage {
+ id: number;
+ text: string;
+ type: ToastType;
+}
+
+class ToastState {
+ messages = $state([]);
+ private nextId = 0;
+
+ add(text: string, type: ToastType = 'info', duration: number = 3000) {
+ const id = this.nextId++;
+ this.messages.push({ id, text, type });
+
+ if (duration > 0) {
+ setTimeout(() => {
+ this.remove(id);
+ }, duration);
+ }
+ }
+
+ remove(id: number) {
+ this.messages = this.messages.filter((msg) => msg.id !== id);
+ }
+}
+
+export const toastState = new ToastState();
+
+// Helper export for simpler usage
+export function addToast(text: string, type: ToastType = 'info', duration: number = 3000) {
+ toastState.add(text, type, duration);
+}
diff --git a/src/routes/admin/+layout.svelte b/src/routes/admin/+layout.svelte
index 5635c92..4add4ed 100644
--- a/src/routes/admin/+layout.svelte
+++ b/src/routes/admin/+layout.svelte
@@ -1,6 +1,8 @@
-{#if form?.success}
-
- 设置保存成功!
-
-{/if}
-
-{#if form?.error}
-
- {form.error}
-
-{/if}
{#if activeTab === 'basic'}
@@ -166,23 +164,6 @@
border-bottom-color: var(--accent-color, #419b38);
}
- .success-alert {
- padding: 12px 16px;
- background-color: transparent;
- border-left: 4px solid #419b38;
- color: #419b38;
- margin-bottom: 30px;
- font-weight: 600;
- }
-
- .error-alert {
- padding: 12px 16px;
- background-color: transparent;
- border-left: 4px solid #d9534f;
- color: #d9534f;
- margin-bottom: 30px;
- font-weight: 600;
- }
.settings-container {
display: grid;