@leadertechie/personal-site-kit 0.1.0-alpha.5 → 0.1.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/auth-handler.ts"],"names":[],"mappings":"AAkBA,wBAAsB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkC/F"}
1
+ {"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/auth-handler.ts"],"names":[],"mappings":"AA0BA,wBAAsB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiC/F"}
@@ -1 +1 @@
1
- {"version":3,"file":"website-api.d.ts","sourceRoot":"","sources":["../../src/api/website-api.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3E,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAiC;IAEhD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAIzD,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,UAAU;IAYL,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAkFlE"}
1
+ {"version":3,"file":"website-api.d.ts","sourceRoot":"","sources":["../../src/api/website-api.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3E,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAiC;IAEhD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAIzD,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,UAAU;IAgBL,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAmFlE"}
package/dist/api.js CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WebsiteAPI } from "./chunks/website-api-DI3muo2s.js";
2
- import { A, B, M, R, c, a, g, b, d, h, e, r, s, v } from "./chunks/website-api-DI3muo2s.js";
1
+ import { W as WebsiteAPI } from "./chunks/website-api-XoeLwo_N.js";
2
+ import { A, B, M, R, c, a, g, b, d, h, e, r, s, v } from "./chunks/website-api-XoeLwo_N.js";
3
3
  const defaultAPI = new WebsiteAPI();
4
4
  export {
5
5
  A as AUTH_KV,
@@ -86,7 +86,22 @@ const aboutmeStyles = css`
86
86
  `;
87
87
  class AboutMeRenderer {
88
88
  renderContent(nodes) {
89
- return nodes;
89
+ return (nodes || []).map((node) => {
90
+ switch (node.type) {
91
+ case "heading":
92
+ const level = node.level || 2;
93
+ if (level === 1) return html`<h1>${node.content}</h1>`;
94
+ if (level === 3) return html`<h3>${node.content}</h3>`;
95
+ return html`<h2>${node.content}</h2>`;
96
+ case "paragraph":
97
+ return html`<p>${node.content}</p>`;
98
+ case "list":
99
+ const items = node.items || [];
100
+ return html`<ul>${items.map((item) => html`<li>${item}</li>`)}</ul>`;
101
+ default:
102
+ return html`<div>${node.content}</div>`;
103
+ }
104
+ });
90
105
  }
91
106
  }
92
107
  async function fetchAboutMe(url) {
@@ -167,10 +182,7 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
167
182
  this.loading = false;
168
183
  return;
169
184
  }
170
- const url = this.apiBaseUrl;
171
- if (url) {
172
- this.loadContent();
173
- }
185
+ this.loadContent();
174
186
  }
175
187
  updated(changedProperties) {
176
188
  super.updated(changedProperties);
@@ -178,17 +190,20 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
178
190
  return;
179
191
  }
180
192
  if (changedProperties.has("baseUrl") || changedProperties.has("base-url")) {
181
- const url = this.apiBaseUrl;
182
- if (url) {
183
- this.loadContent();
184
- }
193
+ this.loadContent();
185
194
  }
186
195
  }
187
196
  async loadContent() {
197
+ const url = this.apiBaseUrl;
198
+ if (!url) {
199
+ this.loading = false;
200
+ this.setFallbackContent();
201
+ return;
202
+ }
188
203
  try {
189
204
  this.loading = true;
190
- const url = this.apiBaseUrl;
191
- const data = await this.fetcher(url);
205
+ const url2 = this.apiBaseUrl;
206
+ const data = await this.fetcher(url2);
192
207
  this.profile = data.profile;
193
208
  this.contentNodes = data.contentNodes;
194
209
  this.loading = false;
@@ -202,9 +217,17 @@ class MyAboutme extends (_a$5 = LitElement, _baseUrl_dec = [property({ type: Str
202
217
  setFallbackContent() {
203
218
  this.profile = null;
204
219
  this.contentNodes = [
220
+ {
221
+ type: "heading",
222
+ content: "Profile Not Found"
223
+ },
224
+ {
225
+ type: "paragraph",
226
+ content: "Your about-me profile has not been initialized yet. Please run the seed command to get started:"
227
+ },
205
228
  {
206
229
  type: "paragraph",
207
- content: "Unable to Load Content"
230
+ content: "npm run seed -- <username> <password>"
208
231
  }
209
232
  ];
210
233
  }
@@ -564,38 +587,151 @@ var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "rea
564
587
  var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
565
588
  var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
566
589
  var __privateMethod$3 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
567
- var _staticDetails_dec, _activeSection_dec, _statusMessage_dec, _contentList_dec, _isAuthenticated_dec, _apiKey_dec, _a$4, _AdminPortal_decorators, _init$4, _apiKey, _isAuthenticated, _contentList, _statusMessage, _activeSection, _staticDetails;
568
- console.log("[AdminPortal] Module loading");
569
- console.log("[AdminPortal] About to define custom element");
590
+ var _loginError_dec, _staticDetails_dec, _activeSection_dec, _statusMessage_dec, _contentList_dec, _isLoading_dec, _isSetup_dec, _isAuthenticated_dec, _a$4, _AdminPortal_decorators, _init$4, _isAuthenticated, _isSetup, _isLoading, _contentList, _statusMessage, _activeSection, _staticDetails, _loginError;
570
591
  _AdminPortal_decorators = [customElement("admin-portal")];
571
- class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthenticated_dec = [state()], _contentList_dec = [state()], _statusMessage_dec = [state()], _activeSection_dec = [state()], _staticDetails_dec = [state()], _a$4) {
592
+ class AdminPortal extends (_a$4 = LitElement, _isAuthenticated_dec = [state()], _isSetup_dec = [state()], _isLoading_dec = [state()], _contentList_dec = [state()], _statusMessage_dec = [state()], _activeSection_dec = [state()], _staticDetails_dec = [state()], _loginError_dec = [state()], _a$4) {
572
593
  constructor() {
573
594
  super(...arguments);
574
- __privateAdd$3(this, _apiKey, __runInitializers$4(_init$4, 8, this, "")), __runInitializers$4(_init$4, 11, this);
575
- __privateAdd$3(this, _isAuthenticated, __runInitializers$4(_init$4, 12, this, false)), __runInitializers$4(_init$4, 15, this);
576
- __privateAdd$3(this, _contentList, __runInitializers$4(_init$4, 16, this, [])), __runInitializers$4(_init$4, 19, this);
577
- __privateAdd$3(this, _statusMessage, __runInitializers$4(_init$4, 20, this, "")), __runInitializers$4(_init$4, 23, this);
578
- __privateAdd$3(this, _activeSection, __runInitializers$4(_init$4, 24, this, "profile")), __runInitializers$4(_init$4, 27, this);
579
- __privateAdd$3(this, _staticDetails, __runInitializers$4(_init$4, 28, this, {})), __runInitializers$4(_init$4, 31, this);
595
+ __privateAdd$3(this, _isAuthenticated, __runInitializers$4(_init$4, 8, this, false)), __runInitializers$4(_init$4, 11, this);
596
+ __privateAdd$3(this, _isSetup, __runInitializers$4(_init$4, 12, this, false)), __runInitializers$4(_init$4, 15, this);
597
+ __privateAdd$3(this, _isLoading, __runInitializers$4(_init$4, 16, this, true)), __runInitializers$4(_init$4, 19, this);
598
+ __privateAdd$3(this, _contentList, __runInitializers$4(_init$4, 20, this, [])), __runInitializers$4(_init$4, 23, this);
599
+ __privateAdd$3(this, _statusMessage, __runInitializers$4(_init$4, 24, this, "")), __runInitializers$4(_init$4, 27, this);
600
+ __privateAdd$3(this, _activeSection, __runInitializers$4(_init$4, 28, this, "profile")), __runInitializers$4(_init$4, 31, this);
601
+ __privateAdd$3(this, _staticDetails, __runInitializers$4(_init$4, 32, this, {})), __runInitializers$4(_init$4, 35, this);
602
+ __privateAdd$3(this, _loginError, __runInitializers$4(_init$4, 36, this, "")), __runInitializers$4(_init$4, 39, this);
580
603
  }
581
604
  get apiUrl() {
582
605
  return window.__VITE_API_URL__ || void 0 || "http://localhost:8787";
583
606
  }
584
- handleLogin(e2) {
607
+ async connectedCallback() {
608
+ super.connectedCallback();
609
+ await this.checkAuthStatus();
610
+ }
611
+ async checkAuthStatus() {
612
+ try {
613
+ const res = await fetch(`${this.apiUrl}/auth/status`, {
614
+ credentials: "include"
615
+ });
616
+ if (res.ok) {
617
+ const status = await res.json();
618
+ this.isSetup = status.configured;
619
+ if (status.configured) {
620
+ await this.tryAutoLogin();
621
+ } else {
622
+ this.isLoading = false;
623
+ }
624
+ } else {
625
+ this.isSetup = false;
626
+ this.isLoading = false;
627
+ }
628
+ } catch (e2) {
629
+ this.isSetup = false;
630
+ this.isLoading = false;
631
+ }
632
+ }
633
+ async tryAutoLogin() {
634
+ try {
635
+ const res = await fetch(`${this.apiUrl}/content`, {
636
+ credentials: "include"
637
+ });
638
+ if (res.ok) {
639
+ this.contentList = await res.json();
640
+ this.isAuthenticated = true;
641
+ }
642
+ } catch (e2) {
643
+ }
644
+ this.isLoading = false;
645
+ }
646
+ async handleLogin(e2) {
585
647
  e2.preventDefault();
586
- const input = this.shadowRoot?.querySelector("#apiKey");
587
- if (input.value) {
588
- this.apiKey = input.value;
589
- this.isAuthenticated = true;
590
- this.fetchContent();
648
+ this.loginError = "";
649
+ const usernameInput = this.shadowRoot?.querySelector("#username");
650
+ const passwordInput = this.shadowRoot?.querySelector("#password");
651
+ if (!usernameInput?.value || !passwordInput?.value) {
652
+ this.loginError = "Username and password required";
653
+ return;
654
+ }
655
+ try {
656
+ const res = await fetch(`${this.apiUrl}/auth/login`, {
657
+ method: "POST",
658
+ credentials: "include",
659
+ headers: { "Content-Type": "application/json" },
660
+ body: JSON.stringify({
661
+ username: usernameInput.value,
662
+ password: passwordInput.value
663
+ })
664
+ });
665
+ if (res.ok) {
666
+ this.isAuthenticated = true;
667
+ await this.fetchContent();
668
+ } else {
669
+ const data = await res.json();
670
+ this.loginError = data.error || "Login failed";
671
+ }
672
+ } catch (e22) {
673
+ this.loginError = "Connection error";
591
674
  }
592
675
  }
676
+ async handleSetup(e2) {
677
+ e2.preventDefault();
678
+ this.loginError = "";
679
+ const usernameInput = this.shadowRoot?.querySelector("#username");
680
+ const passwordInput = this.shadowRoot?.querySelector("#password");
681
+ const confirmInput = this.shadowRoot?.querySelector("#confirmPassword");
682
+ if (!usernameInput?.value || !passwordInput?.value) {
683
+ this.loginError = "Username and password required";
684
+ return;
685
+ }
686
+ if (usernameInput.value.length < 3) {
687
+ this.loginError = "Username must be at least 3 characters";
688
+ return;
689
+ }
690
+ if (passwordInput.value.length < 8) {
691
+ this.loginError = "Password must be at least 8 characters";
692
+ return;
693
+ }
694
+ if (passwordInput.value !== confirmInput?.value) {
695
+ this.loginError = "Passwords do not match";
696
+ return;
697
+ }
698
+ try {
699
+ const res = await fetch(`${this.apiUrl}/auth/setup`, {
700
+ method: "POST",
701
+ credentials: "include",
702
+ headers: { "Content-Type": "application/json" },
703
+ body: JSON.stringify({
704
+ username: usernameInput.value,
705
+ password: passwordInput.value
706
+ })
707
+ });
708
+ if (res.ok) {
709
+ this.isAuthenticated = true;
710
+ this.isSetup = true;
711
+ await this.fetchContent();
712
+ } else {
713
+ const data = await res.json();
714
+ this.loginError = data.error || "Setup failed";
715
+ }
716
+ } catch (e22) {
717
+ this.loginError = "Connection error";
718
+ }
719
+ }
720
+ async handleLogout() {
721
+ try {
722
+ await fetch(`${this.apiUrl}/auth/logout`, {
723
+ method: "POST",
724
+ credentials: "include"
725
+ });
726
+ } catch (e2) {
727
+ }
728
+ this.isAuthenticated = false;
729
+ this.contentList = [];
730
+ }
593
731
  async fetchContent() {
594
732
  try {
595
733
  const res = await fetch(`${this.apiUrl}/content`, {
596
- headers: {
597
- "Authorization": `Bearer ${this.apiKey}`
598
- }
734
+ credentials: "include"
599
735
  });
600
736
  if (res.ok) {
601
737
  this.contentList = await res.json();
@@ -608,7 +744,9 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
608
744
  }
609
745
  async fetchStaticDetails() {
610
746
  try {
611
- const res = await fetch(`${this.apiUrl}/api/static`);
747
+ const res = await fetch(`${this.apiUrl}/static`, {
748
+ credentials: "include"
749
+ });
612
750
  if (res.ok) {
613
751
  this.staticDetails = await res.json();
614
752
  }
@@ -620,9 +758,7 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
620
758
  this.statusMessage = "Uploading...";
621
759
  const res = await fetch(`${this.apiUrl}/content/${key}`, {
622
760
  method: "PUT",
623
- headers: {
624
- "Authorization": `Bearer ${this.apiKey}`
625
- },
761
+ credentials: "include",
626
762
  body: file
627
763
  });
628
764
  if (res.ok) {
@@ -640,9 +776,7 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
640
776
  this.statusMessage = "Clearing cache...";
641
777
  const res = await fetch(`${this.apiUrl}/cache-clear`, {
642
778
  method: "POST",
643
- headers: {
644
- "Authorization": `Bearer ${this.apiKey}`
645
- }
779
+ credentials: "include"
646
780
  });
647
781
  if (res.ok) {
648
782
  this.statusMessage = "Cache cleared!";
@@ -658,9 +792,7 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
658
792
  try {
659
793
  const res = await fetch(`${this.apiUrl}/content/${key}`, {
660
794
  method: "DELETE",
661
- headers: {
662
- "Authorization": `Bearer ${this.apiKey}`
663
- }
795
+ credentials: "include"
664
796
  });
665
797
  if (res.ok) {
666
798
  this.fetchContent();
@@ -677,6 +809,39 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
677
809
  getSectionFiles(prefix) {
678
810
  return this.contentList.filter((c2) => c2.key.startsWith(prefix));
679
811
  }
812
+ renderLoginForm() {
813
+ return html`
814
+ <div class="container">
815
+ <div class="login-box">
816
+ <h2>Admin Setup</h2>
817
+ <p>Create your admin credentials</p>
818
+ <form @submit=${this.handleSetup}>
819
+ <input type="text" id="username" placeholder="Username (3+ chars)" />
820
+ <input type="password" id="password" placeholder="Password (8+ chars)" />
821
+ <input type="password" id="confirmPassword" placeholder="Confirm Password" />
822
+ ${this.loginError ? html`<div class="error-message">${this.loginError}</div>` : ""}
823
+ <button type="submit" class="btn-primary">Create Account</button>
824
+ </form>
825
+ </div>
826
+ </div>
827
+ `;
828
+ }
829
+ renderLogin() {
830
+ return html`
831
+ <div class="container">
832
+ <div class="login-box">
833
+ <h2>Admin Login</h2>
834
+ <p>Enter your credentials</p>
835
+ <form @submit=${this.handleLogin}>
836
+ <input type="text" id="username" placeholder="Username" autocomplete="username" />
837
+ <input type="password" id="password" placeholder="Password" autocomplete="current-password" />
838
+ ${this.loginError ? html`<div class="error-message">${this.loginError}</div>` : ""}
839
+ <button type="submit" class="btn-primary">Login</button>
840
+ </form>
841
+ </div>
842
+ </div>
843
+ `;
844
+ }
680
845
  renderHomeSection() {
681
846
  const home = this.getContent("home.md");
682
847
  return html`
@@ -875,67 +1040,6 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
875
1040
  </div>
876
1041
  `;
877
1042
  }
878
- render() {
879
- if (!this.isAuthenticated) {
880
- return html`
881
- <div class="container">
882
- <div class="login-box">
883
- <h2>Admin Login</h2>
884
- <p>Enter your API key to manage content</p>
885
- <form @submit=${this.handleLogin}>
886
- <input type="password" id="apiKey" placeholder="API Key" />
887
- <button type="submit" class="btn-primary">Login</button>
888
- </form>
889
- </div>
890
- </div>
891
- `;
892
- }
893
- return html`
894
- <div class="container">
895
- <div class="header">
896
- <h1>Content Manager</h1>
897
- <button class="btn-secondary" @click=${() => this.handleClearCache()}>Clear Cache</button>
898
- </div>
899
-
900
- <div class="nav-tabs">
901
- <button class="nav-tab ${this.activeSection === "home" ? "active" : ""}"
902
- @click=${() => this.activeSection = "home"}>Home</button>
903
- <button class="nav-tab ${this.activeSection === "profile" ? "active" : ""}"
904
- @click=${() => this.activeSection = "profile"}>Profile</button>
905
- <button class="nav-tab ${this.activeSection === "aboutme" ? "active" : ""}"
906
- @click=${() => this.activeSection = "aboutme"}>About Me</button>
907
- <button class="nav-tab ${this.activeSection === "blogs" ? "active" : ""}"
908
- @click=${() => this.activeSection = "blogs"}>Blogs</button>
909
- <button class="nav-tab ${this.activeSection === "stories" ? "active" : ""}"
910
- @click=${() => this.activeSection = "stories"}>Stories</button>
911
- <button class="nav-tab ${this.activeSection === "images" ? "active" : ""}"
912
- @click=${() => this.activeSection = "images"}>Images</button>
913
- <button class="nav-tab ${this.activeSection === "logo" ? "active" : ""}"
914
- @click=${() => this.activeSection = "logo"}>Logo</button>
915
- <button class="nav-tab ${this.activeSection === "static" ? "active" : ""}"
916
- @click=${() => {
917
- this.activeSection = "static";
918
- this.fetchStaticDetails();
919
- }}>Site Settings</button>
920
- </div>
921
-
922
- ${this.statusMessage ? html`
923
- <div class="status-message ${this.statusMessage.includes("successful") || this.statusMessage.includes("cleared") ? "success" : this.statusMessage.includes("failed") || this.statusMessage.includes("Error") ? "error" : ""}">
924
- ${this.statusMessage}
925
- </div>
926
- ` : ""}
927
-
928
- ${this.activeSection === "home" ? this.renderHomeSection() : ""}
929
- ${this.activeSection === "profile" ? this.renderProfileSection() : ""}
930
- ${this.activeSection === "aboutme" ? this.renderAboutMeSection() : ""}
931
- ${this.activeSection === "blogs" ? this.renderBlogsSection() : ""}
932
- ${this.activeSection === "stories" ? this.renderStoriesSection() : ""}
933
- ${this.activeSection === "images" ? this.renderImagesSection() : ""}
934
- ${this.activeSection === "logo" ? this.renderLogoSection() : ""}
935
- ${this.activeSection === "static" ? this.renderStaticSection() : ""}
936
- </div>
937
- `;
938
- }
939
1043
  renderStaticSection() {
940
1044
  return html`
941
1045
  <div class="section">
@@ -983,7 +1087,8 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
983
1087
  const url = `${this.apiUrl}/content/staticdetails.json`;
984
1088
  const res = await fetch(url, {
985
1089
  method: "PUT",
986
- headers: { "Authorization": `Bearer ${this.apiKey}`, "Content-Type": "application/json" },
1090
+ credentials: "include",
1091
+ headers: { "Content-Type": "application/json" },
987
1092
  body: JSON.stringify(data)
988
1093
  });
989
1094
  if (res.ok) {
@@ -999,20 +1104,81 @@ class AdminPortal extends (_a$4 = LitElement, _apiKey_dec = [state()], _isAuthen
999
1104
  </div>
1000
1105
  `;
1001
1106
  }
1107
+ render() {
1108
+ if (this.isLoading) {
1109
+ return html`<div class="container"><div class="loading">Loading...</div></div>`;
1110
+ }
1111
+ if (!this.isSetup) {
1112
+ return this.renderLoginForm();
1113
+ }
1114
+ if (!this.isAuthenticated) {
1115
+ return this.renderLogin();
1116
+ }
1117
+ return html`
1118
+ <div class="container">
1119
+ <div class="header">
1120
+ <h1>Content Manager</h1>
1121
+ <button class="btn-secondary" @click=${() => this.handleLogout()}>Logout</button>
1122
+ <button class="btn-secondary" @click=${() => this.handleClearCache()}>Clear Cache</button>
1123
+ </div>
1124
+
1125
+ <div class="nav-tabs">
1126
+ <button class="nav-tab ${this.activeSection === "home" ? "active" : ""}"
1127
+ @click=${() => this.activeSection = "home"}>Home</button>
1128
+ <button class="nav-tab ${this.activeSection === "profile" ? "active" : ""}"
1129
+ @click=${() => this.activeSection = "profile"}>Profile</button>
1130
+ <button class="nav-tab ${this.activeSection === "aboutme" ? "active" : ""}"
1131
+ @click=${() => this.activeSection = "aboutme"}>About Me</button>
1132
+ <button class="nav-tab ${this.activeSection === "blogs" ? "active" : ""}"
1133
+ @click=${() => this.activeSection = "blogs"}>Blogs</button>
1134
+ <button class="nav-tab ${this.activeSection === "stories" ? "active" : ""}"
1135
+ @click=${() => this.activeSection = "stories"}>Stories</button>
1136
+ <button class="nav-tab ${this.activeSection === "images" ? "active" : ""}"
1137
+ @click=${() => this.activeSection = "images"}>Images</button>
1138
+ <button class="nav-tab ${this.activeSection === "logo" ? "active" : ""}"
1139
+ @click=${() => this.activeSection = "logo"}>Logo</button>
1140
+ <button class="nav-tab ${this.activeSection === "static" ? "active" : ""}"
1141
+ @click=${() => {
1142
+ this.activeSection = "static";
1143
+ this.fetchStaticDetails();
1144
+ }}>Site Settings</button>
1145
+ </div>
1146
+
1147
+ ${this.statusMessage ? html`
1148
+ <div class="status-message ${this.statusMessage.includes("successful") || this.statusMessage.includes("cleared") ? "success" : this.statusMessage.includes("failed") || this.statusMessage.includes("Error") ? "error" : ""}">
1149
+ ${this.statusMessage}
1150
+ </div>
1151
+ ` : ""}
1152
+
1153
+ ${this.activeSection === "home" ? this.renderHomeSection() : ""}
1154
+ ${this.activeSection === "profile" ? this.renderProfileSection() : ""}
1155
+ ${this.activeSection === "aboutme" ? this.renderAboutMeSection() : ""}
1156
+ ${this.activeSection === "blogs" ? this.renderBlogsSection() : ""}
1157
+ ${this.activeSection === "stories" ? this.renderStoriesSection() : ""}
1158
+ ${this.activeSection === "images" ? this.renderImagesSection() : ""}
1159
+ ${this.activeSection === "logo" ? this.renderLogoSection() : ""}
1160
+ ${this.activeSection === "static" ? this.renderStaticSection() : ""}
1161
+ </div>
1162
+ `;
1163
+ }
1002
1164
  }
1003
1165
  _init$4 = __decoratorStart$4(_a$4);
1004
- _apiKey = /* @__PURE__ */ new WeakMap();
1005
1166
  _isAuthenticated = /* @__PURE__ */ new WeakMap();
1167
+ _isSetup = /* @__PURE__ */ new WeakMap();
1168
+ _isLoading = /* @__PURE__ */ new WeakMap();
1006
1169
  _contentList = /* @__PURE__ */ new WeakMap();
1007
1170
  _statusMessage = /* @__PURE__ */ new WeakMap();
1008
1171
  _activeSection = /* @__PURE__ */ new WeakMap();
1009
1172
  _staticDetails = /* @__PURE__ */ new WeakMap();
1010
- __decorateElement$4(_init$4, 4, "apiKey", _apiKey_dec, AdminPortal, _apiKey);
1173
+ _loginError = /* @__PURE__ */ new WeakMap();
1011
1174
  __decorateElement$4(_init$4, 4, "isAuthenticated", _isAuthenticated_dec, AdminPortal, _isAuthenticated);
1175
+ __decorateElement$4(_init$4, 4, "isSetup", _isSetup_dec, AdminPortal, _isSetup);
1176
+ __decorateElement$4(_init$4, 4, "isLoading", _isLoading_dec, AdminPortal, _isLoading);
1012
1177
  __decorateElement$4(_init$4, 4, "contentList", _contentList_dec, AdminPortal, _contentList);
1013
1178
  __decorateElement$4(_init$4, 4, "statusMessage", _statusMessage_dec, AdminPortal, _statusMessage);
1014
1179
  __decorateElement$4(_init$4, 4, "activeSection", _activeSection_dec, AdminPortal, _activeSection);
1015
1180
  __decorateElement$4(_init$4, 4, "staticDetails", _staticDetails_dec, AdminPortal, _staticDetails);
1181
+ __decorateElement$4(_init$4, 4, "loginError", _loginError_dec, AdminPortal, _loginError);
1016
1182
  AdminPortal = __decorateElement$4(_init$4, 0, "AdminPortal", _AdminPortal_decorators, AdminPortal);
1017
1183
  AdminPortal.styles = adminStyles;
1018
1184
  __runInitializers$4(_init$4, 1, AdminPortal);
@@ -14,7 +14,8 @@ const DEFAULT_STATIC = {
14
14
  let activeConfig = { ...DEFAULT_INFRA, ...DEFAULT_STATIC };
15
15
  async function initializeConfig(infra) {
16
16
  if (infra) {
17
- activeConfig = { ...activeConfig, ...infra };
17
+ if (infra.baseUrl) activeConfig.baseUrl = infra.baseUrl;
18
+ if (infra.apiUrl) activeConfig.apiUrl = infra.apiUrl;
18
19
  }
19
20
  try {
20
21
  const res = await fetch(`${activeConfig.apiUrl}/api/static`);