From b0fb5d6698ed1461bb803122340650a97550f127 Mon Sep 17 00:00:00 2001 From: TheKrol Date: Thu, 16 Jan 2025 09:05:24 -0500 Subject: [PATCH] Removed the extra pull request button --- .../components/editors/DocumentEditor.svelte | 25 +------- frontend/src/routes/+page.svelte | 57 +------------------ 2 files changed, 2 insertions(+), 80 deletions(-) diff --git a/frontend/src/lib/components/editors/DocumentEditor.svelte b/frontend/src/lib/components/editors/DocumentEditor.svelte index 090c23f..639b445 100644 --- a/frontend/src/lib/components/editors/DocumentEditor.svelte +++ b/frontend/src/lib/components/editors/DocumentEditor.svelte @@ -63,14 +63,9 @@ interface Props { previewWindow: HTMLElement; saveChangesHandler: (commitMessage: string) => Promise; - createPullRequestHandler: () => Promise; } - let { - previewWindow = $bindable(), - saveChangesHandler = $bindable(), - createPullRequestHandler = $bindable() - }: Props = $props(); + let { previewWindow = $bindable(), saveChangesHandler = $bindable() }: Props = $props(); async function cancelChangesHandler() { if ($editorText !== get(currentFile)) { @@ -145,24 +140,6 @@ - -
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index aade390..7ffa730 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -178,57 +178,6 @@ } }); }); - - let createPullRequestHandler = $state(async (): Promise => { - const title = `Pull request for ${$currentFile}`; - const description = `This pull request contains changes made by ${$me.username}.`; - const headBranch = $branchName; - - const response = await fetch(`${apiAddress}/api/pulls`, { - method: 'POST', - credentials: 'include', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - head_branch: headBranch, - base_branch: 'master', - title: title, - description: description - }) - }); - - // Handle the response - if (!response.ok) { - const errorMessage = `Failed to create pull request (Code ${response.status}: "${response.statusText}")`; - addToast({ - message: `Error: ${errorMessage}`, - type: ToastType.Error, - dismissible: true - }); - return; // Exit the function early on error - } - - // Parse the JSON response to get the pull request URL - const jsonResponse = await response.json(); - const pullRequestUrl = jsonResponse.data?.pull_request_url; // Adjusted based on API response - - if (pullRequestUrl) { - // If successful, show success toast with the URL - addToast({ - message: `Pull request created successfully. View it [here](${pullRequestUrl}).`, - type: ToastType.Success, - dismissible: true - }); - } else { - // Handle the case where the URL is not present (if needed) - addToast({ - message: 'Pull request created successfully, but the URL is not available.', - type: ToastType.Warning, - dismissible: true - }); - } - });
@@ -273,11 +222,7 @@ /> {#if mode === SelectedMode.Documents} {#if showEditor && $currentFile !== ''} - + {:else}