package pages
import (
"fmt"
"git.myrkvi.com/myrkvi/bin/models"
"git.myrkvi.com/myrkvi/bin/views/components"
"git.myrkvi.com/myrkvi/bin/views/partials"
)
templ page(inner templ.Component, menu []models.MenuItem, currentMenu int, title string) {
if title == "" {
bin
} else {
{ title } - bin
}
bin
@components.NavMenu(menu, currentMenu, false)
{! inner }
}
templ IndexFull() {
@page(
IndexPartial(),
models.DefaultMenu,
0,
"",
)
}
templ IndexPartial() {
Welcome to bin
bin is a simple paste bin.
@components.BoostButton("new", "/new")
}
templ NewFull(wantsText bool) {
@page(
NewPartial(wantsText),
models.DefaultMenu,
1,
"upload",
)
}
const placeholderCode string = `#include
int main(int argc, char *argv[]) {
printf("Hello, world!\n");
return 0;
}`
templ NewPartial(wantsText bool) {
submit a new file
}
templ BinFull(file models.File) {
@page(
BinPartial(file),
models.DefaultMenu,
-1,
file.Filename,
)
}
templ BinPartial(file models.File) {
{ file.Filename }
if file.Language != "" {
({ file.Language })
}
{ file.Description }
{ file.Data }
}