-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Remove upload functionality and add tooltip for Code not in GitHub link #7431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8e982dc
Remove upload functionality and add tooltip for 'Code not in GitHub?'…
openhands-agent 7c70c00
Update Code not in GitHub link styling and positioning
openhands-agent 72c8437
style a bit
rbren d5af9fa
Remove dead code related to zip upload functionality
openhands-agent 6011505
better styles
rbren ac8f302
Merge branch 'remove-upload-add-tooltip' of https://github.com/All-Ha…
rbren b3aa3ba
xs font
rbren 2505378
more consistent styles
rbren bde1e73
Merge branch 'main' into remove-upload-add-tooltip
rbren 02e82fb
Replace tooltip with direct text and 'Start from scratch' link
openhands-agent 8d67d34
refactor a bit
rbren 0c3fe39
empty prompt
rbren a22d986
Merge branch 'main' into remove-upload-add-tooltip
rbren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
frontend/src/components/features/github/code-not-in-github-link.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
import { useDispatch } from "react-redux"; | ||
import { useCreateConversation } from "#/hooks/mutation/use-create-conversation"; | ||
import { setInitialPrompt } from "#/state/initial-query-slice"; | ||
|
||
const INITIAL_PROMPT = ""; | ||
|
||
export function CodeNotInGitHubLink() { | ||
const dispatch = useDispatch(); | ||
const { mutate: createConversation } = useCreateConversation(); | ||
|
||
const handleStartFromScratch = () => { | ||
// Set the initial prompt and create a new conversation | ||
dispatch(setInitialPrompt(INITIAL_PROMPT)); | ||
createConversation({ q: INITIAL_PROMPT }); | ||
}; | ||
|
||
return ( | ||
<div className="text-xs text-neutral-400"> | ||
Code not in GitHub?{" "} | ||
<span | ||
onClick={handleStartFromScratch} | ||
className="underline cursor-pointer" | ||
> | ||
Start from scratch | ||
</span>{" "} | ||
and use the VS Code link to upload and download your code. | ||
</div> | ||
); | ||
} |
33 changes: 0 additions & 33 deletions
33
frontend/src/components/features/suggestions/import-project-suggestion-box.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 2 additions & 34 deletions
36
frontend/src/routes/_oh.app/hooks/use-handle-runtime-active.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,12 @@ | ||
import React from "react"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { setImportedProjectZip } from "#/state/initial-query-slice"; | ||
import { useSelector } from "react-redux"; | ||
import { RootState } from "#/store"; | ||
import { base64ToBlob } from "#/utils/base64-to-blob"; | ||
import { useUploadFiles } from "../../../hooks/mutation/use-upload-files"; | ||
|
||
import { RUNTIME_INACTIVE_STATES } from "#/types/agent-state"; | ||
import { displayErrorToast } from "#/utils/custom-toast-handlers"; | ||
|
||
export const useHandleRuntimeActive = () => { | ||
const dispatch = useDispatch(); | ||
|
||
const { mutate: uploadFiles } = useUploadFiles(); | ||
const { curAgentState } = useSelector((state: RootState) => state.agent); | ||
|
||
const runtimeActive = !RUNTIME_INACTIVE_STATES.includes(curAgentState); | ||
|
||
const { importedProjectZip } = useSelector( | ||
(state: RootState) => state.initialQuery, | ||
); | ||
|
||
const handleUploadFiles = (zip: string) => { | ||
const blob = base64ToBlob(zip); | ||
const file = new File([blob], "imported-project.zip", { | ||
type: blob.type, | ||
}); | ||
uploadFiles( | ||
{ files: [file] }, | ||
{ | ||
onError: () => { | ||
displayErrorToast("Failed to upload project files."); | ||
}, | ||
}, | ||
); | ||
dispatch(setImportedProjectZip(null)); | ||
}; | ||
|
||
React.useEffect(() => { | ||
if (runtimeActive && importedProjectZip) { | ||
handleUploadFiles(importedProjectZip); | ||
} | ||
}, [runtimeActive, importedProjectZip]); | ||
return { runtimeActive }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, FWiW just the other day I tried it, and it did nothing. 🤷