aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt
blob: 00bc0998a3d0954eff7eb733ebe11c320b4b3248 (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.text.Text

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