Skip to content

Define a shared ViewMode type for document viewer #646

@hoyla

Description

@hoyla

Follow-up from #613 (comment by @zekehuntergreen).

getDefaultView currently returns string | undefined. The actual set of view
mode values is finite and known:

  • "text"
  • "preview"
  • "table"
  • `ocr.${string}`
  • `transcript.${string}`
  • `vttTranscript.${string}`

We should define a shared ViewMode type and use it across:

  • getDefaultView return type
  • setResourceView parameter (currently any)
  • SetResourceViewType Redux action (currently view: any)
  • PreviewSwitcher navigate callbacks and PreviewLink props

This would catch invalid view strings at compile time and make the view mode
contract explicit.

Labels: document viewer, enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions