From cb503a7677b244759cf88647246fb3800b7a74e0 Mon Sep 17 00:00:00 2001 From: Jun Nishimura Date: Sat, 2 Sep 2023 16:35:18 +0900 Subject: [PATCH] fix error display bug (#104) --- ui/style/style.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ui/style/style.go b/ui/style/style.go index 0ec0f5f..1d87ae3 100644 --- a/ui/style/style.go +++ b/ui/style/style.go @@ -97,19 +97,23 @@ func AsciiArt() lipgloss.Style { Foreground(lipgloss.Color(HighlightColor)) } -const errorMessage = "unexpected error happens.\n\nplease report at\n\nhttps://github.com/JunNishimura/Chatify/issues" +const ( + errorMessage = "unexpected error happens.\n\nplease report at\n\nhttps://github.com/JunNishimura/Chatify/issues" + errorDisplayWidth = 60 + errorDisplayHeight = 10 +) func ErrorView(windowWidth, windowHeight int) string { return lipgloss.Place(windowWidth, windowHeight, lipgloss.Center, lipgloss.Center, lipgloss.NewStyle(). - Width(60). - Height(10). + Width(errorDisplayWidth). + Height(errorDisplayHeight). BorderStyle(lipgloss.ThickBorder()). BorderForeground(lipgloss.Color(HighlightColor)). Background(lipgloss.AdaptiveColor{Dark: BgColor, Light: BgColor}). - Render(lipgloss.Place(50, 10, lipgloss.Center, lipgloss.Center, + Render(lipgloss.Place(errorDisplayWidth, errorDisplayHeight, lipgloss.Center, lipgloss.Center, lipgloss.NewStyle(). - Width(50). + Width(errorDisplayWidth). Align(lipgloss.Center). Foreground(lipgloss.Color(Red)). Background(lipgloss.Color(BgColor)).