feat: initialise a new totals tab with basic UI (#94)

* feat: initialise a new totals tab with basic UI

* fix: update group tabs and add stats page

* fix: styling within the new elements

* Prettier

* Display active user expenses only if active user is set

---------

Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
This commit is contained in:
Anurag
2024-02-28 21:13:25 +05:30
committed by GitHub
parent 2af0660383
commit 2f991e680b
8 changed files with 245 additions and 0 deletions

View File

@@ -48,3 +48,17 @@ export function useBaseUrl() {
}, [])
return baseUrl
}
/**
* @returns The active user, or `null` until it is fetched from local storage
*/
export function useActiveUser(groupId: string) {
const [activeUser, setActiveUser] = useState<string | null>(null)
useEffect(() => {
const activeUser = localStorage.getItem(`${groupId}-activeUser`)
if (activeUser) setActiveUser(activeUser)
}, [groupId])
return activeUser
}