slopus--happy
98e40dac97
CLI Smoke Test / smoke-test-linux (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-linux (24) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (24) (push) Has been cancelled
Expo App TypeScript typecheck / typecheck (push) Has been cancelled
20 行
723 B
TypeScript
20 行
723 B
TypeScript
const RIGHT_SIDEBAR_MIN_WINDOW_WIDTH = 1100;
|
|
|
|
type NewSessionSidebarLayoutInput = {
|
|
platform: 'web' | 'ios' | 'android' | 'macos' | 'windows';
|
|
isMac: boolean;
|
|
fileDiffsSidebarEnabled: boolean;
|
|
zenMode: boolean;
|
|
windowWidth: number;
|
|
};
|
|
|
|
export function getNewSessionSidebarLayout(input: NewSessionSidebarLayoutInput) {
|
|
const canShowSidebar = input.fileDiffsSidebarEnabled
|
|
&& (input.isMac || input.platform === 'web')
|
|
&& input.windowWidth >= RIGHT_SIDEBAR_MIN_WINDOW_WIDTH;
|
|
const showSidebar = canShowSidebar && !input.zenMode;
|
|
const sidebarWidth = Math.min(Math.max(Math.floor(input.windowWidth * 0.3), 250), 360);
|
|
|
|
return { canShowSidebar, showSidebar, sidebarWidth };
|
|
}
|