Skip to content

Commit

Permalink
[base] Use @sanity/types for paths
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent a4d11dd commit 5d7ef2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/@sanity/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@sanity/state-router": "1.150.1",
"@sanity/structure": "1.150.1",
"@sanity/transaction-collator": "1.150.1",
"@sanity/types": "1.150.7",
"@sanity/util": "1.150.1",
"@sanity/uuid": "1.150.1",
"@sanity/validation": "1.150.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/@sanity/base/src/datastores/presence/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Path} from '@sanity/types'
import {User} from '../user'

export type Status = 'online' | 'editing' | 'inactive'
export type PathElement = string | number | {_key: string}

// Low level data/transport format
export interface Session {
Expand All @@ -16,7 +16,7 @@ export interface PresenceLocation {
type: 'document'
documentId: string
lastActiveAt: LastActiveAt
path: PathElement[]
path: Path
}

export interface UserSessionPair {
Expand All @@ -29,7 +29,7 @@ type LastActiveAt = string // iso date
// Presence data prepared for a single document
export interface DocumentPresence {
user: User
path: PathElement[]
path: Path
lastActiveAt: LastActiveAt
}

Expand Down
7 changes: 4 additions & 3 deletions packages/@sanity/base/src/presence/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Path} from '@sanity/types'
import {ReportedRegion} from '../components/react-track-elements'
import {PathElement, Session, Status, User} from '../datastores/presence/types'
import {Session, Status, User} from '../datastores/presence/types'

export type Position = 'top' | 'bottom' | 'inside' | null
export type Size = 'xsmall' | 'small' | 'medium'
Expand Down Expand Up @@ -27,12 +28,12 @@ export type PresentUser = {

export interface Location {
documentId: string
path: PathElement[]
path: Path
}

export interface FormFieldPresence {
user: User
path: PathElement[]
path: Path
sessionId: string
lastActiveAt: string
}

0 comments on commit 5d7ef2e

Please sign in to comment.