@@ -17,35 +17,84 @@ const description = document.createElement('ui-text');
1717description.setAttribute('content', ${ JSON . stringify ( tag . description ) } );
1818stack.appendChild(description);
1919
20- const deleteButton = document.createElement('ui-button');
21- deleteButton.setAttribute('content', 'Delete Tag');
22- deleteButton.addEventListener('press', () => {
23- window.parent.postMessage(
24- {
25- type: 'tool',
26- payload: {
27- toolName: 'deleteTag',
28- params: { tagId: tag.id.toString() },
29- },
30- },
31- '*',
32- )
33- });
34- stack.appendChild(deleteButton);
35-
3620root.appendChild(stack);
3721 ` . trim ( )
3822 } else {
3923 return /* js */ `
40- console.error('Tag not found');
4124const stack = document.createElement('ui-stack');
4225stack.setAttribute('direction', 'vertical');
4326stack.setAttribute('spacing', '20');
4427stack.setAttribute('align', 'center');
28+
4529const title = document.createElement('ui-text');
4630title.setAttribute('content', 'Tag not found');
4731stack.appendChild(title);
32+
4833root.appendChild(stack);
34+ ` . trim ( )
35+ }
36+ }
37+
38+ // we'll just keep this for reference for now...
39+ export async function getTagViewUI ( db : DBClient , tagId : number ) {
40+ const tag = await db . getTag ( tagId )
41+ if ( tag ) {
42+ return /* html */ `
43+ <html>
44+ <head>
45+ <meta charset="UTF-8">
46+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
47+ <title>Epic Me</title>
48+ <style>
49+ * { margin: 0; padding: 0; box-sizing: border-box; }
50+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: oklch(20% 0.06 320); background-color: oklch(98% 0.02 320); }
51+ .container { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
52+ .title { font-size: 2rem; font-weight: 700; color: oklch(20% 0.06 320); margin-bottom: 2rem; text-align: center; }
53+ .description { text-align: center; color: oklch(40% 0.07 320); }
54+ </style>
55+ </head>
56+ <body>
57+ <div class="container">
58+ <h1 class="title">${ tag . name } </h1>
59+ <p class="description">${ tag . description } </p>
60+ </div>
61+ </body>
62+ </html>
4963 `
5064 }
65+
66+ return /* html */ `
67+ <html>
68+ <head>
69+ <meta charset="UTF-8">
70+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
71+ <title>Epic Me</title>
72+ <style>
73+ * { margin: 0; padding: 0; box-sizing: border-box; }
74+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: oklch(20% 0.06 320); background-color: oklch(98% 0.02 320); }
75+ .container { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
76+ .title { font-size: 2rem; font-weight: 700; color: oklch(20% 0.06 320); margin-bottom: 2rem; text-align: center; }
77+ .description { text-align: center; color: oklch(40% 0.07 320); }
78+ .error-state { text-align: center; padding: 4rem 2rem; }
79+ .error-state h1 { margin: 1rem 0 2rem; color: oklch(20% 0.06 320); }
80+ .error-icon { color: oklch(60% 0.18 0); width: 3rem; height: 3rem; display: inline-flex; align-items: center; justify-content: center; }
81+ .error-icon svg { width: 100%; height: 100%; }
82+ </style>
83+ </head>
84+ <body>
85+ <div class="container">
86+ <div class="error-state">
87+ <span class="error-icon" data-icon="alert-circle">
88+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
89+ <circle cx="12" cy="12" r="10"/>
90+ <line x1="12" y1="8" x2="12" y2="12"/>
91+ <line x1="12" y1="16" x2="12.01" y2="16"/>
92+ </svg>
93+ </span>
94+ <h1>Tag with id ${ tagId } not found</h1>
95+ </div>
96+ </div>
97+ </body>
98+ </html>
99+ `
51100}
0 commit comments