### What? Extends visibility into what view is being shown so custom components have context as to where they are being rendered. **This PR does not add React Context.** ### Why? This was needed for the multi-tenant plugin where the selector is in the navigation sidebar and has no way to know if it is being shown inside of a document or the list view. I assume other users may also want their server components to be aware of where a component is rendering before hitting the client. An example would be wanting to redirect on the server instead of on the client, this is how multi-tenant redirects users from "global" enabled collections to the document view. ### How? Adds 2 new variables that are determined by the view being routed to. `viewType` - which view is being rendered, ie `list`, `document`, `version`, `account`, `verify`, `reset` ```ts type ViewTypes = | 'account' | 'dashboard' | 'document' | 'list' | 'reset' | 'verify' | 'version' ``` `documentSubViewType` - which tells you what sub view you are on, ie `api`, `livePreview`, `default`, `versions` ```ts type DocumentSubViewTypes = | 'api' | 'default' | 'livePreview' | 'version' | 'versions' ```
5 lines
108 B
JSON
5 lines
108 B
JSON
{
|
|
"extends": "../../tsconfig.base.json",
|
|
"references": [{ "path": "../payload" }, { "path": "../ui"}]
|
|
}
|