changeset 117:b91f2dd6f84d

[PostDog] Fixed delete logic.
author June Park <parkjune1995@gmail.com>
date Wed, 07 Jan 2026 05:02:45 -0800
parents 7bd795bac997
children 249881ceff7b
files postdog/history/d8ff107c-856d-e516-4863-53fe587855eb.txt postdog/history/fca62761-983e-c04b-2f77-c3bfde99f400.txt postdog/history/test.txt postdog/main.c previous.c
diffstat 5 files changed, 17 insertions(+), 761 deletions(-) [+]
line wrap: on
line diff
--- a/postdog/history/d8ff107c-856d-e516-4863-53fe587855eb.txt	Wed Jan 07 04:52:17 2026 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-https:/mrjunejune.com
----
-GET
----
-Content-Type: application/json
----
-
----
-HTTP Status: 200
-
-<!doctype html>
-<html lang="en">
-  <head>
-    <title> MrJuneJune </title>
-    <meta charset="UTF-8">
-<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<link rel="icon" type="image/svg+xml" href="/public/epi_all_colors.svg">
-
-<link rel="preload" href="/public/fonts/Roboto-Regular.ttf" as="font"  crossorigin>
-<link rel="preload" href="/public/fonts/Roboto-Thin.ttf"as="font" crossorigin>
-
-<link rel="preload" href="/public/fonts/atkinson-regular.woff" as="font" type="font/woff" crossorigin>
-<link rel="preload" href="/public/fonts/atkinson-bold.woff" as="font" type="font/woff" crossorigin>
-
-<link rel="preload" href="/public/fonts/more-sugar.extras.otf" as="font" type="font/otf" crossorigin>
-<link rel="preload" href="/public/fonts/more-sugar.regular.otf" as="font" type="font/otf" crossorigin>
-<link rel="preload" href="/public/fonts/more-sugar.thin.otf" as="font" type="font/otf" crossorigin>
-
-<link rel="preload" href="/base.css" as="style" />
-<link rel="stylesheet" href="/base.css" />
-
-
-    <style>
-      .epi-photo {
-        display: flex;
-        justify-content: center;
-        margin-bottom: 10px;
-      }
-
-      .epi-photo img {
-        max-width: 100%;
-        height: auto;
-        border-radius: 8px;
-      }
-
-      @media (max-width: 720px) {
-        .epi-photo {
-          margin-bottom: 1.5em;
-        }
-
-        ul {
-          padding-left: 1.5em;
-        }
-
-        li {
-          margin-bottom: 0.75em;
-        }
-      }
-    </style>
-  </head>
-  <body>
-     <style>
-  :root {
-    --header-background: var(--white);
-    --header-color: rgb(var(--black));
-    --link-hover-accent: var(--awesome);
-  }
-
-  /* Fixed icon in top left corner */
-  #themeToggle {
-    position: fixed;
-    top: 20px;
-    left: 20px;
-    background: var(--header-background);
-    display: flex;
-    align-items: center;
-    border-radius: 50%;
-    cursor: pointer;
-    z-index: 1000;
-    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
-    transition: transform 0.2s ease;
-  }
-
-  #themeToggle:hover {
-    transform: scale(1.05);
-  }
-
-  /* Professional header */
-  header {
-    margin: auto;
-    padding: 1.5em 1em;
-    font-family: "More", sans-serif;
-    box-shadow: 0 2px 8px rgba(var(--black), 5%);
-    width: 720px;
-    max-width: calc(100% - 2em);
-    text-align: center;
-  }
-
-  header h1 {
-    margin: 0;
-    font-size: 1.8em;
-    font-weight: 700;
-    letter-spacing: -0.5px;
-  }
-
-  header h1 a {
-    text-decoration: none;
-    color: var(--header-color);
-  }
-
-  header h1 a::before {
-    display: none;
-  }
-
-  /* Mobile responsiveness */
-  @media (max-width: 720px) {
-    #themeToggle {
-      top: 15px;
-      left: 15px;
-    }
-
-    header {
-      padding: 1em;
-    }
-
-    header h1 {
-      font-size: 1.5em;
-    }
-  }
-
-  @media (max-width: 480px) {
-    #themeToggle {
-      top: 10px;
-      left: 10px;
-    }
-
-    #themeToggle img {
-      height: 40px;
-      width: 40px;
-    }
-
-    header h1 {
-      font-size: 1.3em;
-    }
-  }
-
-  #logo {
-    width: 300px;
-  }
-
-  /* 1. DEFINE THE DEFAULTS (Light Mode) */
-  :root {
-    --logo-invert: invert(0);
-    --epi-grayscale: grayscale(0) brightness(1);
-  }
-  
-  /* 2. MANUAL DARK OVERRIDE */
-  html.dark {
-    --logo-invert: invert(1);
-    --epi-grayscale: grayscale(1);
-  }
-  
-  /* 3. MANUAL LIGHT OVERRIDE */
-  html.light-mode {
-    --logo-invert: invert(0);
-    --epi-grayscale: brightness(2.9) grayscale(1);
-  }
-  
-  /* 4. SYSTEM PREFERENCE */
-  @media (prefers-color-scheme: dark) {
-    :root:not(.light-mode) {
-      --logo-invert: invert(1);
-    }
-  }
-  
-  /* 5. APPLY TO ELEMENTS */
-  #logo {
-    -webkit-filter: var(--logo-invert);
-    filter: var(--logo-invert);
-    transition: filter 0.3s ease;
-  }
-  
-  .epi-logo {
-    -webkit-filter: var(--epi-grayscale);
-    filter: var(--epi-grayscale);
-    transition: filter 0.3s ease;
-  }
-</style>
-
-<div id="themeToggle">
-  <img id="epiChan" class="epi-logo" aria-label="Toggle dark mode" src="/public/epi_all_colors.svg" height="50" width="50">
-</div>
-
-<header>
-  <h1><a href="/">MrJuneJune</a></h1>
-</header>
-<script src="/index.js"></script>
-
-
-     <main>
-       <p>Hi, my name is Juntae, but most people call me June or MrJuneJune.</p>
-
-       <p>I am a software engineer with experience spanning a wide range of companies, from small startups to FAANGs....</p>
-       <p>I know it is lame to work for them, but I have a dog so I need to put foods on my table.</p>
-
-       <div class="epi-photo">
-         <img id="currentPhoto" style="opacity: 0; transition: opacity 0.2s;" />
-       </div>
-
-       <p>During my free time, I like to write codes mostly in C, Python, and Typescript; all in mono repo styles using bazel. (I know that is mentally ill...)</p>
-       <p>Feel free to check it out my bad code!</p>
-
-       <h2>Links</h2>
-       <ul>
-         <li><a href="https://zenbu.babocoder.com/file/tip">Repository</a> - Check out my code</li>
-         <li><a href="/blog">Blogs</a> - My thoughts / Experiments </li>
-         <li><a href="/resume">Resume</a> - My professional experiences </li>
-         <li><a href="/tools">Tools</a> - Things I made for myself </li>
-       </ul> 
-     </main>
-     <div style="display: flex; align-items: center; justify-content: center; margin: 30px 0px;">
-  <small>&copy; 2026 June Park</small>
-</div>
-
-  <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'9b9c39a8799bcbfd',t:'MTc2NzcxMzA5Nw=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>
-  <script>
-    let arr = Array.from({ length: 18 }, (_, i) => i+1);
-    function setRandomImages() {
-      const randomIndex = Math.floor(Math.random() * arr.length);
-      const pos = arr[randomIndex];
-      currentPhoto.src = `/public/epi-photos/webp/${pos}.webp`;
-      currentPhoto.onload = () => {
-        currentPhoto.style.opacity = "1";
-      };
-      setTimeout(() => setRandomImages(), 1000);
-    }
-    setRandomImages();
-  </script>
-</html>
-
--- a/postdog/history/fca62761-983e-c04b-2f77-c3bfde99f400.txt	Wed Jan 07 04:52:17 2026 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-https://httpbin.org/get
----
-GET
----
-Content-Type: application/json
----
-
----
-HTTP Status: 200
-
-{
-  "args": {}, 
-  "headers": {
-    "Accept": "*/*", 
-    "Content-Type": "application/json", 
-    "Host": "httpbin.org", 
-    "X-Amzn-Trace-Id": "Root=1-695d2b83-44f5bafa141af3382d8e56b8"
-  }, 
-  "origin": "134.128.194.38", 
-  "url": "https://httpbin.org/get"
-}
-
--- a/postdog/history/test.txt	Wed Jan 07 04:52:17 2026 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-https://httpbin.org/get
----
-GET
----
-Content-Type: application/json
-June: Park 
----
-
----
-HTTP Status: 200
-
-{
-  "args": {}, 
-  "headers": {
-    "Accept": "*/*", 
-    "Content-Type": "application/json", 
-    "Host": "httpbin.org", 
-    "X-Amzn-Trace-Id": "Root=1-695bdbd6-243c50b9737c539f43a5badc"
-  }, 
-  "origin": "134.128.194.38", 
-  "url": "https://httpbin.org/get"
-}
-
--- a/postdog/main.c	Wed Jan 07 04:52:17 2026 -0800
+++ b/postdog/main.c	Wed Jan 07 05:02:45 2026 -0800
@@ -48,6 +48,7 @@
   char *filename;
   Rectangle rect;
   long time_modified;
+  boolean deleted;
 } HistoryItem;
 
 typedef struct {
@@ -90,8 +91,8 @@
     do {
       HistoryItem item = {0};
       item.filename = strdup(fileinfo.name);
-      item.rect = (Rectangle){0};
       item.time_modified = fileinfo.time_write; 
+      item.deleted = FALSE;
       Dowa_Array_Push(file_arr, item);
     } while (_findnext(handle, &fileinfo) == 0);
     _findclose(handle);
@@ -113,6 +114,7 @@
       HistoryItem item = {0};
       item.filename = strdup(entry->d_name);
       item.time_modified = file_stat.st_mtime;
+      item.deleted = FALSE;
       Dowa_Array_Push(file_arr, item);
     }
   }
@@ -232,7 +234,9 @@
   snprintf(filename, 1024, "%s.txt", uuid4);
   PostDog_History_CreateFile(filename, new_file);
 
-  HistoryItem item = (HistoryItem){ .filename = malloc(sizeof(char) * strlen(filename) + 1), .rect = (Rectangle){0} };
+  HistoryItem item = {0};
+  item.filename = strdup(filename);
+  item.deleted = FALSE;
   memcpy(item.filename, filename, strlen(filename) + 1);
   Dowa_Array_Push(new_history_items, item);
   
@@ -685,22 +689,15 @@
     int32 number_of_skipped_items = 0;
     for (int i = 0; i < total; i++)
     {
-      boolean skip = FALSE;
-      for (int32 j = 0; j < Dowa_Array_Length(history_deleted_items); j++)
-      {
-        if (i == j)
-        {
-          skip = TRUE;
-          number_of_skipped_items++;
-          break;
-        }
-      }
-      if (skip)
-        continue;
-
       HistoryItem *curr_history_items = i < new_history_items_length ?
         &new_history_items[i] : &history_items[i - new_history_items_length];
 
+      if (curr_history_items->deleted)
+      {
+        number_of_skipped_items++;
+        continue;
+      }
+
       curr_history_items->rect = (Rectangle){
         .x = history_list_area.x,
         .y = history_list_area.y + (padding + item_height) * (i - number_of_skipped_items) + history_scroll_offset,
@@ -821,18 +818,11 @@
       BeginScissorMode(history_list_area.x, history_list_area.y, history_list_area.width, history_list_area.height);
         for (int i = 0; i < total; i++)
         {
-          boolean skip = FALSE;
-          for (int32 j = 0; j < Dowa_Array_Length(history_deleted_items); j++)
-          {
-            if (i == j)
-            {
-              skip = TRUE;
-              break;
-            }
-          }
-          if (skip)
+          HistoryItem *curr_history_items = i < new_history_items_length ? 
+            &new_history_items[i] : &history_items[i - new_history_items_length];
+
+          if (curr_history_items->deleted)
             continue;
-          HistoryItem *curr_history_items = i < new_history_items_length ? &new_history_items[i] : &history_items[i - new_history_items_length];
 
           float diff = curr_history_items->rect.height*0.3;
           // DrawRectangleRec(curr_history_items->rect, Fade(RED, 0.1f));
@@ -860,11 +850,9 @@
           if (GuiButton(AddPaddingHorizontal(icon_area_right_column,padding), "delete"))
           {
             if (!remove(PostDog_Construct_URL(curr_history_items->filename)))
-               Dowa_Array_Push(history_deleted_items, i);
+               curr_history_items->deleted = TRUE;
             else
-            {
               fprintf(stderr, "Wasn't able to delete file: %s \n", curr_history_items->filename);
-            }
           }
         }
       EndScissorMode();
--- a/previous.c	Wed Jan 07 04:52:17 2026 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,447 +0,0 @@
-  char urlInput[1024] = "https://httpbin.org/get";
-  bool urlEditMode = false;
-
-  char jsonInput[JSON_INPUT_BUFFER_LEN] = "{\"key\":\"value\"}";
-  bool jsonEditMode = false;
-
-  char headersInput[HEADER_INPUT_BUFFER_LEN] = "Content-Type: application/json";
-  bool headersEditMode = false;
-
-  char responseText[16384] = "Response will appear here...\n\nTry the default URL or enter your own!";
-
-  char paramsInput[PARAM_INPUT_BUFFER_LEN] = "key1=value1\nkey2=value2";
-  bool paramsEditMode = false;
-
-  ActiveTab activeTab = ActiveTab_JSON; // 0 = JSON, 1 = Headers, 2 = Params
-
-  // HTTP method selection
-  int methodActive = 0;
-  bool methodDropdown = false;
-  const char *methods[] = { "GET", "POST", "PUT", "DELETE" };
-
-  // Scroll support
-  Vector2 jsonScroll = { 0, 0 };
-  Vector2 headersScroll = { 0, 0 };
-  Vector2 paramsScroll = { 0, 0 };
-  Vector2 responseScroll = { 0, 0 };
-  Vector2 historyScroll = { 0, 0 };
-
-  // History
-  HistoryItem historyItems[MAX_HISTORY_ITEMS];
-  int historyCount = 0;
-  int selectedHistoryIndex = -1;
-
-  // Load initial history
-  historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
-
-  while (!WindowShouldClose())
-  {
-    // Get current window dimensions for responsive layout
-    int screenWidth = GetScreenWidth();
-    int screenHeight = GetScreenHeight();
-
-    // Layout calculations
-    Rectangle sidebar = { 0, 10, SIDEBAR_WIDTH, screenHeight };
-
-    float mainX = SIDEBAR_WIDTH + GENERIC_PADDING;
-    float mainWidth = screenWidth - SIDEBAR_WIDTH - GENERIC_PADDING * 2;
-
-    // URL input box - leave space for SEND button on the right
-    Rectangle urlBox = {
-      mainX,
-      GENERIC_PADDING,
-      mainWidth - SEND_BUTTON_WIDTH - GENERIC_PADDING,
-      URL_INPUT_HEIGHT
-    };
-
-    // SEND button positioned beside URL input
-    Rectangle sendButton = {
-      urlBox.x + urlBox.width + GENERIC_PADDING,
-      GENERIC_PADDING,
-      SEND_BUTTON_WIDTH,
-      SEND_BUTTON_HEIGHT
-    };
-
-    // Method dropdown below URL
-    Rectangle methodButton = {
-      mainX,
-      urlBox.y + urlBox.height + GENERIC_PADDING,
-      METHOD_BUTTON_WIDTH,
-      METHOD_BUTTON_HEIGHT
-    };
-
-    float tabHeight = 30;
-    float contentY = methodButton.y + methodButton.height + GENERIC_PADDING + tabHeight;
-    float contentHeight = screenHeight - contentY - GENERIC_PADDING;
-
-    float panelWidth = (mainWidth - GENERIC_PADDING) / 2;
-
-    Rectangle tabBar = {
-      mainX,
-      methodButton.y + methodButton.height + GENERIC_PADDING,
-      panelWidth,
-      tabHeight
-    };
-
-    Rectangle requestPanel = {
-      mainX,
-      contentY,
-      panelWidth,
-      contentHeight
-    };
-
-    Rectangle responsePanel = {
-      mainX + panelWidth + GENERIC_PADDING,
-      contentY,
-      panelWidth,
-      contentHeight
-    };
-
-    BeginDrawing();
-      ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
-
-      // --- Sidebar Component---
-      DrawRectangleRec(sidebar, Fade(GRAY, 0.1f));
-      GuiGroupBox(sidebar, "HISTORY");
-
-      Rectangle refreshBtn = { 
-        sidebar.x + SIDEBAR_PADDING_GENERAL, 
-        sidebar.y + SIDEBAR_PADDING_GENERAL,
-        SIDEBAR_REFERSH_BUTTON_WIDTH,
-        SIDEBAR_REFERSH_BUTTON_HEIGHT
-      };
-      if (GuiButton(refreshBtn, "Refresh"))
-      {
-        historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
-      }
-
-      Rectangle historyArea = { 
-        sidebar.x + SIDEBAR_PADDING_GENERAL,
-        sidebar.y + SIDEBAR_AREA_PADDING_Y, 
-        sidebar.width - SIDEBAR_AREA_PADDING_X, 
-        sidebar.height - SIDEBAR_AREA_PADDING_Y
-      };
-      if (CheckCollisionPointRec(GetMousePosition(), historyArea))
-      {
-        float wheel = GetMouseWheelMove();
-        historyScroll.y += wheel * 20;
-        if (historyScroll.y < 0) historyScroll.y = 0;
-      }
-
-      BeginScissorMode(historyArea.x, historyArea.y, historyArea.width, historyArea.height);
-
-      if (historyCount == 0)
-      {
-        DrawText("No requests yet", historyArea.x + 5, historyArea.y + 25, 10, DARKGRAY);
-      } 
-      else
-      {
-        int item_y_position = historyArea.y + SIDEBAR_AREA_PADDING_Y + 5 - (int)historyScroll.y;
-        for (
-            int current_history_item_number = 0;
-            current_history_item_number < historyCount;
-            current_history_item_number++
-        )
-        {
-          if (item_y_position > historyArea.y - SIDEBAR_HISTORY_ITEM_HEIGHT && item_y_position < historyArea.y + historyArea.height)
-          {
-            Rectangle itemRect = { historyArea.x, item_y_position, historyArea.width, SIDEBAR_HISTORY_ITEM_HEIGHT - 2 };
-
-            // Draw button for history item
-            Color bgColor = (selectedHistoryIndex == current_history_item_number) ? Fade(BLUE, 0.3f) : Fade(LIGHTGRAY, 0.5f);
-            if (CheckCollisionPointRec(GetMousePosition(), itemRect) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
-            {
-              // TODO: This is cringe as fuck probably should just have a strucut that we assign and then zero out lol
-              char tempUrl[1024], tempMethod[16], tempHeaders[HEADER_INPUT_BUFFER_LEN], tempBody[JSON_INPUT_BUFFER_LEN];
-
-              if (PostDog_HistoryDirectory_LoadRequest(
-                    historyItems[current_history_item_number].filename, tempUrl, tempMethod, tempHeaders, tempBody) == 0)
-              {
-                strncpy(urlInput, tempUrl, sizeof(urlInput) - 1);
-                strncpy(headersInput, tempHeaders, sizeof(headersInput) - 1);
-                strncpy(jsonInput, tempBody, sizeof(jsonInput) - 1);
-
-                // Set method
-                for (int m = 0; m < 4; m++)
-                {
-                  if (strcmp(methods[m], tempMethod) == 0)
-                  {
-                    methodActive = m;
-                    break;
-                  }
-                }
-
-                selectedHistoryIndex = current_history_item_number;
-                strcpy(responseText, "Request loaded from history. Click SEND to execute.");
-              }
-            }
-
-            DrawRectangleRec(itemRect, bgColor);
-            DrawRectangleLinesEx(itemRect, 1, GRAY);
-
-            // Draw method badge
-            DrawText(historyItems[current_history_item_number].method, itemRect.x + 5, item_y_position + 5, 10, BLACK);
-
-            // Draw timestamp (date only)
-            char dateStr[16] = "";
-            if (strlen(historyItems[current_history_item_number].filename) >= 8)
-            {
-              snprintf(dateStr, sizeof(dateStr), "%.4s-%.2s-%.2s",
-                       historyItems[current_history_item_number].filename, historyItems[current_history_item_number].filename + 4, historyItems[current_history_item_number].filename + 6);
-            }
-            DrawText(dateStr, itemRect.x + 5, item_y_position + 18, 8, DARKGRAY);
-
-            // Draw time
-            char timeStr[16] = "";
-            if (strlen(historyItems[current_history_item_number].filename) >= 15) {
-              snprintf(timeStr, sizeof(timeStr), "%.2s:%.2s:%.2s",
-                       historyItems[current_history_item_number].filename + 9, historyItems[current_history_item_number].filename + 11, historyItems[current_history_item_number].filename + 13);
-            }
-            DrawText(timeStr, itemRect.x + 5, item_y_position + 28, 8, DARKGRAY);
-          }
-
-          item_y_position += SIDEBAR_HISTORY_ITEM_HEIGHT;
-        }
-      }
-
-      EndScissorMode();
-
-      // --- URL Input Component ---
-      GuiLabel((Rectangle){ mainX, GENERIC_PADDING - 15, 100, 20 }, "URL:");
-      if (GuiTextBox(urlBox, urlInput, 1024, urlEditMode))
-      {
-        urlEditMode = !urlEditMode;
-      }
-      if (urlEditMode && (IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
-      {
-        SetClipboardText(urlInput);
-      }
-
-      // Send button (beside URL)
-      if (GuiButton(sendButton, "SEND") || (urlEditMode && IsKeyDown(KEY_ENTER)))
-      {
-        strcpy(responseText, "Sending request...\n");
-
-        // Make the actual HTTP request
-        char tempResponse[16384];
-        const char *selectedMethod = methods[methodActive];
-
-        // Use JSON body for POST/PUT, otherwise use empty body
-        const char *requestBody = (methodActive == 1 || methodActive == 2) ? jsonInput : NULL;
-        const char *requestHeaders = headersInput;
-
-        // Save request to history
-        Postdog_SaveRequestToHistory(urlInput, selectedMethod, requestHeaders, requestBody);
-
-        // Reload history to show the new request
-        historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
-
-        // Making the requests.
-        PostDog_Make_HttpRequest(urlInput, selectedMethod, requestHeaders,
-                       requestBody, tempResponse, sizeof(tempResponse));
-        strncpy(responseText, tempResponse, sizeof(responseText) - 1);
-        responseText[sizeof(responseText) - 1] = '\0';
-      }
-
-      // Tab toggle (3 tabs now)
-      float tabWidth = tabBar.width / 3;
-      Rectangle jsonTab = { tabBar.x, tabBar.y - 10, tabWidth, tabBar.height };
-      Rectangle headersTab = { tabBar.x + tabWidth, tabBar.y - 10, tabWidth, tabBar.height };
-      Rectangle paramsTab = { tabBar.x + tabWidth * 2, tabBar.y - 10, tabWidth, tabBar.height };
-
-      if (GuiButton(jsonTab, activeTab ==  ActiveTab_JSON ? "#191#Body" : "Body"))
-      {
-        activeTab = ActiveTab_JSON;
-      }
-
-      if (GuiButton(headersTab, activeTab == ActiveTab_Headers ? "#191#Headers" : "Headers"))
-      {
-        activeTab = ActiveTab_Headers;
-      }
-
-      if (GuiButton(paramsTab, activeTab == ActiveTab_Params ? "#191#Params" : "Params"))
-      {
-        activeTab = ActiveTab_Params;
-      }
-
-      const char *panelTitle;
-      switch(activeTab) {
-        case  ActiveTab_JSON:
-        {
-          panelTitle = "Request Body (JSON)";
-          break;
-        }
-        case  ActiveTab_Headers:
-        {
-          panelTitle = "Request Headers";
-          break;
-        } 
-        case  ActiveTab_Params:
-        {
-          panelTitle = "Query Parameters";
-          break;
-        }
-      }
-
-      // Panel title
-      GuiGroupBox(requestPanel, panelTitle);
-      Rectangle textArea = {
-        requestPanel.x + 10,
-        requestPanel.y + 30,
-        requestPanel.width - 20,
-        requestPanel.height - 40
-      };
-
-      // Handle click outside to disable edit mode
-      if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
-      {
-        if (!CheckCollisionPointRec(GetMousePosition(), textArea))
-        {
-          jsonEditMode = false;
-          headersEditMode = false;
-          paramsEditMode = false;
-        }
-      }
-
-      // Draw border for text area
-      DrawRectangleLinesEx(textArea, 1, GRAY);
-
-      // Manual scroll handling with mouse wheel
-      if (CheckCollisionPointRec(GetMousePosition(), textArea))
-      {
-        float wheel = GetMouseWheelMove();
-        switch(activeTab)
-        {
-          case  ActiveTab_JSON:
-          {
-            jsonScroll.y += wheel * 20;
-            if (jsonScroll.y < 0) jsonScroll.y = 0;
-          }
-          case  ActiveTab_Headers:
-          {
-            headersScroll.y += wheel * 20;
-            if (headersScroll.y < 0) headersScroll.y = 0;
-          } 
-          case  ActiveTab_Params:
-          {
-            paramsScroll.y += wheel * 20;
-            if (paramsScroll.y < 0) paramsScroll.y = 0;
-          }
-        }
-      }
-
-      char *copyFromInput;
-      bool *currentMode; 
-      switch(activeTab)
-      {
-        case  ActiveTab_JSON:
-        {
-          PostDog_Render_TextWithScroll(textArea, jsonScroll, jsonInput);
-          copyFromInput = jsonInput;
-          currentMode = &jsonEditMode;
-          break;
-        }
-        case  ActiveTab_Headers:
-        {
-          PostDog_Render_TextWithScroll(textArea, headersScroll, headersInput);
-          copyFromInput = headersInput;
-          currentMode = &headersEditMode;
-          break;
-        } 
-        case  ActiveTab_Params:
-        {
-          PostDog_Render_TextWithScroll(textArea, paramsScroll, paramsInput);
-          copyFromInput = paramsInput;
-          currentMode = &paramsEditMode;
-
-          Rectangle updateUrlBtn = { textArea.x + 30, textArea.y + textArea.height - 10, 120, 20 };
-          // TODO: Automatic update
-          if (GuiButton(updateUrlBtn, "Update URL"))
-          {
-            char tempUrl[1024];
-            strncpy(tempUrl, urlInput, sizeof(tempUrl) - 1);
-
-            // Remove existing params if any
-            char *questionMark = strchr(tempUrl, '?');
-            if (questionMark) *questionMark = '\0';
-
-            Postdog_UpdateUrlWithParams(urlInput, sizeof(urlInput), tempUrl, paramsInput);
-          }
-          break;
-        }
-      }
-
-      if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
-      {
-        SetClipboardText(copyFromInput);
-      }
-
-      Rectangle editBtn = { textArea.x + textArea.width - 60, textArea.y + textArea.height - 10, 50, 20 };
-      if (GuiButton(editBtn, "Edit"))
-      {
-        *currentMode = !(*currentMode);
-      }
-
-      // Response Panel with scroll
-      GuiGroupBox(responsePanel, "Response");
-
-      Rectangle responseArea = {
-        responsePanel.x + 10,
-        responsePanel.y + 30,
-        responsePanel.width - 20,
-        responsePanel.height - 40
-      };
-
-      // Manual scroll for response
-      if (CheckCollisionPointRec(GetMousePosition(), responseArea))
-      {
-        float wheel = GetMouseWheelMove();
-        responseScroll.y += wheel * 20;
-        if (responseScroll.y < 0) responseScroll.y = 0;
-      }
-
-      // Draw border
-      DrawRectangleLinesEx(responseArea, 1, GRAY);
-
-      // Draw response text with scroll
-      PostDog_Render_TextWithScroll(responseArea, responseScroll, responseText);
-
-      if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
-      {
-        if (CheckCollisionPointRec(GetMousePosition(), responseArea)) {
-          SetClipboardText(responseText);
-        }
-      }
-
-      // ---  Edit modal  ----
-      if (jsonEditMode)
-      {
-        GuiTextBox(
-            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
-            jsonInput, JSON_INPUT_BUFFER_LEN, true);
-      }
-
-      if (headersEditMode)
-      {
-        GuiTextBox(
-            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
-            headersInput, HEADER_INPUT_BUFFER_LEN, true);
-      }
-
-      if (paramsEditMode)
-      {
-        GuiTextBox(
-            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
-            paramsInput, PARAM_INPUT_BUFFER_LEN, true);
-      }
-
-      if (GuiDropdownBox(methodButton, "GET;POST;PUT;DELETE", &methodActive, methodDropdown))
-      {
-        methodDropdown = !methodDropdown;
-      }
-
-
-    EndDrawing();
-  }
-
-