28 lines
617 B
TypeScript
28 lines
617 B
TypeScript
import { MCGrizzConf } from "../types/mcgrizzconf.ts";
|
|
import { NavItem } from "../types/nav.ts";
|
|
import { makeConfFile } from "./makeConfFile.ts";
|
|
|
|
/**
|
|
* @description Determines the state of setup and returns the nav items for that state
|
|
*/
|
|
export function getNavItems(): NavItem[] {
|
|
let conf: MCGrizzConf;
|
|
try {
|
|
conf = JSON.parse(Deno.readTextFileSync('mcgrizz.json'));
|
|
} catch {
|
|
conf = makeConfFile();
|
|
}
|
|
|
|
switch (conf.loader) {
|
|
case "unset":
|
|
return [{
|
|
title: 'Setup',
|
|
href: '/',
|
|
}]
|
|
case "forge":
|
|
case "fabric":
|
|
case "vanilla":
|
|
return [];
|
|
}
|
|
}
|