func (ui *GUI) renderIndex(w http.ResponseWriter, r *http.Request, modalError string) {
	_, confirmedWork, _ := ui.cache.getConfirmedMinedWork(0, 9)
	_, rewardQuotas, _ := ui.cache.getRewardQuotas(0, 9)
	lastPaymentHeight, _, _ := ui.cache.getLastPaymentInfo()
	address := `127.0.0.1`
	if ui.cfg.Domain != "" {
		address = ui.cfg.Domain
	}
	_, minerPort, err := net.SplitHostPort(ui.cfg.MinerListen)
	if err != nil {
		log.Errorf("failed to parse port from miner listening address %q: %v",
			ui.cfg.MinerListen, err)
	}
	data := indexPageData{
		HeaderData: headerData{
			CSRF:        csrf.TemplateField(r),
			Designation: ui.cfg.Designation,
			ShowMenu:    true,
			SoloPool:    ui.cfg.SoloPool,
		},
		PoolStatsData: poolStatsData{
			LastWorkHeight:    ui.cfg.FetchLastWorkHeight(),
			LastPaymentHeight: lastPaymentHeight,
			PoolHashRate:      ui.cache.getPoolHash(),
			PaymentMethod:     ui.cfg.PaymentMethod,
			Network:           ui.cfg.ActiveNetName,
			PoolFee:           ui.cfg.PoolFee,
			SoloPool:          ui.cfg.SoloPool,
		},
		RewardQuotas: rewardQuotas,
		MinedWork:    confirmedWork,
		MinerPort:    minerPort,
		ModalError:   modalError,
		Address:      address,
	}
	ui.renderTemplate(w, "index", data)
}
renderIndex renders the index template. It accepts an optional modalError
which can be used to include a pop-up error message on the page. This
function can be called from any HTTP handler which needs to display an error
message. The error message will only be displayed if the browser has
Javascript enabled.
package gui
import (
	"net"
	"net/http"
	"github.com/gorilla/csrf"
)
type indexPageData struct {
	HeaderData    headerData
	PoolStatsData poolStatsData
	MinerPort     string
	MinedWork     []*minedWork
	RewardQuotas  []*rewardQuota
	Address       string
	ModalError    string
}