diff --git a/src/lib/components/Messages.svelte b/src/lib/components/Messages.svelte index c6a595c..ed47aab 100644 --- a/src/lib/components/Messages.svelte +++ b/src/lib/components/Messages.svelte @@ -1,51 +1,48 @@ - -
- {#each messages as message} -
-

{message.text}

- {message.timestamp} -
- {/each} + +
+
+ + {#each $messages as message} +
+

{message.text}

+ {message.timestamp} +
+ {/each} +
- - diff --git a/src/lib/data/dummyMessages.js b/src/lib/data/dummyMessages.js deleted file mode 100644 index 8c785cc..0000000 --- a/src/lib/data/dummyMessages.js +++ /dev/null @@ -1,12 +0,0 @@ -export const dummyMessages = [ - { text: "Believe you can, and you're halfway there.", timestamp: '2023-07-21 12:34:56' }, - { text: "The only way to do great work is to love what you do.", timestamp: '2023-07-21 12:36:22' }, - { text: "Success is not final, failure is not fatal: It is the courage to continue that counts.", timestamp: '2023-07-21 12:40:10' }, - { text: "The best way to predict the future is to create it.", timestamp: '2023-07-21 12:45:34' }, - { text: "Your time is limited, don't waste it living someone else's life.", timestamp: '2023-07-21 13:01:05' }, - { text: "Every moment is a fresh beginning.", timestamp: '2023-07-21 13:10:22' }, - { text: "Don't watch the clock; do what it does. Keep going.", timestamp: '2023-07-21 13:25:45' }, - { text: "Believe in yourself and all that you are. Know that there is something inside you that is greater than any obstacle.", timestamp: '2023-07-21 13:40:15' }, - { text: "You are never too old to set another goal or to dream a new dream.", timestamp: '2023-07-21 14:05:07' }, - { text: "The future belongs to those who believe in the beauty of their dreams.", timestamp: '2023-07-21 14:20:59' }, - ]; \ No newline at end of file diff --git a/src/lib/services/messages.js b/src/lib/services/messages.js new file mode 100644 index 0000000..8735dd4 --- /dev/null +++ b/src/lib/services/messages.js @@ -0,0 +1,11 @@ +// src/lib/messaging.js +import { messagesStore } from '$lib/data//stores'; + +export function addMessage(message) { + const timestamp = new Date().toLocaleString(); + messagesStore.update((messages) => [{ text: message, timestamp }, ...messages]); +} + +export function clearMessages() { + messagesStore.set([]); +} diff --git a/src/routes/log/write/+page.svelte b/src/routes/log/write/+page.svelte new file mode 100644 index 0000000..78e9c50 --- /dev/null +++ b/src/routes/log/write/+page.svelte @@ -0,0 +1,34 @@ + + + +
+ + +
+ +