Intiial commit

This commit is contained in:
JB
2026-02-13 10:18:06 -05:00
commit 15722d4e76
26 changed files with 1341 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import { type PageContext, input, label, modal, stringSelect } from '@star-kitten/discord';
import type { LocationsState } from './state';
import { Page } from './router';
import { StructureType } from '@/lib/db/types/routes';
export default async function (ctx: PageContext<LocationsState>) {
const isAdd = ctx.custom_id === Page.addLocationModal;
const location = ctx.state.data.selected;
return modal(isAdd ? Page.addLocationModalSubmit : Page.editLocationModalSubmit,
`${isAdd ? 'Add Location' : 'Edit: ' + ctx.state.data.selected?.short_name || ''}`,
isAdd && label({ label: 'Location ID' },
input('loc-id', { placeholder: 'Enter the structure id', required: true }),
),
label({ label: 'Location Name' },
input('loc-name', { placeholder: 'Enter the location name', required: true, value: location?.name }),
),
label({ label: 'Location Short Name' },
input('loc-short-name', { placeholder: 'Enter the location short name', required: true, value: location?.short_name }),
),
label({ label: 'System' },
input('loc-system', { placeholder: 'Enter the system (e.g. Jita)', required: true, value: location?.system }),
),
label({ label: 'Structure Type' },
stringSelect('loc-structure-type', { placeholder: 'Select Structure Type', min_values: 1, max_values: 1, required: true },
...Object.values(StructureType).map((type) => ({
label: type,
value: type,
default: location?.structure_type === type,
})),
),
),
);
}