18 lines
663 B
TypeScript
18 lines
663 B
TypeScript
export type DisplayLayout = "single" | "thor-preview" | "dedicated";
|
|
|
|
export interface DisplayLayoutRequest {
|
|
display?: string | null;
|
|
layout?: string | null;
|
|
}
|
|
|
|
export function resolveDisplayLayout({ display, layout }: DisplayLayoutRequest): DisplayLayout {
|
|
if (display === "top" || display === "bottom") return "dedicated";
|
|
if (layout === "thor-preview" || layout === "dual") return "thor-preview";
|
|
return "single";
|
|
}
|
|
|
|
export function currentDisplayLayout(search = window.location.search): DisplayLayout {
|
|
const params = new URLSearchParams(search);
|
|
return resolveDisplayLayout({ display: params.get("display"), layout: params.get("layout") });
|
|
}
|