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
import { api } from "https://esm.town/v/pomdtr/api";
import { Command } from "https://esm.town/v/pomdtr/cmdk";
export const viewValDetail: Command = async ({ params }) => {
const val = await api(`/v1/vals/${params.val}`, {
authenticated: true,
});
return {
type: "detail",
detail: {
markdown: ["```tsx", val.code, "```"].join("\n"),
actions: [
{
title: "Open Val",
type: "open",
open: {
url: `https://www.val.town/v/${val.author.username}/${val.name}`,
},
},
{
title: "Edit Val",
type: "run",
run: {
command: "pomdtr/edit_val",
params: {
val: val.id,
},
},
},
],
},
};
};