aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Announcement.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Announcement.svelte')
-rw-r--r--src/lib/Announcement.svelte64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/Announcement.svelte b/src/lib/Announcement.svelte
index 4fbe9de0..1e6f428f 100644
--- a/src/lib/Announcement.svelte
+++ b/src/lib/Announcement.svelte
@@ -1,38 +1,38 @@
<script lang="ts">
- import Spacer from '$lib/Layout/Spacer.svelte';
- import Popup from './Layout/Popup.svelte';
- import announcementHash from '$stores/announcementHash';
- import { env } from '$env/dynamic/public';
- import identity from '$stores/identity';
-
- const announcement = env.PUBLIC_ANNOUNCEMENT;
- const dismissButton = env.PUBLIC_ANNOUNCEMENT_DISMISS;
- const loggedIn = $identity !== undefined && $identity.id !== -2;
-
- const hash = (s: string) =>
- s
- .split('')
- .reduce((previous, current) => ((previous << 5) - previous + current.charCodeAt(0)) | 0, 0);
-
- const dismiss = () => {
- if (announcement) announcementHash.set(hash(announcement));
- };
-
- const maxWidth = (input: string, max = 100) => {
- let output = '';
- let line = '';
-
- for (const word of input.split(' ')) {
- if (line.length + word.length > max) {
- output += line + '\n';
- line = '';
- }
-
- line += word + ' ';
+import Spacer from '$lib/Layout/Spacer.svelte';
+import Popup from './Layout/Popup.svelte';
+import announcementHash from '$stores/announcementHash';
+import { env } from '$env/dynamic/public';
+import identity from '$stores/identity';
+
+const announcement = env.PUBLIC_ANNOUNCEMENT;
+const dismissButton = env.PUBLIC_ANNOUNCEMENT_DISMISS;
+const loggedIn = $identity !== undefined && $identity.id !== -2;
+
+const hash = (s: string) =>
+ s
+ .split('')
+ .reduce((previous, current) => ((previous << 5) - previous + current.charCodeAt(0)) | 0, 0);
+
+const dismiss = () => {
+ if (announcement) announcementHash.set(hash(announcement));
+};
+
+const maxWidth = (input: string, max = 100) => {
+ let output = '';
+ let line = '';
+
+ for (const word of input.split(' ')) {
+ if (line.length + word.length > max) {
+ output += line + '\n';
+ line = '';
}
- return output + line;
- };
+ line += word + ' ';
+ }
+
+ return output + line;
+};
</script>
{#if loggedIn && announcement && $announcementHash !== hash(announcement) && $announcementHash !== 0}