Skip to content

Commit

Permalink
Merge pull request #109 from Gurubase/task/fixes
Browse files Browse the repository at this point in the history
Task/fixes
  • Loading branch information
aralyekta authored Feb 17, 2025
2 parents d4dd3ae + b1dd069 commit b255867
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 77 deletions.
4 changes: 3 additions & 1 deletion src/gurubase-backend/backend/core/github_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def clone_repository(repo_url):
repo_url = match.group(1)
logger.error(f"Repository not found: {repo_url}")
raise GithubInvalidRepoError(f"No repository exists at this URL.")
logger.error(f"Error cloning repository {repo_url}: {str(e)}")
elif 'No such device or address' in str(e):
raise GithubInvalidRepoError(f"No repository exists at this URL.")
logger.error(f"Error cloning repository {repo_url}: {str(e)}", exc_info=True)
raise GitHubRepoContentExtractionError(f"Failed to clone repository: {str(e)}")

def get_file_content(file_path):
Expand Down
3 changes: 1 addition & 2 deletions src/gurubase-frontend/src/components/BingeMap/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import BingeMapMobileButton from "./BingeMapMobileButton";
// Constants
const CONTAINER_HEIGHT = 400;
const PADDING = 20;
const DRAG_THRESHOLD = 5;
const DRAG_THRESHOLD = 0.05;
const MIN_SCALE = 0.5;
const MAX_SCALE = 2;

Expand Down Expand Up @@ -406,7 +406,6 @@ export function BingeMap({
currentQuestionSlug &&
parentQuestionSlug
) {

// Deep clone the tree and add streaming node to correct parent
const addStreamingNode = (node) => {
if (node.slug === parentQuestionSlug) {
Expand Down
112 changes: 47 additions & 65 deletions src/gurubase-frontend/src/components/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,16 @@ const Content = (props) => {

useEffect(() => {
if (isBingeMapOpen) {
document.body.classList.add("binge-map-open");
// Just prevent scrolling while keeping position
document.body.style.overflow = "hidden";
} else {
document.body.classList.remove("binge-map-open");
// Restore scrolling
document.body.style.overflow = "";
}

return () => {
document.body.classList.remove("binge-map-open");
// Cleanup
document.body.style.overflow = "";
};
}, [isBingeMapOpen]);

Expand Down Expand Up @@ -407,27 +410,6 @@ const Content = (props) => {
}
}, [inputValue, submitTrigger]);

useEffect(() => {
if (isBingeMapOpen) {
// Binge map açıkken body scroll'u engelle
document.body.style.overflow = "hidden";
document.body.style.position = "fixed";
document.body.style.width = "100%";
} else {
// Binge map kapandığında scroll'u geri aç
document.body.style.overflow = "";
document.body.style.position = "";
document.body.style.width = "";
}

return () => {
// Cleanup
document.body.style.overflow = "";
document.body.style.position = "";
document.body.style.width = "";
};
}, [isBingeMapOpen]);

const isAnswerValid = useAppSelector((state) => state.mainForm.isAnswerValid);
const reduxSource = useAppSelector((state) => state.mainForm.source);
const finalSource = reduxSource || source;
Expand Down Expand Up @@ -809,50 +791,50 @@ const Content = (props) => {
!streamingStatus &&
content &&
slug && (
<div
ref={slidePanel}
className={`guru-lg:hidden fixed bottom-0 left-0 right-0 border-t border-neutral-200 transition-transform duration-300 ease-in-out z-40 overflow-hidden bg-white ${
isBingeMapOpen ? "translate-y-0" : "translate-y-full"
}`}
style={{
height: "70vh",
borderTopLeftRadius: "20px",
borderTopRightRadius: "20px"
}}
onTouchEnd={onTouchEnd}
onTouchMove={onTouchMove}
onTouchStart={onTouchStart}>
<div className="flex flex-col h-full bg-white">
{/* Header - Draggable for mobile, Close button for desktop */}
<div className="p-3 flex-shrink-0 flex justify-center items-center bg-white">
{windowWidth < 768 ? ( // window.innerWidth yerine windowWidth
<div className="w-12 h-1.5 bg-neutral-300 rounded-full cursor-grab active:cursor-grabbing" />
) : (
// Close button for desktop
<button
aria-label="Close binge map"
className="absolute right-4 top-4 p-2 hover:bg-neutral-100 rounded-full transition-colors"
onClick={() => dispatch(setIsBingeMapOpen(false))}>
<X className="h-5 w-5 text-neutral-500" />
</button>
)}
</div>
<div
ref={slidePanel}
className={`guru-lg:hidden fixed bottom-0 left-0 right-0 border-t border-neutral-200 transition-transform duration-300 ease-in-out z-40 overflow-hidden bg-white ${
isBingeMapOpen ? "translate-y-0" : "translate-y-full"
}`}
style={{
height: "70vh",
borderTopLeftRadius: "20px",
borderTopRightRadius: "20px"
}}
onTouchEnd={onTouchEnd}
onTouchMove={onTouchMove}
onTouchStart={onTouchStart}>
<div className="flex flex-col h-full bg-white">
{/* Header - Draggable for mobile, Close button for desktop */}
<div className="p-3 flex-shrink-0 flex justify-center items-center bg-white">
{windowWidth < 768 ? ( // window.innerWidth yerine windowWidth
<div className="w-12 h-1.5 bg-neutral-300 rounded-full cursor-grab active:cursor-grabbing" />
) : (
// Close button for desktop
<button
aria-label="Close binge map"
className="absolute right-4 top-4 p-2 hover:bg-neutral-100 rounded-full transition-colors"
onClick={() => dispatch(setIsBingeMapOpen(false))}>
<X className="h-5 w-5 text-neutral-500" />
</button>
)}
</div>

{/* Scrollable content - will not trigger panel close */}
<div className="flex-1 overflow-y-auto overscroll-contain">
<div className="h-full p-4">
<BingeMap
bingeOutdated={bingeOutdated}
setContent={setContent}
setDescription={setDescription}
setQuestion={setQuestion}
treeData={treeData}
/>
{/* Scrollable content - will not trigger panel close */}
<div className="flex-1 overflow-y-auto overscroll-contain">
<div className="h-full p-4">
<BingeMap
bingeOutdated={bingeOutdated}
setContent={setContent}
setDescription={setDescription}
setQuestion={setQuestion}
treeData={treeData}
/>
</div>
</div>
</div>
</div>
</div>
</div>
)}
)}

{/* Overlay */}
{isBingeMapOpen && (
Expand Down
18 changes: 9 additions & 9 deletions src/gurubase-frontend/src/lib/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ export const getNavigation = () => {
push: async (path) => {
startNavigation();
try {
await router.push(path);
router.push(path);
} finally {
setTimeout(endNavigation, 500);
setTimeout(endNavigation, 1000);
}
},
replace: async (path) => {
startNavigation();
try {
await router.replace(path);
router.replace(path);
} finally {
setTimeout(endNavigation, 500);
setTimeout(endNavigation, 1000);
}
},
back: () => {
startNavigation();
try {
router.back();
} finally {
setTimeout(endNavigation, 500);
setTimeout(endNavigation, 1000);
}
},
setHref: (url) => {
Expand All @@ -67,7 +67,7 @@ export const getNavigation = () => {
pushState: (state, title, url) => {
startNavigation();
window.history.pushState(state, title, url);
setTimeout(endNavigation, 500);
setTimeout(endNavigation, 1000);
}
};
}
Expand All @@ -86,7 +86,7 @@ export const useAppNavigation = () => {
// Only start if not already navigating
startNavigation();
try {
await router.push(path);
router.push(path);
} finally {
// Increased delay to ensure the animation completes smoothly
setTimeout(endNavigation, 1000);
Expand All @@ -98,7 +98,7 @@ export const useAppNavigation = () => {
// Only start if not already navigating
startNavigation();
try {
await router.replace(path);
router.replace(path);
} finally {
// Increased delay to ensure the animation completes smoothly
setTimeout(endNavigation, 1000);
Expand Down Expand Up @@ -128,7 +128,7 @@ export const useAppNavigation = () => {
pushState: (state, title, url) => {
startNavigation();
window.history.pushState(state, title, url);
setTimeout(endNavigation, 500);
setTimeout(endNavigation, 1000);
}
};
};

0 comments on commit b255867

Please sign in to comment.