scope.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { MainDocument } from '../../../../types/project-settings'
  2. import { PdfViewer } from '../../../../types/user-settings'
  3. type Scope = {
  4. settings?: {
  5. syntaxValidation?: boolean
  6. pdfViewer?: PdfViewer
  7. }
  8. editor?: {
  9. sharejs_doc?: {
  10. doc_id?: string
  11. getSnapshot?: () => string
  12. }
  13. }
  14. hasLintingError?: boolean
  15. ui?: {
  16. view?: 'editor' | 'history' | 'file' | 'pdf'
  17. pdfLayout?: 'flat' | 'sideBySide' | 'split'
  18. leftMenuShown?: boolean
  19. }
  20. project?: {
  21. members?: any[]
  22. owner: {
  23. _id: string
  24. }
  25. features?: {
  26. gitBridge?: boolean
  27. }
  28. }
  29. user?: {
  30. features?: {
  31. dropbox: boolean
  32. }
  33. }
  34. docs?: MainDocument[]
  35. }
  36. export const mockScope = (scope?: Scope) => ({
  37. settings: {
  38. syntaxValidation: false,
  39. pdfViewer: 'pdfjs',
  40. },
  41. editor: {
  42. sharejs_doc: {
  43. doc_id: 'test-doc',
  44. getSnapshot: () => 'some doc content',
  45. },
  46. },
  47. hasLintingError: false,
  48. ui: {
  49. view: 'editor',
  50. pdfLayout: 'sideBySide',
  51. leftMenuShown: false,
  52. },
  53. ...scope,
  54. })