-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: a 502 error and some other stuff adley found * feat: clear robots button * style: clear robots button * chore: remove old tailwind config file * fix: failing to eject an unheld item is an illegal state * fix: icon displays and doesn't error * fix/feat: all the fixes and features from bunnybots and the days leading up to it * style: format files --------- Co-authored-by: azaleacolburn <[email protected]>
- Loading branch information
1 parent
4b4936a
commit d27c276
Showing
19 changed files
with
715 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { browser } from '$app/environment'; | ||
|
||
export class LocalStore<T> { | ||
value = $state<T[]>() as T[]; | ||
key = ''; | ||
|
||
constructor(key: string, value: T[]) { | ||
this.value = value; | ||
this.key = key; | ||
|
||
if (browser) { | ||
const item = localStorage.getItem(key); | ||
if (item) this.value = this.deserialize(item); | ||
} | ||
|
||
$effect(() => { | ||
if (this.value.length > 12) { | ||
this.value.splice(0, 1); | ||
} | ||
localStorage.setItem(this.key, this.serialize(this.value)); | ||
}); | ||
} | ||
|
||
serialize(value: T[]): string { | ||
return JSON.stringify(value); | ||
} | ||
|
||
deserialize(item: string): T[] { | ||
return JSON.parse(item); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.