summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/confirmation_context.go
blob: 0224fb0f0e059555ba00726f927048fa528ad9c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package context

import (
	"github.com/jesseduffield/lazygit/pkg/gui/types"
)

type ConfirmationContext struct {
	*SimpleContext
	c *types.HelperCommon

	State ConfirmationContextState
}

type ConfirmationContextState struct {
	OnConfirm func() error
	OnClose   func() error
}

var _ types.Context = (*ConfirmationContext)(nil)

func NewConfirmationContext(
	c *types.HelperCommon,
) *ConfirmationContext {
	return &ConfirmationContext{
		c: c,
		SimpleContext: NewSimpleContext(NewBaseContext(NewBaseContextOpts{
			View:                  c.Views().Confirmation,
			WindowName:            "confirmation",
			Key:                   CONFIRMATION_CONTEXT_KEY,
			Kind:                  types.TEMPORARY_POPUP,
			Focusable:             true,
			HasUncontrolledBounds: true,
		}), ContextCallbackOpts{}),
	}
}