Minor fixes
This commit is contained in:
@@ -966,7 +966,7 @@ const Apps2 = (props) => {
|
|||||||
}, [searchQuery, selectedCategory, selectedLabel, currTab]);
|
}, [searchQuery, selectedCategory, selectedLabel, currTab]);
|
||||||
|
|
||||||
|
|
||||||
const handleTabChange = (newTab) => {
|
const handleTabChange = (event, newTab) => {
|
||||||
setCurrTab(newTab);
|
setCurrTab(newTab);
|
||||||
|
|
||||||
// Apply filters immediately when changing tabs
|
// Apply filters immediately when changing tabs
|
||||||
@@ -977,12 +977,16 @@ const Apps2 = (props) => {
|
|||||||
const filteredUserApps = filterApps(userApps, searchQuery, selectedCategory, selectedLabel);
|
const filteredUserApps = filterApps(userApps, searchQuery, selectedCategory, selectedLabel);
|
||||||
setAppsToShow(filteredUserApps);
|
setAppsToShow(filteredUserApps);
|
||||||
}
|
}
|
||||||
// Note: We don't clear the search when switching to tab 2 (Discover Apps) anymore
|
|
||||||
|
|
||||||
// Update URL query params
|
// Update URL query params based on tab index
|
||||||
const newQueryParam = newTab === 0 ? 'org_apps' : newTab === 1 ? 'my_apps' : 'all_apps';
|
const tabMapping = {
|
||||||
|
0: 'org_apps',
|
||||||
|
1: 'my_apps',
|
||||||
|
2: 'all_apps'
|
||||||
|
};
|
||||||
|
|
||||||
const queryParams = new URLSearchParams(location.search);
|
const queryParams = new URLSearchParams(location.search);
|
||||||
queryParams.set('tab', newQueryParam);
|
queryParams.set('tab', tabMapping[newTab]);
|
||||||
|
|
||||||
// Maintain search query in URL regardless of tab
|
// Maintain search query in URL regardless of tab
|
||||||
if (searchQuery) {
|
if (searchQuery) {
|
||||||
@@ -991,7 +995,7 @@ const Apps2 = (props) => {
|
|||||||
queryParams.delete('q');
|
queryParams.delete('q');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.history.replaceState({}, '', `${location.pathname}?${queryParams.toString()}`);
|
navigate(`${location.pathname}?${queryParams.toString()}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update useEffect to handle initial load and URL search params
|
// Update useEffect to handle initial load and URL search params
|
||||||
@@ -1076,7 +1080,7 @@ const Apps2 = (props) => {
|
|||||||
<div style={{ borderBottom: '1px solid gray', marginBottom: 30, marginRight: 10 }}>
|
<div style={{ borderBottom: '1px solid gray', marginBottom: 30, marginRight: 10 }}>
|
||||||
<Tabs
|
<Tabs
|
||||||
value={currTab}
|
value={currTab}
|
||||||
onChange={(event, newTab) => handleTabChange(newTab)}
|
onChange={(event, newTab) => handleTabChange(event, newTab)}
|
||||||
TabIndicatorProps={{ style: { height: '3px', borderRadius: 10 } }}
|
TabIndicatorProps={{ style: { height: '3px', borderRadius: 10 } }}
|
||||||
style={{ fontFamily: "Inter" }}
|
style={{ fontFamily: "Inter" }}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user