diff --git a/packages/frontend-core/src/components/grid/stores/users.ts b/packages/frontend-core/src/components/grid/stores/users.ts index f8824f8329..dcac940088 100644 --- a/packages/frontend-core/src/components/grid/stores/users.ts +++ b/packages/frontend-core/src/components/grid/stores/users.ts @@ -1,7 +1,7 @@ import { writable, get, derived, Writable, Readable } from "svelte/store" import { helpers } from "@budibase/shared-core" import { Store as StoreContext } from "." -import { UIUser } from "@budibase/types" +import { UIEnrichedUser, UIUser } from "@budibase/types" interface UsersStore { users: Writable @@ -12,21 +12,22 @@ interface DerivedUsersStore { } interface ActionUserStore { - users: UsersStore["users"] & { - actions: { - updateUser: (user: UIUser) => void - removeUser: (sessionId: string) => void + users: UsersStore["users"] & + Readable & { + actions: { + updateUser: (user: UIUser) => void + removeUser: (sessionId: string) => void + } } - } } -export type Store = UsersStore & DerivedUsersStore +export type Store = DerivedUsersStore & ActionUserStore export const createStores = (): UsersStore => { const users = writable([]) const enrichedUsers = derived(users, $users => { - return $users.map(user => ({ + return $users.map(user => ({ ...user, color: helpers.getUserColor(user), label: helpers.getUserLabel(user), diff --git a/packages/types/src/ui/stores/grid/user.ts b/packages/types/src/ui/stores/grid/user.ts index b6eb529805..225c232d3d 100644 --- a/packages/types/src/ui/stores/grid/user.ts +++ b/packages/types/src/ui/stores/grid/user.ts @@ -4,3 +4,8 @@ export interface UIUser extends User { sessionId: string gridMetadata?: { focusedCellId?: string } } + +export interface UIEnrichedUser extends UIUser { + color: string + label: string +}