From 94cbdf25f0953d8b43c0b1f8e7ca09dddef8abcd Mon Sep 17 00:00:00 2001
From: sandwich <299465+dskvr@users.noreply.github.com>
Date: Tue, 13 Feb 2024 17:18:55 +0000
Subject: [PATCH] add missing files
---
src/components/tabs/Tab.svelte | 19 ++++++++++++++++++
src/components/tabs/Tabs.svelte | 35 +++++++++++++++++++++++++++++++++
src/utils.js | 23 ++++++++++++++++++++++
3 files changed, 77 insertions(+)
create mode 100644 src/components/tabs/Tab.svelte
create mode 100644 src/components/tabs/Tabs.svelte
create mode 100644 src/utils.js
diff --git a/src/components/tabs/Tab.svelte b/src/components/tabs/Tab.svelte
new file mode 100644
index 0000000..ec75a82
--- /dev/null
+++ b/src/components/tabs/Tab.svelte
@@ -0,0 +1,19 @@
+
+
+
+ {title}
+
+
+
diff --git a/src/components/tabs/Tabs.svelte b/src/components/tabs/Tabs.svelte
new file mode 100644
index 0000000..655d761
--- /dev/null
+++ b/src/components/tabs/Tabs.svelte
@@ -0,0 +1,35 @@
+
+
+
+ {#each tabs as tab}
+ selectTab(tab.title)} />
+ {/each}
+
+
+
+
+
+
+
diff --git a/src/utils.js b/src/utils.js
new file mode 100644
index 0000000..36fc193
--- /dev/null
+++ b/src/utils.js
@@ -0,0 +1,23 @@
+export function generateBackground(event) {
+ if(!event) return
+ const dTag = event.tags.find(tag => tag[0] === 'd');
+ return dTag ? generateColorFromTag(dTag[1]) : '#defaultColor';
+}
+
+export function generateColorFromTag(str) {
+ let hash = 0;
+ for (let i = 0; i < str.length; i++) {
+ const char = str.charCodeAt(i);
+ hash = ((hash << 5) - hash) + char;
+ hash &= hash; // Convert to 32bit integer
+ }
+
+ let color = '#';
+ for (let i = 0; i < 3; i++) {
+ let value = (hash >> (i * 8)) & 255;
+ // Normalize the value to get a pastel color
+ value = (value % 128) + 127; // Ensure the color is always light
+ color += ('00' + value.toString(16)).substr(-2);
+ }
+ return color;
+}
\ No newline at end of file