remove video, make initial window larger to fill the screen

This commit is contained in:
sawka 2024-08-01 00:52:15 -07:00
parent 817afd6138
commit 49a365e10b
4 changed files with 41 additions and 18 deletions

View File

@ -297,11 +297,31 @@ function createBrowserWindow(
waveWindow: WaveWindow, waveWindow: WaveWindow,
settings: SettingsConfigType settings: SettingsConfigType
): WaveBrowserWindow { ): WaveBrowserWindow {
let winWidth = waveWindow?.winsize?.width;
let winHeight = waveWindow?.winsize?.height;
let winPosX = waveWindow.pos.x;
let winPosY = waveWindow.pos.y;
if (winWidth == null || winWidth == 0) {
const primaryDisplay = electron.screen.getPrimaryDisplay();
const { width } = primaryDisplay.workAreaSize;
winWidth = width - winPosX - 100;
if (winWidth > 2000) {
winWidth = 2000;
}
}
if (winHeight == null || winHeight == 0) {
const primaryDisplay = electron.screen.getPrimaryDisplay();
const { height } = primaryDisplay.workAreaSize;
winHeight = height - winPosY - 100;
if (winHeight > 1200) {
winHeight = 1200;
}
}
let winBounds = { let winBounds = {
x: waveWindow.pos.x, x: winPosX,
y: waveWindow.pos.y, y: winPosY,
width: waveWindow.winsize.width, width: winWidth,
height: waveWindow.winsize.height, height: winHeight,
}; };
winBounds = ensureBoundsAreVisible(winBounds); winBounds = ensureBoundsAreVisible(winBounds);
const winOpts: Electron.BrowserWindowConstructorOptions = { const winOpts: Electron.BrowserWindowConstructorOptions = {

View File

@ -60,7 +60,7 @@ func (cs *ClientService) GetWindow(windowId string) (*wstore.Window, error) {
} }
func (cs *ClientService) MakeWindow(ctx context.Context) (*wstore.Window, error) { func (cs *ClientService) MakeWindow(ctx context.Context) (*wstore.Window, error) {
return wstore.CreateWindow(ctx) return wstore.CreateWindow(ctx, nil)
} }
// moves the window to the front of the windowId stack // moves the window to the front of the windowId stack
@ -155,12 +155,12 @@ func (cs *ClientService) BootstrapStarterLayout(ctx context.Context) error {
wstore.MetaKey_View: "waveai", wstore.MetaKey_View: "waveai",
}, },
}}, }},
{IndexArr: []int{2, 2}, BlockDef: &wstore.BlockDef{ // {IndexArr: []int{2, 2}, BlockDef: &wstore.BlockDef{
Meta: wstore.MetaMapType{ // Meta: wstore.MetaMapType{
wstore.MetaKey_View: "web", // wstore.MetaKey_View: "web",
wstore.MetaKey_Url: "https://www.youtube.com/embed/cKqsw_sAsU8", // wstore.MetaKey_Url: "https://www.youtube.com/embed/cKqsw_sAsU8",
}, // },
}}, // }},
} }
objsvc := &objectservice.ObjectService{} objsvc := &objectservice.ObjectService{}

View File

@ -117,7 +117,7 @@ func (svc *WindowService) MoveBlockToNewWindow(ctx context.Context, currentTabId
if !foundBlock { if !foundBlock {
return nil, fmt.Errorf("block not found in current tab") return nil, fmt.Errorf("block not found in current tab")
} }
newWindow, err := wstore.CreateWindow(ctx) newWindow, err := wstore.CreateWindow(ctx, nil)
if err != nil { if err != nil {
return nil, fmt.Errorf("error creating window: %w", err) return nil, fmt.Errorf("error creating window: %w", err)
} }

View File

@ -317,11 +317,17 @@ func UpdateObjectMeta(ctx context.Context, oref waveobj.ORef, meta MetaMapType)
}) })
} }
func CreateWindow(ctx context.Context) (*Window, error) { func CreateWindow(ctx context.Context, winSize *WinSize) (*Window, error) {
windowId := uuid.NewString() windowId := uuid.NewString()
workspaceId := uuid.NewString() workspaceId := uuid.NewString()
tabId := uuid.NewString() tabId := uuid.NewString()
layoutNodeId := uuid.NewString() layoutNodeId := uuid.NewString()
if winSize == nil {
winSize = &WinSize{
Width: 1200,
Height: 800,
}
}
window := &Window{ window := &Window{
OID: windowId, OID: windowId,
WorkspaceId: workspaceId, WorkspaceId: workspaceId,
@ -331,10 +337,7 @@ func CreateWindow(ctx context.Context) (*Window, error) {
X: 100, X: 100,
Y: 100, Y: 100,
}, },
WinSize: WinSize{ WinSize: *winSize,
Width: 1200,
Height: 800,
},
} }
err := DBInsert(ctx, window) err := DBInsert(ctx, window)
if err != nil { if err != nil {
@ -427,7 +430,7 @@ func EnsureInitialData() error {
if len(client.WindowIds) > 0 { if len(client.WindowIds) > 0 {
return nil return nil
} }
_, err = CreateWindow(ctx) _, err = CreateWindow(ctx, &WinSize{0, 0})
if err != nil { if err != nil {
return fmt.Errorf("error creating window: %w", err) return fmt.Errorf("error creating window: %w", err)
} }