diff options
| author | Fuwn <[email protected]> | 2026-03-01 16:20:51 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-03-01 16:21:02 -0800 |
| commit | eae5d24d9e79e59a19d4721caaeaa0ca650ecb33 (patch) | |
| tree | 1b685bb248e051dfa26d2bfdebe6689402dd93c5 /src/lib/Announcement.svelte | |
| parent | chore(tooling): remove legacy eslint and prettier (diff) | |
| download | due.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.tar.xz due.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.zip | |
chore(biome): drop formatter style overrides
Diffstat (limited to 'src/lib/Announcement.svelte')
| -rw-r--r-- | src/lib/Announcement.svelte | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/lib/Announcement.svelte b/src/lib/Announcement.svelte index 1e6f428f..8bbdfe67 100644 --- a/src/lib/Announcement.svelte +++ b/src/lib/Announcement.svelte @@ -1,37 +1,41 @@ <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'; +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); + s + .split("") + .reduce( + (previous, current) => + ((previous << 5) - previous + current.charCodeAt(0)) | 0, + 0, + ); const dismiss = () => { - if (announcement) announcementHash.set(hash(announcement)); + if (announcement) announcementHash.set(hash(announcement)); }; const maxWidth = (input: string, max = 100) => { - let output = ''; - let line = ''; + let output = ""; + let line = ""; - for (const word of input.split(' ')) { - if (line.length + word.length > max) { - output += line + '\n'; - line = ''; - } + for (const word of input.split(" ")) { + if (line.length + word.length > max) { + output += line + "\n"; + line = ""; + } - line += word + ' '; - } + line += word + " "; + } - return output + line; + return output + line; }; </script> |