MCPcopy
hub / github.com/moncho/dry / renderLoadingScreen

Method renderLoadingScreen

app/model.go:2858–2930  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2856}
2857
2858func (m model) renderLoadingScreen() string {
2859 frames := []string{
2860 docker.Whale0, docker.Whale1, docker.Whale2, docker.Whale3,
2861 docker.Whale4, docker.Whale5, docker.Whale6, docker.Whale7, docker.Whale,
2862 }
2863
2864 frame := ""
2865 if m.loadingFrame < len(frames) {
2866 frame = frames[m.loadingFrame]
2867 }
2868
2869 connecting := "\U0001f433 Trying to connect to the Docker Host \U0001f433"
2870
2871 // Top line: connecting message, centered
2872 connectLine := ui.White(connecting)
2873 topLine := lipgloss.PlaceHorizontal(m.width, lipgloss.Center, connectLine)
2874
2875 // Middle: whale, centered
2876 whale := ui.Cyan(frame)
2877 whaleBlock := lipgloss.PlaceHorizontal(m.width, lipgloss.Center, whale)
2878
2879 // Fill the middle area so the whale is vertically centered.
2880 // Account for: 1 top line, 2 bottom lines, whale height.
2881 whaleHeight := strings.Count(whale, "\n") + 1
2882 bottomLines := 2
2883 padding := m.height - 1 - whaleHeight - bottomLines
2884 topPad := padding / 2
2885 botPad := padding - topPad
2886 if topPad < 0 {
2887 topPad = 0
2888 }
2889 if botPad < 0 {
2890 botPad = 0
2891 }
2892
2893 // Bottom-left: version + host
2894 verLine := ui.Blue("Dry Version: ") + ui.White(version.VERSION)
2895 hostLine := ""
2896 if m.config.DockerHost != "" {
2897 hostLine = ui.Blue("Docker Host: ") + ui.White(m.config.DockerHost)
2898 }
2899
2900 // Bottom-right: attribution
2901 attribution := "made with \U0001f499 (and go) by moncho"
2902
2903 // Compose bottom two lines
2904 bottomRow1 := verLine
2905 if m.width > 0 {
2906 attrW := ansi.StringWidth(attribution)
2907 verW := ansi.StringWidth(verLine)
2908 gap := m.width - verW - attrW
2909 if gap > 0 {
2910 bottomRow1 = verLine + strings.Repeat(" ", gap) + attribution
2911 }
2912 }
2913 bottomRow2 := hostLine
2914
2915 var sections []string

Callers 1

ViewMethod · 0.95

Calls 4

WhiteFunction · 0.92
CyanFunction · 0.92
BlueFunction · 0.92
CountMethod · 0.80

Tested by

no test coverage detected