File size: 6,298 Bytes
e901389
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ComfyUI Workflow</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
            background-color: #000000;
            color: #f5f5f7;
            line-height: 1.6;
            padding: 20px;
            min-height: 100vh;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
        }
        .header {
            text-align: center;
            margin-bottom: 40px;
            padding: 40px 20px;
        }
        .header h1 {
            font-size: 48px;
            font-weight: 600;
            color: #ffffff;
            margin-bottom: 12px;
            letter-spacing: -0.02em;
        }
        .header p {
            font-size: 18px;
            color: #86868b;
            font-weight: 400;
        }
        .controls {
            display: flex;
            gap: 12px;
            margin-bottom: 24px;
            justify-content: center;
        }
        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 24px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
        }
        .btn-primary {
            background: #ffffff;
            color: #000000;
        }
        .btn-primary:hover {
            background: #f5f5f7;
            transform: scale(0.98);
        }
        .btn-secondary {
            background: #1d1d1f;
            color: #f5f5f7;
            border: 1px solid #424245;
        }
        .btn-secondary:hover {
            background: #2d2d2f;
            transform: scale(0.98);
        }
        .json-container {
            background-color: #1d1d1f;
            border-radius: 16px;
            padding: 32px;
            overflow-x: auto;
            border: 1px solid #424245;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        }
        pre {
            margin: 0;
            font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
            font-size: 13px;
            line-height: 1.6;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
        .json-key {
            color: #9cdcfe;
        }
        .json-string {
            color: #ce9178;
        }
        .json-number {
            color: #b5cea8;
        }
        .json-boolean {
            color: #569cd6;
        }
        .json-null {
            color: #569cd6;
        }
        .success {
            color: #30d158;
        }
        @media (max-width: 768px) {
            .header h1 {
                font-size: 32px;
            }
            .controls {
                flex-direction: column;
            }
            .json-container {
                padding: 20px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>ComfyUI Workflow</h1>
            <p>View and download your workflow JSON</p>
        </div>
        
        <div class="controls">
            <button class="btn btn-primary" onclick="downloadJSON()">Download JSON</button>
            <button class="btn btn-secondary" onclick="copyToClipboard()">Copy to Clipboard</button>
        </div>
        
        <div class="json-container">
            <pre id="json-content">{
  "client_id": "data-science-agent-ui",
  "description": "A fancy UI for Data Science Agent with ComfyUI-inspired design",
  "name": "Data Science Agent UI",
  "nodes": {},
  "version": 0.4
}</pre>
        </div>
    </div>

    <script>
        function copyToClipboard() {
            const jsonContent = document.getElementById('json-content').textContent;
            navigator.clipboard.writeText(jsonContent).then(() => {
                const btn = event.target;
                const originalText = btn.textContent;
                btn.textContent = 'Copied!';
                btn.classList.add('success');
                setTimeout(() => {
                    btn.textContent = originalText;
                    btn.classList.remove('success');
                }, 2000);
            }).catch(err => {
                alert('Failed to copy to clipboard');
            });
        }

        function downloadJSON() {
            const jsonContent = document.getElementById('json-content').textContent;
            const blob = new Blob([jsonContent], { type: 'application/json' });
            const url = URL.createObjectURL(blob);
            const a = document.createElement('a');
            a.href = url;
            a.download = 'comfyui_workflow.json';
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
            URL.revokeObjectURL(url);
            
            const btn = event.target;
            const originalText = btn.textContent;
            btn.textContent = 'Downloaded!';
            btn.classList.add('success');
            setTimeout(() => {
                btn.textContent = originalText;
                btn.classList.remove('success');
            }, 2000);
        }

        // Add syntax highlighting
        function highlightJSON() {
            const content = document.getElementById('json-content');
            let html = content.innerHTML;
            
            // Highlight different JSON elements
            html = html.replace(/"([^"]+)":/g, '<span class="json-key">"$1":</span>');
            html = html.replace(/: "([^"]*)"/g, ': <span class="json-string">"$1"</span>');
            html = html.replace(/: (-?\d+\.?\d*)/g, ': <span class="json-number">$1</span>');
            html = html.replace(/: (true|false)/g, ': <span class="json-boolean">$1</span>');
            html = html.replace(/: null/g, ': <span class="json-null">null</span>');
            
            content.innerHTML = html;
        }

        // Apply syntax highlighting after page load
        window.addEventListener('load', highlightJSON);
    </script>
</body>
</html>