diff postdog/main.c @ 161:87d8d3eb3491

[PostDog] WIP to make it more mordern looking
author June Park <parkjune1995@gmail.com>
date Thu, 15 Jan 2026 08:29:26 -0800
parents 05cf9467a1c3
children 058de208e640
line wrap: on
line diff
--- a/postdog/main.c	Wed Jan 14 19:39:52 2026 -0800
+++ b/postdog/main.c	Thu Jan 15 08:29:26 2026 -0800
@@ -3,7 +3,7 @@
 #include <string.h>
 #include <time.h>
 #include <sys/stat.h>
-#include <pthread.h>
+#include <uv.h>
 
 #ifdef _WIN32
     #include <direct.h>
@@ -18,12 +18,11 @@
 #endif
 
 
-#include "third_party/raylib/include/raylib.h"
-#define RAYGUI_IMPLEMENTATION
-#include "third_party/raylib/include/raygui.h"
-
 #include "dowa/dowa.h"
 #include "seobeo/seobeo.h"
+#include "third_party/raylib/include/raylib.h"
+#include "third_party/raylib/include/raygui.h"
+#include "third_party/raylib/custom.h"
 
 #ifndef POSTDOG_PATHS
   #define POSTDOG_PATHS "/Users/mrjunejune/zenbu/postdog/history"
@@ -39,14 +38,18 @@
 #define BODY_BUFFER_LENGTH 1024 * 1024 * 5
 #define RESULT_BUFFER_LENGTH 1024 * 1024 * 5
 
+#define URL_TEXT_DEFAULT "https://httpbin.org/get"
+#define HEADER_TEXT_DEFAULT "Content-Type: application/json"
+#define BODY_TEXT_DEFAULT ""
+#define GET_PARAM_TEXT_DEFAULT "foo bar"
+
 // ============================================================================
 // TextArea Component
 // ============================================================================
 
 #define TEXT_SIZE_DEFAULT 10 // used to calcualte spacing
-#define TEXT_AREA_FONT_SIZE 16
 #define TEXT_AREA_LINE_HEIGHT 20
-#define TEXT_AREA_PADDING 8
+#define TEXT_AREA_PADDING 30
 #define TEXT_AREA_CURSOR_WIDTH 2
 #define TEXT_AREA_MAX_UNDO_STATES 64
 #define TEXT_AREA_MAX_INSTANCES 8
@@ -184,7 +187,7 @@
     strncpy(temp, text + start, len);
     temp[len] = '\0';
 
-    return MeasureTextEx(GuiGetFont(), temp, font_size, TEXT_SIZE_DEFAULT/TEXT_AREA_FONT_SIZE).x;
+    return MeasureTextEx(GuiGetFont(), temp, font_size, TEXT_SIZE_DEFAULT/GuiGetStyle(DEFAULT, TEXT_SIZE)).x;
 }
 
 static int GetCharIndexFromPos(const char *text, Rectangle bounds, Vector2 pos,
@@ -477,7 +480,7 @@
 
     // Content area
     float content_height = GetContentHeight(text, bounds, should_text_wrap,
-                                            TEXT_AREA_FONT_SIZE, TEXT_AREA_LINE_HEIGHT);
+                                            GuiGetStyle(DEFAULT, TEXT_SIZE), TEXT_AREA_LINE_HEIGHT);
     float visible_height = bounds.height - TEXT_AREA_PADDING * 2;
     float max_scroll = TA_Max_Float(0, content_height - visible_height);
 
@@ -503,7 +506,7 @@
         // Mouse Selection
         if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && mouse_in_bounds) {
             int click_pos = GetCharIndexFromPos(text, bounds, mouse_pos, should_text_wrap,
-                                                 state->scroll_offset_y, TEXT_AREA_FONT_SIZE,
+                                                 state->scroll_offset_y, GuiGetStyle(DEFAULT, TEXT_SIZE),
                                                  TEXT_AREA_LINE_HEIGHT);
             state->cursor_pos = click_pos;
             state->selection_start = -1;
@@ -515,7 +518,7 @@
 
         if (state->is_selecting && IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
             int drag_pos = GetCharIndexFromPos(text, bounds, mouse_pos, should_text_wrap,
-                                                state->scroll_offset_y, TEXT_AREA_FONT_SIZE,
+                                                state->scroll_offset_y, GuiGetStyle(DEFAULT, TEXT_SIZE),
                                                 TEXT_AREA_LINE_HEIGHT);
             if (drag_pos != state->cursor_pos) {
                 if (state->selection_start < 0) {
@@ -848,7 +851,7 @@
         // Auto-scroll to keep cursor visible
         Vector2 cursor_screen = GetCursorScreenPos(text, state->cursor_pos, bounds,
                                                     should_text_wrap, state->scroll_offset_y,
-                                                    TEXT_AREA_FONT_SIZE, TEXT_AREA_LINE_HEIGHT);
+                                                    GuiGetStyle(DEFAULT, TEXT_SIZE), TEXT_AREA_LINE_HEIGHT);
 
         float visible_top = bounds.y + TEXT_AREA_PADDING;
         float visible_bottom = bounds.y + bounds.height - TEXT_AREA_PADDING - TEXT_AREA_LINE_HEIGHT;
@@ -863,8 +866,10 @@
     }
 
     // Drawing
-    DrawRectangleRec(bounds, is_edit_mode ? DARKGRAY : (Color){40, 40, 40, 255});
-    DrawRectangleLinesEx(bounds, 1, is_edit_mode ? WHITE : GRAY);
+    DrawRectangleRounded(bounds, 0.2, 1, is_edit_mode ? DARKGRAY : (Color){40, 40, 40, 255});
+    // DrawRectangleRec(bounds, is_edit_mode ? DARKGRAY : (Color){40, 40, 40, 255});
+    // DrawRectangleLinesEx(bounds, 1, is_edit_mode ? WHITE : GRAY);
+    DrawRectangleRoundedLines(bounds, 0.2, 1, is_edit_mode ? WHITE : GRAY);
 
     BeginScissorMode((int)bounds.x, (int)bounds.y, (int)bounds.width, (int)bounds.height);
 
@@ -889,7 +894,7 @@
             boolean should_draw_line = is_end || is_newline;
 
             if (should_text_wrap && !is_end && !is_newline) {
-                int line_width = MeasureTextRange(text, line_char_start, i + 1, TEXT_AREA_FONT_SIZE);
+                int line_width = MeasureTextRange(text, line_char_start, i + 1, GuiGetStyle(DEFAULT, TEXT_SIZE));
                 if (line_width > content_width && i > line_char_start) {
                     should_draw_line = TRUE;
                 }
@@ -902,8 +907,8 @@
                     int highlight_start = TA_Max_Int(sel_min, line_char_start);
                     int highlight_end = TA_Min_Int(sel_max, line_end);
 
-                    float x1 = content_x + MeasureTextRange(text, line_char_start, highlight_start, TEXT_AREA_FONT_SIZE);
-                    float x2 = content_x + MeasureTextRange(text, line_char_start, highlight_end, TEXT_AREA_FONT_SIZE);
+                    float x1 = content_x + MeasureTextRange(text, line_char_start, highlight_start, GuiGetStyle(DEFAULT, TEXT_SIZE));
+                    float x2 = content_x + MeasureTextRange(text, line_char_start, highlight_end, GuiGetStyle(DEFAULT, TEXT_SIZE));
                     float y = content_y + visual_line * TEXT_AREA_LINE_HEIGHT;
 
                     DrawRectangle((int)x1, (int)y, (int)(x2 - x1), TEXT_AREA_LINE_HEIGHT,
@@ -927,7 +932,7 @@
             boolean should_draw_line = is_end || is_newline;
 
             if (!is_end && !is_newline) {
-                int line_width = MeasureTextRange(text, line_char_start, i + 1, TEXT_AREA_FONT_SIZE);
+                int line_width = MeasureTextRange(text, line_char_start, i + 1, GuiGetStyle(DEFAULT, TEXT_SIZE));
                 if (line_width > content_width && i > line_char_start) {
                     should_draw_line = TRUE;
                 }
@@ -944,7 +949,7 @@
                   .y = content_y + visual_line * TEXT_AREA_LINE_HEIGHT
                 };
                 DrawTextEx(GuiGetFont(), line_buffer, draw_text_vector,
-                        TEXT_AREA_FONT_SIZE, TEXT_SIZE_DEFAULT/TEXT_AREA_FONT_SIZE, WHITE);
+                        GuiGetStyle(DEFAULT, TEXT_SIZE), TEXT_SIZE_DEFAULT/GuiGetStyle(DEFAULT, TEXT_SIZE), WHITE);
 
                 visual_line++;
                 line_char_start = is_newline ? i + 1 : i;
@@ -970,7 +975,7 @@
                       .y = content_y + visual_line * TEXT_AREA_LINE_HEIGHT
                     };
                     DrawTextEx(GuiGetFont(), line_buffer, draw_text_vector ,
-                            TEXT_AREA_FONT_SIZE, TEXT_SIZE_DEFAULT/TEXT_AREA_FONT_SIZE, WHITE);
+                            GuiGetStyle(DEFAULT, TEXT_SIZE), TEXT_SIZE_DEFAULT/GuiGetStyle(DEFAULT, TEXT_SIZE), WHITE);
                 }
                 visual_line++;
                 line_start = i + 1;
@@ -982,7 +987,7 @@
     if (is_edit_mode && state->cursor_visible) {
         Vector2 cursor_pos = GetCursorScreenPos(text, state->cursor_pos, bounds,
                                                  should_text_wrap, state->scroll_offset_y,
-                                                 TEXT_AREA_FONT_SIZE, TEXT_AREA_LINE_HEIGHT);
+                                                 GuiGetStyle(DEFAULT, TEXT_SIZE), TEXT_AREA_LINE_HEIGHT);
 
         DrawRectangle((int)cursor_pos.x, (int)cursor_pos.y,
                       TEXT_AREA_CURSOR_WIDTH, TEXT_AREA_LINE_HEIGHT, WHITE);
@@ -1066,6 +1071,8 @@
 #define TEXT_AREA_ID_RESULT         5
 
 static uint32 counter = 0;
+static uv_mutex_t history_mutex;
+static uv_loop_t *main_loop = NULL;
 HistoryItem *history_items = NULL;
 HistoryItem *new_history_items = NULL;
 
@@ -1077,7 +1084,7 @@
 int active_input_tab = 0;
 Seobeo_WebSocket *ws = NULL;
 boolean WS_BREAK = FALSE;
-pthread_t websocket_thread_id;
+uv_thread_t websocket_thread_id;
 Color TEXT_COLOR = BLACK;
 boolean LOADING = FALSE;
 
@@ -1098,8 +1105,13 @@
   char *title = malloc(sizeof(char) * 512);
   if (!fgets(title, 512, file)) {
     fclose(file);
+    free(title);
     return strdup(filename);
   }
+  fclose(file);
+
+  // Strip trailing newline
+  title[strcspn(title, "\n")] = '\0';
 
   return title;
 }
@@ -1151,6 +1163,10 @@
   }
   closedir(dp);
 #endif
+
+  // Update the caller's pointer in case array was reallocated
+  *p_file_arr = file_arr;
+
   int count = Dowa_Array_Length(file_arr);
   if (count > 1) {
     qsort(file_arr, count, sizeof(HistoryItem), CompareHistoryItemsByDate);
@@ -1200,25 +1216,25 @@
   return 0;
 }
 
-char *PostDog_Construct_URL(char *filename)
+char *PostDog_Construct_URL(char *filename, char *out_buffer, size_t buffer_size)
 {
-  char full_file_path[512] = {0};
-  snprintf(full_file_path, 512, "%s/%s", POSTDOG_PATHS, filename);
-  return &full_file_path;
+  snprintf(out_buffer, buffer_size, "%s/%s", POSTDOG_PATHS, filename);
+  return out_buffer;
 }
 
-void PostDog_History_CreateFile(char *filename, char* values)
+boolean PostDog_History_CreateFile(char *filename, char* values)
 {
   char full_file_path[512] = {0};
   snprintf(full_file_path, 512, "%s/%s", POSTDOG_PATHS, filename);
   FILE *file = fopen(full_file_path, "w");
   if (!file)
   {
-    printf("Failed to create a file: %s\n", full_file_path);
-    return;
+    fprintf(stderr, "Failed to create a file: %s\n", full_file_path);
+    return FALSE;
   }
   fwrite(values, 1, strlen(values), file);
   fclose(file);
+  return TRUE;
 }
 
 void PostDog_Request_SaveFile(void)
@@ -1269,17 +1285,23 @@
     exit(EXIT_FAILURE);
   }
 
+  uv_mutex_lock(&history_mutex);
+
   int32 seed = (uint32)time(NULL) ^ counter++;
   Dowa_String_UUID(seed, uuid4);
   snprintf(filename, 1024, "%s.txt", uuid4);
-  PostDog_History_CreateFile(filename, new_file);
 
-  HistoryItem item = {0};
-  item.filename = strdup(filename);
-  item.title = strdup(title);
-  item.deleted = FALSE;
+  if (PostDog_History_CreateFile(filename, new_file))
+  {
+    HistoryItem item = {0};
+    item.filename = strdup(filename);
+    item.title = strdup(title);
+    item.deleted = FALSE;
 
-  Dowa_Array_Push(new_history_items, item);
+    Dowa_Array_Push(new_history_items, item);
+  }
+
+  uv_mutex_unlock(&history_mutex);
   Dowa_Arena_Free(arena);
 }
 
@@ -1315,37 +1337,40 @@
 int PostDog_Websocket_Send(void)
 {
   if (Seobeo_WebSocket_Send_Text(ws, input_body_array[active_input_tab]) < 0)
+  {
     snprintf(result_text + strlen(result_text),  RESULT_BUFFER_LENGTH - strlen(result_text),
         "Failed to send message\n");
-  else
-    snprintf(result_text + strlen(result_text),  RESULT_BUFFER_LENGTH - strlen(result_text),
-        "\n%s", input_body_array[active_input_tab]);
+    return -1;
+  }
+  snprintf(result_text + strlen(result_text),  RESULT_BUFFER_LENGTH - strlen(result_text),
+      "\n%s", input_body_array[active_input_tab]);
+  return 0;
 }
 
-void PostDog_Websocket_Destroy(pthread_t thread_id)
+void PostDog_Websocket_Destroy(uv_thread_t thread_id)
 {
   Seobeo_WebSocket_Destroy(ws);
-  pthread_detach(thread_id);
+  uv_thread_join(&thread_id);
 }
 
-void *PostDog_Websocket_Start(void *arg)
+void PostDog_Websocket_Start(void *arg)
 {
   PostDog_Websocket_Connect();
   PostDog_Websocket_Listen();
-  return NULL;
 }
 
-pthread_t PostDog_Websocket_Start_Thread()
+uv_thread_t PostDog_Websocket_Start_Thread()
 {
-  pthread_t thread_id;
+  uv_thread_t thread_id;
 
-  if (pthread_create(&thread_id, NULL, PostDog_Websocket_Start, NULL) != 0)
+  if (uv_thread_create(&thread_id, PostDog_Websocket_Start, NULL) != 0)
   {
     perror("Failed to create thread");
-    return 0;
+    memset(&thread_id, 0, sizeof(thread_id));
+    return thread_id;
   }
 
-  return thread_id; 
+  return thread_id;
 }
 
 int PostDog_Http_Request(void)
@@ -1405,24 +1430,33 @@
   return 0;
 }
 
-void *PostDog_Http_Thread(void *arg)
+void PostDog_Http_Work(uv_work_t *req)
 {
   PostDog_Http_Request();
   printf("HTTP request finished.\n");
+}
+
+void PostDog_Http_Work_Done(uv_work_t *req, int status)
+{
   LOADING = FALSE;
-  return NULL;
+  free(req);
 }
 
 void PostDog_Http_Thread_Request()
 {
-  pthread_t thread_id;
-  LOADING = TRUE;
-  if (pthread_create(&thread_id, NULL, PostDog_Http_Thread, NULL) != 0)
+  uv_work_t *work_req = malloc(sizeof(uv_work_t));
+  if (!work_req)
   {
-    perror("Failed to create thread");
+    perror("Failed to allocate work request");
     return;
   }
-  pthread_detach(thread_id);
+  LOADING = TRUE;
+  if (uv_queue_work(main_loop, work_req, PostDog_Http_Work, PostDog_Http_Work_Done) != 0)
+  {
+    perror("Failed to queue work");
+    free(work_req);
+    LOADING = FALSE;
+  }
 }
 
 void PostDog_Update_URL(void)
@@ -1557,101 +1591,12 @@
   Dowa_Arena_Free(split_arena);
 }
 
-Rectangle AddPadding(Rectangle rect, float padding)
-{
-  return (Rectangle){
-    rect.x + padding,
-    rect.y + padding,
-    rect.width - (2 * padding),
-    rect.height - (2 * padding)
-  };
-}
-
-Rectangle AddPaddingAll(Rectangle rect, float top, float right,float down, float left)
-{
-  return (Rectangle){
-    rect.x + left,
-    rect.y + top,
-    rect.width - (right + left),
-    rect.height - (top + down),
-  };
-}
-
-
-
-Rectangle AddPaddingHorizontal(Rectangle rect, float padding)
-{
-  return (Rectangle){
-    rect.x + padding,
-    rect.y,
-    rect.width - (2 * padding),
-    rect.height
-  };
-}
-
-Rectangle AddPaddingVertical(Rectangle rect, float padding)
-{
-  return (Rectangle){
-    rect.x,
-    rect.y + padding,
-    rect.width,
-    rect.height - (2 * padding)
-  };
-}
-
-// Layout helper functions
-Rectangle RightOf(Rectangle ref, float padding)
-{
-  return (Rectangle){
-    .x = ref.x + ref.width + padding,
-    .y = ref.y,
-    .width = 0,
-    .height = ref.height
-  };
-}
-
-Rectangle Below(Rectangle ref, float padding)
-{
-  return (Rectangle){
-    .x = ref.x,
-    .y = ref.y + ref.height + padding,
-    .width = ref.width,
-    .height = 0
-  };
-}
-
-Rectangle LeftColumn(Rectangle container, float ratio, float padding)
-{
-  return (Rectangle){
-    .x = container.x + padding,
-    .y = container.y + padding,
-    .width = (container.width * ratio) - padding,
-    .height = container.height - (2 * padding)
-  };
-}
-
-Rectangle RightColumn(Rectangle container, Rectangle leftCol, float padding)
-{
-  return (Rectangle){
-    .x = leftCol.x + leftCol.width + padding,
-    .y = container.y + padding,
-    .width = container.width - leftCol.width - (3 * padding),
-    .height = container.height - (2 * padding)
-  };
-}
-
-Rectangle HorizontalSplit(Rectangle container, float ratio)
-{
-  return (Rectangle){
-    .x = container.x,
-    .y = container.y,
-    .width = container.width * ratio,
-    .height = container.height
-  };
-}
-
 int main()
 {
+  // -- initialize libuv --//
+  main_loop = uv_default_loop();
+  uv_mutex_init(&history_mutex);
+
   // -- initizlied --//
   InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "PostDog");
   SetWindowState(FLAG_WINDOW_RESIZABLE);
@@ -1660,16 +1605,17 @@
   Font customFont = LoadFontEx("postdog/Roboto-Regular.ttf", 20, 0, 0);
   GuiSetFont(customFont);
   GuiSetStyle(DEFAULT, TEXT_SIZE, 15);
-  Image logo_original = LoadImage("postdog/epi_all_colors.png");
-  ImageResize(&logo_original, 60, 60);
+  Image logo_original = LoadImage("postdog/logo_bigger.png");
+  ImageResize(&logo_original, 200, 600);
   SetWindowIcon(logo_original);
   Texture2D logo_texture = LoadTextureFromImage(logo_original);
   UnloadImage(logo_original);
 
   // Arena for text area undo states
-  g_text_area_arena = Dowa_Arena_Create(1024 * 1024 * 8);  // 8MB for undo states
+  g_text_area_arena = Dowa_Arena_Create(1024 * 1024 * 4);
 
   // -- Starting pos ---//
+  Rectangle full_screen = { 0 };
   Rectangle history_sidebar_rect = { 0 };
   Dowa_Array_Reserve(history_items, 10);
   Dowa_Array_Reserve(new_history_items, 10);
@@ -1686,15 +1632,16 @@
 
   // Initialize global UI state
   url_input_text = (char *)malloc(sizeof(char) * URL_TEXT_BUFFER_LENGTH);
-  snprintf(url_input_text, URL_TEXT_BUFFER_LENGTH, "wss://mrjunejune.com/echo");
+  snprintf(url_input_text, URL_TEXT_BUFFER_LENGTH, URL_TEXT_DEFAULT);
 
   Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * HEADER_BUFFER_LENGTH));
   Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * BODY_BUFFER_LENGTH));
   Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * DEFAULT_TEXT_BUFFER_LENGTH));
   Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * DEFAULT_TEXT_BUFFER_LENGTH));
 
-  snprintf(input_body_array[TAB_HEADER], HEADER_BUFFER_LENGTH, "Content-Type: application/json");
-  snprintf(input_body_array[TAB_BODY], HEADER_BUFFER_LENGTH, "");
+  snprintf(input_body_array[TAB_HEADER], HEADER_BUFFER_LENGTH, HEADER_TEXT_DEFAULT);
+  snprintf(input_body_array[TAB_BODY], HEADER_BUFFER_LENGTH, BODY_TEXT_DEFAULT);
+  snprintf(input_body_array[TAB_GET_PARAMS], HEADER_BUFFER_LENGTH, GET_PARAM_TEXT_DEFAULT);
 
   result_text = (char *)malloc(sizeof(char) * RESULT_BUFFER_LENGTH);
   result_text[0] = '\0';
@@ -1724,6 +1671,9 @@
 
   while (!WindowShouldClose())
   {
+    // Process libuv events (non-blocking)
+    uv_run(main_loop, UV_RUN_NOWAIT);
+
     int screen_width = GetScreenWidth();
     int screen_height = GetScreenHeight();
 
@@ -1736,15 +1686,19 @@
     Rectangle screen_rect = { 0, 0, screen_width, screen_height };
 
     // -- Side bar --//
-    history_sidebar_rect = LeftColumn(screen_rect, 0.15, padding);
+    history_sidebar_rect = LeftColumn(screen_rect, 0.20, padding);
     Rectangle content_area_rect = RightColumn(screen_rect, history_sidebar_rect, padding);
     Rectangle logo_area_rect = (Rectangle){
       .x = history_sidebar_rect.x,
       .y = history_sidebar_rect.y,
       .width = history_sidebar_rect.width,
-      .height = 80
+      .height = 300
     };
 
+
+    DrawRectangleSelectiveRounded(history_sidebar_rect, 10, 10, ORANGE, TRUE, FALSE, FALSE, TRUE);
+    DrawRectangleSelectiveRounded(content_area_rect, 10, 10, WHITE, FALSE, TRUE, TRUE, FALSE);
+
     Rectangle history_list_area_rect = Below(logo_area_rect, padding);
     history_list_area_rect.x += padding;
     history_list_area_rect.width = history_sidebar_rect.width -  (2 * padding);
@@ -1788,13 +1742,13 @@
     url_text_bounds_rect = (Rectangle){
       .x = url_area_rect.x + padding,
       .y = url_control_y,
-      .width = 7 * (TEXT_SIZE / 2),
+      .width = 10 * (TEXT_SIZE / 2),
       .height = TEXT_SIZE * 2
     };
 
     url_input_bounds_rect = RightOf(url_text_bounds_rect, padding);
     url_input_bounds_rect.width = url_area_rect.width * 0.7;
-    url_input_bounds_rect.height = TEXT_SIZE * 2;
+    url_input_bounds_rect.height = TEXT_SIZE * 2.5;
 
     url_enter_button_rect = RightOf(url_input_bounds_rect, padding);
     url_enter_button_rect.width = url_area_rect.width * 0.1;
@@ -1868,6 +1822,8 @@
 
     if (Clicked(mouse_position, logo_area_rect))
       PostDog_Params_Reset();
+    
+    // --- Begin Drawing --- //
     BeginDrawing();
       ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
 
@@ -1912,8 +1868,10 @@
           Rectangle icon_area_left_column = LeftColumn(icon_area, 0.5, 0);
           Rectangle icon_area_right_column = RightColumn(icon_area, icon_area_left_column, 0);
 
-          filename_area_rect.y += 2*padding;
-          GuiDrawText(curr_history_items->title, AddPadding(filename_area_rect, padding), TEXT_ALIGN_CENTER, BLACK);
+          Rectangle temp = AddPadding(filename_area_rect, padding);
+
+          // ADD this back
+          // GuiDrawText(curr_history_items->title, temp, TEXT_ALIGN_CENTER, BLACK);
           if (
             InArea(mouse_position, icon_area_left_column) ||
             InArea(mouse_position, icon_area_right_column)
@@ -1924,7 +1882,8 @@
             PostDog_Load_File(curr_history_items->filename);
           if (GuiButton(AddPadding(icon_area_right_column, padding), "delete"))
           {
-            if (!remove(PostDog_Construct_URL(curr_history_items->filename)))
+            char delete_path[512];
+            if (!remove(PostDog_Construct_URL(curr_history_items->filename, delete_path, sizeof(delete_path))))
                curr_history_items->deleted = TRUE;
             else
               fprintf(stderr, "Wasn't able to delete file: %s \n", curr_history_items->filename);
@@ -1950,10 +1909,9 @@
       }
 
       // URL area Rect
-      GuiDrawText("URL: ", url_text_bounds_rect, TEXT_ALIGN_CENTER, BLACK);
       DrawRectangleRec(url_area_rect, Fade(BLACK, 0.1f));
 
-      if (GuiTextBox(url_input_bounds_rect, url_input_text, DEFAULT_TEXT_BUFFER_LENGTH, url_input_edit))
+      if (GuiTextArea(21, url_input_bounds_rect, url_input_text, DEFAULT_TEXT_BUFFER_LENGTH, url_input_edit, FALSE, g_text_area_arena))
         url_input_edit = !url_input_edit;
 
       if (url_input_edit)
@@ -1965,12 +1923,11 @@
         }
       }
 
-      sendRequest = GuiButton(url_enter_button_rect, "ENTER");
-      if (sendRequest)
+      if (GuiButtonRounded(url_enter_button_rect, "New Request", 0.2, 1))
         PostDog_Http_Thread_Request();
 
-      if (GuiDropdownBox(method_dropdown_rect, "GET;POST;PUT;DELETE", &active_method_dropdown, method_edit))
-        method_edit = !method_edit;
+      DrawRectangleSelectiveRounded(body_area_rect, 10, 10, ORANGE, TRUE, FALSE, FALSE, TRUE);
+      DrawRectangleSelectiveRounded(result_area_rect, 10, 10, WHITE, FALSE, TRUE, TRUE, FALSE);
 
       // Input Tabs Rect
       DrawRectangleRec(input_area_rect, Fade(BLUE, 0.1f));
@@ -2015,15 +1972,21 @@
       boolean result_toggle = GuiTextArea(TEXT_AREA_ID_RESULT, result_body_rect, result_text,
                                           RESULT_BUFFER_LENGTH, result_body_edit_mode, TRUE, g_text_area_arena);
 
-      GuiToggleGroup(input_tab_item_rect, "Header;Body;Get Param;Websocket", &active_input_tab);
       if (result_toggle)
         result_body_edit_mode = !result_body_edit_mode;
 
+      if (GuiDropdownBoxRounded(url_text_bounds_rect, "GET;POST;PUT;DELETE", &active_method_dropdown, method_edit, 0.2, 1))
+        method_edit = !method_edit;
     EndDrawing();
   }
 
   GuiTextAreaResetAllStates();
   Dowa_Arena_Free(g_text_area_arena);
+
+  // Cleanup libuv
+  uv_mutex_destroy(&history_mutex);
+  uv_loop_close(main_loop);
+
   CloseWindow();
   return 0;
 }