WIP jordan

This commit is contained in:
Jordan Weingarten
2026-04-16 11:11:44 -05:00
parent ff2d7b18b5
commit 67482f6629
163 changed files with 50627 additions and 728 deletions

View File

@@ -0,0 +1,35 @@
/**
* Client favorites — star customers for quick dashboard access.
* Persisted in localStorage. Stores customer IDs.
*/
import { useLocalStorageRef } from '~/utils/useLocalStorageRef'
const KEY = 'policy-ui-client-favorites-v1'
export function useClientFavorites() {
const favoriteIds = useLocalStorageRef<string[]>(KEY, () => [])
function isFavorite(customerId: string) {
return favoriteIds.value.includes(customerId)
}
function toggleFavorite(customerId: string) {
if (isFavorite(customerId)) {
favoriteIds.value = favoriteIds.value.filter(id => id !== customerId)
} else {
favoriteIds.value = [customerId, ...favoriteIds.value]
}
}
function addFavorite(customerId: string) {
if (!isFavorite(customerId)) {
favoriteIds.value = [customerId, ...favoriteIds.value]
}
}
function removeFavorite(customerId: string) {
favoriteIds.value = favoriteIds.value.filter(id => id !== customerId)
}
return { favoriteIds, isFavorite, toggleFavorite, addFavorite, removeFavorite }
}