Buckets:
| import { createMemo, type Accessor } from "solid-js" | |
| import { useServerSync } from "@/context/server-sync" | |
| import { useNotification } from "@/context/notification" | |
| import { usePermission } from "@/context/permission" | |
| import { sessionPermissionRequest } from "@/pages/session/composer/session-request-tree" | |
| export function useSessionTabAvatarState( | |
| directory: Accessor<string>, | |
| sessionId: Accessor<string>, | |
| active: Accessor<boolean> = () => true, | |
| ) { | |
| const globalSync = useServerSync() | |
| const notification = useNotification() | |
| const permission = usePermission() | |
| const hasPermissions = createMemo(() => { | |
| if (!active()) return false | |
| const [store] = globalSync.child(directory(), { bootstrap: false }) | |
| return !!sessionPermissionRequest(store.session, store.permission, sessionId(), (item) => { | |
| return !permission.autoResponds(item, directory()) | |
| }) | |
| }) | |
| const unread = createMemo(() => active() && (hasPermissions() || notification.session.unseenCount(sessionId()) > 0)) | |
| const loading = createMemo(() => { | |
| if (!active()) return false | |
| if (hasPermissions()) return false | |
| const [store] = globalSync.child(directory(), { bootstrap: false }) | |
| return store.session_working(sessionId()) | |
| }) | |
| return { unread, loading } | |
| } | |
Xet Storage Details
- Size:
- 1.27 kB
- Xet hash:
- a1943379d7393225270f8de78eab9711f8b152a27167ed8dcbe11f88fe32dfeb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.