-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.html
More file actions
2351 lines (2160 loc) · 87.2 KB
/
manage.html
File metadata and controls
2351 lines (2160 loc) · 87.2 KB
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Portfolio Manager</title>
<style>
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
--mgr-bg: #fdfcfd;
--mgr-text: #201825;
--mgr-primary: #56008f;
--mgr-secondary: #f1eaf6;
--mgr-accent: #180029;
--mgr-border: #ccc;
--mgr-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
html { font-size: 16px; }
body {
font-family: var(--mgr-font);
color: var(--mgr-text);
background: var(--mgr-bg);
padding: 1.5rem;
max-width: 900px;
margin: 0 auto;
}
h1 { font-size: 1.5rem; margin-bottom: 1.5rem; color: var(--mgr-accent); }
h2 {
font-size: 1.125rem;
margin: 1.5rem 0 0.75rem;
padding-bottom: 0.375rem;
border-bottom: 2px solid var(--mgr-primary);
color: var(--mgr-accent);
}
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--mgr-text); }
input[type="text"], input[type="email"], input[type="url"], textarea, select {
width: 100%;
padding: 0.5rem;
border: 1px solid var(--mgr-border);
border-radius: 0;
font-family: var(--mgr-font);
font-size: 0.9rem;
margin-bottom: 0.75rem;
background: #fff;
}
textarea { resize: vertical; min-height: 60px; }
button {
font-family: var(--mgr-font);
font-size: 0.85rem;
padding: 0.5rem 1rem;
border: 1px solid var(--mgr-primary);
background: var(--mgr-bg);
color: var(--mgr-primary);
cursor: pointer;
border-radius: 0;
margin-right: 0.5rem;
margin-bottom: 0.5rem;
}
button:hover { background: var(--mgr-primary); color: #fff; }
button.danger { border-color: #a00; color: #a00; }
button.danger:hover { background: #a00; color: #fff; }
button.primary-btn { background: var(--mgr-primary); color: #fff; }
button.primary-btn:hover { background: var(--mgr-accent); border-color: var(--mgr-accent); }
.field-row { margin-bottom: 0.5rem; }
.item-block {
background: var(--mgr-secondary);
padding: 1rem;
margin-bottom: 0.75rem;
border: 1px solid var(--mgr-border);
border-radius: 0;
}
.item-block .item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
}
.item-block .item-header strong { font-size: 0.95rem; }
.color-row {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.75rem;
}
.color-row label { margin-bottom: 0; min-width: 80px; }
.color-row input[type="color"] {
width: 40px;
height: 32px;
border: 1px solid var(--mgr-border);
border-radius: 0;
padding: 0;
cursor: pointer;
background: none;
}
.color-row input[type="text"] {
width: 100px;
margin-bottom: 0;
}
.tag-input-wrap { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.tag-input-wrap input { flex: 1; margin-bottom: 0; }
.tags-display { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
.tags-display span {
background: var(--mgr-primary);
color: #fff;
font-size: 0.75rem;
padding: 0.15rem 0.5rem;
cursor: pointer;
border-radius: 0;
}
#output-area {
background: #1a1a2e;
color: #0f0;
padding: 1rem;
font-family: monospace;
font-size: 0.8rem;
white-space: pre-wrap;
margin-top: 1rem;
min-height: 60px;
border-radius: 0;
display: none;
}
.skills-display { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
.skills-display span {
background: var(--mgr-secondary);
border: 1px solid var(--mgr-primary);
font-size: 0.8rem;
padding: 0.2rem 0.6rem;
cursor: pointer;
color: var(--mgr-accent);
border-radius: 0;
}
.ai-row {
display: flex;
gap: 0.5rem;
align-items: flex-start;
margin-bottom: 0.75rem;
}
.ai-row textarea, .ai-row input[type="text"] {
flex: 1;
margin-bottom: 0;
}
button.ai-btn {
border-color: var(--mgr-accent);
color: var(--mgr-accent);
font-size: 0.75rem;
padding: 0.4rem 0.6rem;
white-space: nowrap;
flex-shrink: 0;
}
button.ai-btn:hover {
background: var(--mgr-accent);
color: #fff;
}
.ai-prompt-box {
background: var(--mgr-secondary);
border: 1px solid var(--mgr-border);
border-radius: 0;
padding: 0.75rem;
margin-bottom: 0.75rem;
display: none;
}
.ai-prompt-box textarea {
width: 100%;
min-height: 50px;
margin-bottom: 0.5rem;
}
.ai-prompt-box .ai-prompt-actions {
display: flex;
gap: 0.5rem;
align-items: center;
}
.ai-prompt-box .ai-prompt-actions select {
font-family: var(--mgr-font);
font-size: 0.8rem;
padding: 0.35rem 0.5rem;
border: 1px solid var(--mgr-border);
border-radius: 0;
background: #fff;
}
.ai-status {
font-size: 0.8rem;
color: var(--mgr-primary);
margin-left: 0.5rem;
}
.api-key-row {
display: flex;
gap: 0.5rem;
align-items: center;
margin-bottom: 0.5rem;
}
.api-key-row input[type="text"],
.api-key-row input[type="password"] {
flex: 1;
margin-bottom: 0;
font-family: monospace;
font-size: 0.8rem;
}
.api-key-row input[type="file"] {
font-family: var(--mgr-font);
font-size: 0.8rem;
border: none;
padding: 0;
margin-bottom: 0;
}
.section-heading {
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
-webkit-user-select: none;
user-select: none;
margin-bottom: 0;
}
.section-heading::after {
content: '\25B2';
font-size: 0.7rem;
color: var(--mgr-primary);
transition: transform 0.2s ease;
flex-shrink: 0;
margin-left: 0.5rem;
}
.section-heading.collapsed::after {
transform: rotate(180deg);
}
.section-desc {
font-size: 0.8rem;
color: #888;
margin: 0.25rem 0 0.5rem;
line-height: 1.3;
}
.section-body {
overflow: hidden;
transition: max-height 0.3s ease, opacity 0.2s ease;
max-height: 4000px;
opacity: 1;
}
.section-body.collapsed {
max-height: 0;
opacity: 0;
margin: 0;
padding: 0;
}
.expand-all-bar {
display: flex;
justify-content: flex-end;
margin-bottom: 1rem;
}
.agent-chat-log {
border: 1px solid var(--mgr-border);
background: #fafafa;
padding: 0.75rem;
min-height: 120px;
max-height: 400px;
overflow-y: auto;
margin-bottom: 0.75rem;
font-size: 0.85rem;
line-height: 1.5;
}
.agent-msg {
margin-bottom: 0.5rem;
padding: 0.5rem 0.75rem;
border: 1px solid var(--mgr-border);
background: #fff;
}
.agent-msg.user {
border-left: 3px solid var(--mgr-primary);
background: var(--mgr-secondary);
}
.agent-msg.agent {
border-left: 3px solid var(--mgr-accent);
}
.agent-msg.system {
border-left: 3px solid #888;
color: #666;
font-size: 0.8rem;
}
.agent-msg-label {
font-weight: 600;
font-size: 0.75rem;
text-transform: uppercase;
color: var(--mgr-primary);
margin-bottom: 0.2rem;
}
.agent-msg.agent .agent-msg-label {
color: var(--mgr-accent);
}
.agent-msg.system .agent-msg-label {
color: #888;
}
.agent-input-row {
position: relative;
display: flex;
}
.agent-input-row textarea {
flex: 1;
margin-bottom: 0;
min-height: 44px;
resize: vertical;
padding-right: 70px;
}
.agent-input-row button {
position: absolute;
right: 1px;
bottom: 1px;
top: 1px;
margin: 0;
border: none;
border-left: 1px solid var(--mgr-border);
padding: 0 0.75rem;
font-size: 0.85rem;
height: auto;
}
.agent-deploy-prompt {
margin-top: 0.75rem;
padding: 0.75rem;
border: 1px solid var(--mgr-primary);
background: var(--mgr-secondary);
font-size: 0.85rem;
}
.agent-deploy-prompt button {
margin-top: 0.5rem;
}
.agent-loading {
display: inline-block;
font-size: 0.85rem;
color: var(--mgr-primary);
padding: 0.5rem 0.75rem;
}
.agent-loading::after {
content: '';
animation: agentDots 1.2s steps(4, end) infinite;
}
@keyframes agentDots {
0% { content: ''; }
25% { content: '.'; }
50% { content: '..'; }
75% { content: '...'; }
}
.agent-streaming .agent-msg-body {
border-right: 2px solid var(--mgr-accent);
animation: agentCursor 0.6s step-end infinite;
}
@keyframes agentCursor {
0%, 100% { border-color: var(--mgr-accent); }
50% { border-color: transparent; }
}
.mgr-footer {
margin-top: 3rem;
padding: 1.5rem 0;
border-top: 1px solid var(--mgr-border);
text-align: center;
font-size: 0.75rem;
color: #999;
}
.mgr-footer a {
color: var(--mgr-primary);
text-decoration: none;
}
.mgr-footer a:hover {
text-decoration: underline;
}
@media (max-width: 480px) {
body { padding: 1rem; }
.color-row { flex-wrap: wrap; }
.ai-row { flex-direction: column; }
.api-key-row { flex-direction: column; align-items: stretch; }
}
</style>
</head>
<body>
<h1>Portfolio Manager</h1>
<div class="expand-all-bar">
<button onclick="toggleAllSections()">Expand All</button>
</div>
<!-- AI Configuration -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">AI Content Generation</h2>
<p class="section-desc">Configure your OpenAI API key and model for AI-powered content generation.</p>
<div class="section-body collapsed">
<div class="field-row">
<label>OpenAI API Key (paste or load from .txt file)</label>
<div class="api-key-row">
<input type="password" id="api-key-input" placeholder="sk-..." oninput="saveApiKeyToCache()">
<input type="file" id="api-key-file" accept=".txt">
<button onclick="toggleKeyVisibility()">Show</button>
<button class="danger" onclick="clearApiKeyCache()">Clear</button>
</div>
<div class="field-row" style="margin-top:0.5rem">
<label>Model</label>
<select id="ai-model" style="font-family:var(--mgr-font);font-size:0.85rem;padding:0.4rem;border:1px solid var(--mgr-border);border-radius:0;background:#fff;width:auto;">
<option value="gpt-5.2">GPT-5.2</option>
<option value="gpt-5.1">GPT-5.1</option>
</select>
</div>
</div>
</div>
<!-- Site Settings -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Site</h2>
<p class="section-desc">Set the portfolio title, upload a profile image, and adjust image display settings.</p>
<div class="section-body collapsed">
<div class="field-row">
<label for="site-title">Title</label>
<input type="text" id="site-title" value="">
</div>
<div class="field-row">
<label>Portfolio Image</label>
<div style="display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;gap:8px;flex-wrap:wrap;">
<input type="file" id="site-image-input" accept="image/png,image/jpeg,image/gif,image/svg+xml,image/webp" onchange="handleImageUpload(this)">
<button class="ai-btn" onclick="removePortfolioImage()" id="remove-image-btn" style="display:none;background:#c33;">Remove</button>
</div>
<div id="site-image-preview" style="margin-top:8px;display:none;">
<img id="site-image-thumb" src="" alt="Preview" style="width:64px;height:64px;object-fit:cover;border:1px solid #ccc;border-radius:0;">
</div>
</div>
<div class="field-row">
<label>Image Size</label>
<div style="display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;gap:8px;">
<select id="image-size" style="font-family:var(--mgr-font);font-size:0.85rem;padding:0.35rem 0.5rem;border:1px solid var(--mgr-border);border-radius:0;background:#fff;">
<option value="small">Small (64px)</option>
<option value="medium" selected>Medium (96px)</option>
<option value="large">Large (160px)</option>
</select>
</div>
</div>
<div class="field-row">
<label>Image Border</label>
<div style="display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;gap:12px;flex-wrap:wrap;">
<label style="display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;gap:4px;min-width:auto;margin-bottom:0;font-weight:400;font-size:0.85rem;">
<input type="checkbox" id="image-border-toggle" checked> Show border
</label>
<div class="color-row" style="margin-bottom:0;">
<label style="min-width:auto;margin-bottom:0;">Color</label>
<input type="color" id="image-border-color" value="#ffffff">
<input type="text" id="image-border-color-text" value="#ffffff" style="width:80px;margin-bottom:0;">
</div>
</div>
</div>
</div>
<!-- Notice -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Notice</h2>
<p class="section-desc">Add a notice banner at the top of the portfolio with optional link and date.</p>
<div class="section-body collapsed">
<div class="field-row">
<label for="notice-text">Notice Text</label>
<div class="ai-row">
<input type="text" id="notice-text" value="">
<button class="ai-btn" onclick="togglePromptBox('notice-text-ai')">Generate</button>
</div>
<div class="ai-prompt-box" id="notice-text-ai">
<label>Prompt</label>
<textarea id="notice-text-ai-prompt" placeholder="Describe the notice you want generated..."></textarea>
<div class="ai-prompt-actions">
<button class="ai-btn" onclick="aiGenerate('notice-text-ai', 'notice-text')">Generate Content</button>
<span class="ai-status" id="notice-text-ai-status"></span>
</div>
</div>
</div>
<div class="field-row">
<label for="notice-link">Notice Link</label>
<input type="url" id="notice-link" value="">
</div>
<div class="field-row">
<label for="notice-updated">Updated Date</label>
<input type="text" id="notice-updated" value="">
</div>
</div>
<!-- Info -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Info</h2>
<p class="section-desc">Edit your name, email address, and bio text shown on the portfolio.</p>
<div class="section-body collapsed">
<div class="field-row">
<label for="info-name">Name</label>
<input type="text" id="info-name" value="">
</div>
<div class="field-row">
<label for="info-email">Email</label>
<input type="email" id="info-email" value="">
</div>
<div class="field-row">
<label for="info-bio">Bio</label>
<div class="ai-row">
<textarea id="info-bio"></textarea>
<button class="ai-btn" onclick="togglePromptBox('info-bio-ai')">Generate</button>
</div>
<div class="ai-prompt-box" id="info-bio-ai">
<label>Prompt</label>
<textarea id="info-bio-ai-prompt" placeholder="Describe the bio you want generated..."></textarea>
<div class="ai-prompt-actions">
<button class="ai-btn" onclick="aiGenerate('info-bio-ai', 'info-bio')">Generate Content</button>
<span class="ai-status" id="info-bio-ai-status"></span>
</div>
</div>
</div>
</div>
<!-- Skills -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Skills</h2>
<p class="section-desc">Manage the list of skills displayed on your portfolio. Click a skill to remove it.</p>
<div class="section-body collapsed">
<div class="skills-display" id="skills-display"></div>
<div class="tag-input-wrap">
<input type="text" id="skill-input" placeholder="Add skill">
<button onclick="addSkill()">Add</button>
</div>
</div>
<!-- Education / Technical Background -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Education & Technical Background</h2>
<p class="section-desc">Write a summary of your education and technical background with an option to show it on the portfolio.</p>
<div class="section-body collapsed">
<p style="font-size:0.85rem;color:#666;margin-bottom:0.5rem;">A summary of your educational and technical background. Toggle whether to include it on the portfolio page.</p>
<div class="field-row">
<label style="display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;gap:6px;font-weight:400;font-size:0.85rem;margin-bottom:0.5rem;">
<input type="checkbox" id="edu-show-toggle"> Include on portfolio page
</label>
</div>
<div class="field-row">
<label for="edu-summary">Summary</label>
<div class="ai-row">
<textarea id="edu-summary" style="min-height:100px;" placeholder="Describe your education, certifications, technical background..."></textarea>
<button class="ai-btn" onclick="togglePromptBox('edu-summary-ai')">Generate</button>
</div>
<div class="ai-prompt-box" id="edu-summary-ai">
<label>Prompt</label>
<textarea id="edu-summary-ai-prompt" placeholder="Describe the education/background you want generated..."></textarea>
<div class="ai-prompt-actions">
<button class="ai-btn" onclick="aiGenerate('edu-summary-ai', 'edu-summary')">Generate Content</button>
<span class="ai-status" id="edu-summary-ai-status"></span>
</div>
</div>
</div>
</div>
<!-- Resume Export -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Resume Export</h2>
<p class="section-desc">Generate a one-page PDF resume from your portfolio data.</p>
<div class="section-body collapsed">
<p style="font-size:0.85rem;color:#666;margin-bottom:0.5rem;">Export a one-page PDF resume using your portfolio data. No images are included. A popup will ask for your phone number (it is not stored).</p>
<button class="primary-btn" onclick="exportResumePDF()">Export Resume as PDF</button>
</div>
<!-- Projects -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Projects</h2>
<p class="section-desc">Add, edit, reorder, and remove portfolio projects with titles, descriptions, URLs, and tags.</p>
<div class="section-body collapsed">
<div id="projects-list"></div>
<button onclick="addProject()">Add Project</button>
</div>
<!-- Links -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Links</h2>
<p class="section-desc">Manage external links displayed in the links section of your portfolio.</p>
<div class="section-body collapsed">
<div id="links-list"></div>
<button onclick="addLink()">Add Link</button>
</div>
<!-- Support Link -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Support Link</h2>
<p class="section-desc">Add an optional donation or support link such as Buy Me a Coffee.</p>
<div class="section-body collapsed">
<p style="font-size:0.85rem;color:#666;margin-bottom:0.5rem;">Add a "Buy Me a Coffee" style link. Leave URL empty to hide.</p>
<label>Label</label>
<input type="text" id="support-label" placeholder="Buy This Dev a Cup of Coffee">
<label>URL</label>
<input type="text" id="support-url" placeholder="https://buymeacoffee.com/yourname">
</div>
<!-- Social Links -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Social Links</h2>
<p class="section-desc">Add social media profile links that appear in the portfolio header.</p>
<div class="section-body collapsed">
<p style="font-size:0.85rem;color:#666;margin-bottom:0.5rem;">Add social media links. They appear in the header if added.</p>
<div id="socials-list"></div>
<button onclick="addSocial()">Add Social</button>
</div>
<!-- Styles / Colors -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Colors</h2>
<p class="section-desc">Customize the color scheme of your portfolio including primary, accent, and background colors.</p>
<div class="section-body collapsed">
<div id="color-fields"></div>
</div>
<!-- Output Files -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Output Files</h2>
<p class="section-desc">Configure additional output filenames generated during the build process.</p>
<div class="section-body collapsed">
<div id="output-files-list"></div>
<div class="tag-input-wrap">
<input type="text" id="output-file-input" placeholder="e.g. custom.html">
<button onclick="addOutputFile()">Add File</button>
</div>
</div>
<!-- Actions -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Actions</h2>
<p class="section-desc">Save changes, build the portfolio, download data, or preview the site.</p>
<div class="section-body collapsed">
<button class="primary-btn" onclick="saveToDisk()">Save</button>
<button class="primary-btn" onclick="buildPortfolio()">Build</button>
<button onclick="downloadJSON()">Download JSON</button>
<button onclick="viewPortfolio()">View Portfolio</button>
<span id="action-status" style="font-size:0.85rem;color:var(--mgr-primary);margin-left:0.5rem;"></span>
</div>
<!-- Deploy -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Deploy to GitHub Pages</h2>
<p class="section-desc">Configure and deploy your portfolio to GitHub Pages with optional custom domain.</p>
<div class="section-body collapsed">
<div style="margin-bottom:0.75rem;">
<label style="display:block;margin-bottom:0.25rem;font-weight:600;font-size:0.85rem;">GitHub Repo URL</label>
<input type="text" id="deploy-repo-url" placeholder="https://github.com/user/repo.git" oninput="updateLiveUrl()" style="width:100%;">
</div>
<div style="margin-bottom:0.75rem;">
<label style="display:block;margin-bottom:0.25rem;font-weight:600;font-size:0.85rem;">Custom Domain (optional)</label>
<input type="text" id="deploy-domain" placeholder="example.com" oninput="updateLiveUrl()" style="width:100%;">
</div>
<div id="deploy-live-url" style="margin-bottom:0.75rem;font-size:0.85rem;color:#666;"></div>
<div id="deploy-info-panel" style="display:none;margin-bottom:0.75rem;padding:0.75rem;border:1px solid #ddd;background:#fafafa;font-size:0.85rem;">
<div id="deploy-repo-status" style="margin-bottom:0.5rem;font-weight:600;"></div>
<div id="deploy-remote-files" style="margin-bottom:0.5rem;"></div>
<div id="deploy-build-files"></div>
</div>
<button onclick="checkDeployRepo()" style="margin-bottom:0.25rem;">Check Repo</button>
<button class="primary-btn" onclick="saveDeployConfig()">Save Deploy Settings</button>
<button class="primary-btn" onclick="deployPortfolio()">Save, Build + Deploy</button>
<span id="deploy-status" style="font-size:0.85rem;color:var(--mgr-primary);margin-left:0.5rem;"></span>
</div>
<!-- Portfolio Agent -->
<h2 class="section-heading collapsed" onclick="toggleSection(this)">Portfolio Agent</h2>
<p class="section-desc">Chat with an AI agent to make edits to your portfolio using natural language. Requires an API key.</p>
<div class="section-body collapsed">
<div class="agent-chat-log" id="agent-chat-log"></div>
<div class="agent-input-row">
<textarea id="agent-input" placeholder="Tell the agent what to change, e.g. 'Change the site title to My Portfolio'" onkeydown="if(event.key==='Enter'&&!event.shiftKey){event.preventDefault();agentSend();}"></textarea>
<button class="primary-btn" onclick="agentSend()" id="agent-send-btn">Send</button>
</div>
<div id="agent-deploy-area"></div>
</div>
<div id="output-area"></div>
<footer class="mgr-footer">
Portfolio Manager -- <a href="https://github.com/crissymoon/GitHub-Portfolio-Page-Builder" target="_blank">GitHub-Portfolio-Page-Builder</a>
</footer>
<script src="beautify/beautify.js"></script>
<script>
var data = null;
function toggleSection(heading) {
var body = heading.nextElementSibling;
while (body && !body.classList.contains('section-body')) {
body = body.nextElementSibling;
}
if (!body) return;
heading.classList.toggle('collapsed');
body.classList.toggle('collapsed');
}
function toggleAllSections() {
var headings = document.querySelectorAll('.section-heading');
var allExpanded = true;
for (var i = 0; i < headings.length; i++) {
if (headings[i].classList.contains('collapsed')) {
allExpanded = false;
break;
}
}
for (var i = 0; i < headings.length; i++) {
var body = headings[i].nextElementSibling;
while (body && !body.classList.contains('section-body')) {
body = body.nextElementSibling;
}
if (!body) continue;
if (allExpanded) {
headings[i].classList.add('collapsed');
body.classList.add('collapsed');
} else {
headings[i].classList.remove('collapsed');
body.classList.remove('collapsed');
}
}
var btn = document.querySelector('.expand-all-bar button');
btn.textContent = allExpanded ? 'Expand All' : 'Collapse All';
}
function loadData() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "crissy-data.json?v=" + Date.now(), true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
// status 200 for http, status 0 for file:// protocol
if (xhr.status === 200 || (xhr.status === 0 && xhr.responseText)) {
try {
data = JSON.parse(xhr.responseText);
populateForm();
} catch (e) {
showLoadError("Failed to parse crissy-data.json: " + e.message);
}
} else {
// Fallback: try fetch API for environments where XHR fails on local files
if (typeof fetch === "function") {
fetch("crissy-data.json?v=" + Date.now())
.then(function (res) { return res.json(); })
.then(function (json) {
data = json;
populateForm();
})
.catch(function (err) {
showLoadError("Could not load crissy-data.json. Serve this directory from a local web server (e.g. python3 -m http.server 8000). Error: " + err.message);
});
} else {
showLoadError("Could not load crissy-data.json (status " + xhr.status + "). Serve this directory from a local web server.");
}
}
}
};
xhr.send();
}
function showLoadError(msg) {
var out = document.getElementById("output-area");
out.style.display = "block";
out.textContent = msg;
}
function populateForm() {
if (!data) return;
document.getElementById("site-title").value = data.site ? data.site.title || "" : "";
document.getElementById("notice-text").value = data.notice ? data.notice.text || "" : "";
document.getElementById("notice-link").value = data.notice ? data.notice.link || "" : "";
document.getElementById("notice-updated").value = data.notice ? data.notice.updated || "" : "";
document.getElementById("info-name").value = data.info ? data.info.name || "" : "";
document.getElementById("info-email").value = data.info ? data.info.email || "" : "";
document.getElementById("info-bio").value = data.info ? data.info.bio || "" : "";
// Show portfolio image preview if one exists
showImagePreview(data.site && data.site.image ? data.site.image : "");
// Populate image settings
if (data.site) {
var hasBorder = data.site.imageBorder !== false;
document.getElementById("image-border-toggle").checked = hasBorder;
var borderColor = data.site.imageBorderColor || "#ffffff";
document.getElementById("image-border-color").value = borderColor;
document.getElementById("image-border-color-text").value = borderColor;
var imgSize = data.site.imageSize || "medium";
document.getElementById("image-size").value = imgSize;
}
renderSkills();
renderProjects();
renderLinks();
renderSocials();
renderColors();
renderOutputFiles();
// Populate support link
if (data.supportLink) {
document.getElementById("support-label").value = data.supportLink.label || "";
document.getElementById("support-url").value = data.supportLink.url || "";
}
// Populate education
if (data.education) {
document.getElementById("edu-show-toggle").checked = !!data.education.showOnPortfolio;
document.getElementById("edu-summary").value = data.education.summary || "";
}
}
/* ---- Skills ---- */
function renderSkills() {
var el = document.getElementById("skills-display");
if (!data.info || !data.info.skills) { el.innerHTML = ""; return; }
var html = "";
for (var i = 0; i < data.info.skills.length; i++) {
html += '<span onclick="removeSkill(' + i + ')">' + esc(data.info.skills[i]) + ' x</span>';
}
el.innerHTML = html;
}
function addSkill() {
var input = document.getElementById("skill-input");
var val = input.value.trim();
if (!val) return;
if (!data.info) data.info = {};
if (!data.info.skills) data.info.skills = [];
data.info.skills.push(val);
input.value = "";
renderSkills();
}
function removeSkill(idx) {
data.info.skills.splice(idx, 1);
renderSkills();
}
/* ---- Projects ---- */
function renderProjects() {
var el = document.getElementById("projects-list");
if (!data.projects) { el.innerHTML = ""; return; }
var html = "";
for (var i = 0; i < data.projects.length; i++) {
var p = data.projects[i];
var orderVal = (typeof p.displayOrder === "number") ? p.displayOrder : (i + 1);
html += '<div class="item-block">';
html += '<div class="item-header"><strong>' + esc(p.title || "Untitled") + '</strong>';
html += '<div style="display:flex;gap:0.25rem;align-items:center;">';
html += '<button onclick="moveProject(' + i + ', -1)" title="Move Up" style="padding:0.25rem 0.5rem;font-size:0.8rem;">Up</button>';
html += '<button onclick="moveProject(' + i + ', 1)" title="Move Down" style="padding:0.25rem 0.5rem;font-size:0.8rem;">Down</button>';
html += '<span style="font-size:0.75rem;color:#666;margin:0 0.25rem;">Order: ' + orderVal + '</span>';
html += '<button class="danger" onclick="removeProject(' + i + ')">Remove</button>';
html += '</div></div>';
html += '<label>Title</label><input type="text" id="proj-title-' + i + '" value="' + escAttr(p.title) + '" onchange="data.projects[' + i + '].title=this.value">';
html += '<label>Description</label>';
html += '<div class="ai-row">';
html += '<textarea id="proj-desc-' + i + '" onchange="data.projects[' + i + '].description=this.value">' + esc(p.description) + '</textarea>';
html += '<button class="ai-btn" onclick="togglePromptBox(\'proj-desc-ai-' + i + '\')">Generate</button>';
html += '</div>';
html += '<div class="ai-prompt-box" id="proj-desc-ai-' + i + '">';
html += '<label>Prompt</label>';
html += '<textarea id="proj-desc-ai-' + i + '-prompt" placeholder="Describe this project for the AI..."></textarea>';
html += '<div class="ai-prompt-actions">';
html += '<button class="ai-btn" onclick="aiGenerate(\'proj-desc-ai-' + i + '\', \'proj-desc-' + i + '\', ' + i + ')">Generate Content</button>';
html += '<span class="ai-status" id="proj-desc-ai-' + i + '-status"></span>';
html += '</div></div>';
html += '<label>URL</label><input type="text" value="' + escAttr(p.url) + '" onchange="data.projects[' + i + '].url=this.value">';
html += '<label>Tags (comma separated)</label><input type="text" value="' + escAttr((p.tags || []).join(", ")) + '" onchange="data.projects[' + i + '].tags=this.value.split(\',\').map(function(s){return s.trim()}).filter(Boolean)">';
html += '<label>Display Order</label><input type="text" value="' + orderVal + '" style="width:60px;" onchange="data.projects[' + i + '].displayOrder=parseInt(this.value)||' + (i + 1) + '">';
html += '</div>';
}
el.innerHTML = html;
}
function moveProject(idx, direction) {
if (!data.projects) return;
var newIdx = idx + direction;
if (newIdx < 0 || newIdx >= data.projects.length) return;
var temp = data.projects[idx];
data.projects[idx] = data.projects[newIdx];
data.projects[newIdx] = temp;
/* Update displayOrder to reflect new positions */
for (var i = 0; i < data.projects.length; i++) {
data.projects[i].displayOrder = i + 1;
}
renderProjects();
}
function addProject() {
if (!data.projects) data.projects = [];
var nextId = data.projects.length ? Math.max.apply(null, data.projects.map(function(p){return p.id||0})) + 1 : 1;
var nextOrder = data.projects.length + 1;
data.projects.push({ id: nextId, displayOrder: nextOrder, title: "", description: "", url: "", tags: [] });
renderProjects();
}
function removeProject(idx) {
data.projects.splice(idx, 1);
renderProjects();
}
/* ---- Links ---- */
function renderLinks() {
var el = document.getElementById("links-list");
if (!data.links) { el.innerHTML = ""; return; }
var html = "";
for (var i = 0; i < data.links.length; i++) {
var lnk = data.links[i];
html += '<div class="item-block">';
html += '<div class="item-header"><strong>' + esc(lnk.label || "Untitled") + '</strong>';
html += '<button class="danger" onclick="removeLink(' + i + ')">Remove</button></div>';
html += '<label>Label</label><input type="text" value="' + escAttr(lnk.label) + '" onchange="data.links[' + i + '].label=this.value">';
html += '<label>URL</label><input type="text" value="' + escAttr(lnk.url) + '" onchange="data.links[' + i + '].url=this.value">';
html += '</div>';
}
el.innerHTML = html;
}
function addLink() {
if (!data.links) data.links = [];
data.links.push({ label: "", url: "" });
renderLinks();
}
function removeLink(idx) {
data.links.splice(idx, 1);
renderLinks();
}
/* ---- Social Links ---- */
function renderSocials() {
var el = document.getElementById("socials-list");
if (!data.socials) { el.innerHTML = ""; return; }
var platforms = ["LinkedIn", "YouTube", "GitHub", "Twitter / X", "Instagram", "Facebook", "Mastodon", "Bluesky", "Twitch", "Discord", "Reddit", "TikTok", "Other"];
var html = "";
for (var i = 0; i < data.socials.length; i++) {
var s = data.socials[i];
html += '<div class="item-block">';
html += '<div class="item-header"><strong>' + esc(s.platform || "Social") + '</strong>';
html += '<button class="danger" onclick="removeSocial(' + i + ')">Remove</button></div>';
html += '<label>Platform</label>';
html += '<select onchange="data.socials[' + i + '].platform=this.value">';
for (var p = 0; p < platforms.length; p++) {
html += '<option value="' + escAttr(platforms[p]) + '"' + (s.platform === platforms[p] ? ' selected' : '') + '>' + esc(platforms[p]) + '</option>';
}
html += '</select>';
html += '<label>URL</label><input type="text" value="' + escAttr(s.url) + '" onchange="data.socials[' + i + '].url=this.value">';
html += '</div>';
}
el.innerHTML = html;
}
function addSocial() {
if (!data.socials) data.socials = [];
data.socials.push({ platform: "LinkedIn", url: "" });
renderSocials();
}
function removeSocial(idx) {
data.socials.splice(idx, 1);
renderSocials();
}
/* ---- Colors ---- */
function renderColors() {
var el = document.getElementById("color-fields");
if (!data.styles) { el.innerHTML = ""; return; }
var colors = ["primary", "secondary", "accent", "text", "background"];
var html = "";
for (var i = 0; i < colors.length; i++) {
var key = colors[i];
var val = data.styles[key] || "#000000";
html += '<div class="color-row">';
html += '<label>' + key + '</label>';
html += '<input type="color" value="' + val + '" onchange="updateColor(\'' + key + '\', this.value)">';
html += '<input type="text" value="' + val + '" id="color-text-' + key + '" onchange="updateColor(\'' + key + '\', this.value)">';
html += '</div>';
}
// Harmony colors
if (data.styles.harmony) {
for (var h = 0; h < data.styles.harmony.length; h++) {
var hval = data.styles.harmony[h];
html += '<div class="color-row">';
html += '<label>harmony ' + (h + 1) + '</label>';
html += '<input type="color" value="' + hval + '" onchange="updateHarmony(' + h + ', this.value)">';
html += '<input type="text" value="' + hval + '" id="color-text-harmony-' + h + '" onchange="updateHarmony(' + h + ', this.value)">';
html += '</div>';
}
}
el.innerHTML = html;
}
function updateColor(key, val) {
data.styles[key] = val;
renderColors();
}
function updateHarmony(idx, val) {
data.styles.harmony[idx] = val;
renderColors();
}
/* ---- Output Files ---- */
function renderOutputFiles() {
var el = document.getElementById("output-files-list");
if (!data.site || !data.site.outputFiles) { el.innerHTML = ""; return; }
var html = '<div class="tags-display">';
for (var i = 0; i < data.site.outputFiles.length; i++) {
html += '<span onclick="removeOutputFile(' + i + ')">' + esc(data.site.outputFiles[i]) + ' x</span>';
}
html += '</div>';
el.innerHTML = html;
}
function addOutputFile() {
var input = document.getElementById("output-file-input");
var val = input.value.trim();