aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt
blob: 40301fd4e842545cccb31bf27a19e6039205cc8b (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
36
package moe.nea.notenoughupdates.gui

import moe.nea.notenoughupdates.repo.RepoManager
import net.minecraft.network.chat.Component

fun repoGui(): ConfigGui<RepoManager.Config> {
    return ConfigGui(RepoManager) {
        title(Component.literal("NotEnoughUpdates Repo Settings"))
        toggle(Component.literal("Auto Update"), RepoManager.Config::autoUpdate)
        textfield(
            Component.literal("Repo Username"),
            Component.literal("<github user>"),
            RepoManager.Config::user,
            maxLength = 255
        )
        textfield(
            Component.literal("Repo Name"),
            Component.literal("<repo name>"),
            RepoManager.Config::repo
        )
        textfield(
            Component.literal("Repo Branch"),
            Component.literal("<repo branch>"),
            RepoManager.Config::branch
        )
        button(
            Component.literal("Reset to Defaults"),
            Component.literal("Reset"),
        ) {
            RepoManager.config.user = "NotEnoughUpdates"
            RepoManager.config.repo = "NotEnoughUpdates-REPO"
            RepoManager.config.branch = "dangerous"
            reload()
        }
    }
}