Skip to content
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

add share menu #611

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions map/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
EXPLORE_URL,
OLD_LOGIN_URL,
TRAVEL_URL,
SHARE_FILE_URL,
} from './manager/GlobalManager';
import ExploreMenu from './menu/search/explore/ExploreMenu';
import SearchMenu from './menu/search/SearchMenu';
Expand All @@ -34,6 +35,7 @@ import SettingsMenu from './menu/settings/SettingsMenu';
import ConfigureMap from './menu/configuremap/ConfigureMap';
import LoginMenu from './menu/login/LoginMenu';
import TravelMenu from './menu/travel/TravelMenu';
import ShareFile from './menu/share/ShareFile';

export let globalNavigate = () => null;

Expand Down Expand Up @@ -67,6 +69,7 @@ const App = () => {
<Route path={PLANROUTE_URL} element={<PlanRouteMenu />}></Route>
<Route path={TRAVEL_URL} element={<TravelMenu />}></Route>
<Route path={SETTINGS_URL} element={<SettingsMenu />}></Route>
<Route path={SHARE_FILE_URL} element={<ShareFile />}></Route>
</Route>
</Routes>
</BrowserRouter>
Expand Down
5 changes: 5 additions & 0 deletions map/src/assets/icons/ic_action_done.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions map/src/assets/icons/ic_action_file_unknown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions map/src/assets/icons/ic_action_remove_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions map/src/assets/icons/ic_action_sand_clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions map/src/assets/icons/ic_group.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions map/src/context/AppContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const OBJECT_SEARCH = 'search';
export const OBJECT_GLOBAL_SETTINGS = 'global_settings';
export const LOCAL_STORAGE_CONFIGURE_MAP = 'configureMap';
export const OBJECT_TYPE_TRAVEL = 'travel';
export const OBJECT_TYPE_SHARE_FILE = 'share_file';

export const defaultConfigureMapStateValues = {
showFavorites: true,
Expand Down Expand Up @@ -300,6 +301,11 @@ export const AppContextProvider = (props) => {
const [travelFilter, setTravelFilter] = useState(null);
const [searchTravelRoutes, setSearchTravelRoutes] = useState(null);
const [selectedTravelRoute, setSelectedTravelRoute] = useState(null);
// share
const [shareFile, setShareFile] = useState(null);
const [updatedRequestList, setUpdatedRequestList] = useState([]);
const [shareFileMarkers, setShareFileMarkers] = useState(null);
const [shareFilesCache, setShareFilesCache] = useState({});

const [selectedGpxFile, setSelectedGpxFile] = useState({});
const [unverifiedGpxFile, setUnverifiedGpxFile] = useState(null); // see Effect in LocalClientTrackLayer
Expand Down Expand Up @@ -689,6 +695,14 @@ export const AppContextProvider = (props) => {
setSelectedSearchMarker,
zoomToMapObj,
setZoomToMapObj,
shareFile,
setShareFile,
updatedRequestList,
setUpdatedRequestList,
shareFileMarkers,
setShareFileMarkers,
shareFilesCache,
setShareFilesCache,
}}
>
{props.children}
Expand Down
32 changes: 30 additions & 2 deletions map/src/infoblock/components/InformationBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import { TabContext, TabList } from '@mui/lab';
import TrackTabList from './tabs/TrackTabList';
import _, { isEmpty } from 'lodash';
import { hasSegmentTurns } from '../../manager/track/TracksManager';
import { MENU_INFO_CLOSE_SIZE } from '../../manager/GlobalManager';
import { MENU_INFO_CLOSE_SIZE, SHARE_FILE_MAIN_URL } from '../../manager/GlobalManager';
import { ReactComponent as BackIcon } from '../../assets/icons/ic_arrow_back.svg';
import styles from '../../menu/trackfavmenu.module.css';
import { isVisibleTrack } from '../../menu/visibletracks/VisibleTracks';
import WeatherForecastDetails from '../../menu/weather/WeatherForecastDetails';
import WptDetails from './wpt/WptDetails';
import WptPhotoList from './wpt/WptPhotoList';
import ShareFileMenu from '../../menu/share/ShareFileMenu';
import ShareFile from '../../menu/share/ShareFile';

const PersistentTabPanel = ({ tabId, selectedTabId, children }) => {
const [mounted, setMounted] = useState(false);
Expand Down Expand Up @@ -47,6 +49,8 @@ export default function InformationBlock({ showInfoBlock, setShowInfoBlock, setC
const [openWeatherForecastDetails, setOpenWeatherForecastDetails] = useState(false);
const [openWptDetails, setOpenWptDetails] = useState(false);
const [openWptTab, setOpenWptTab] = useState(false);
const [openShareFileMenu, setOpenShareFileMenu] = useState(false);
const [openShareFileItem, setOpenShareFileItem] = useState(false);

/**
* Handle Escape key to close PointContextMenu.
Expand Down Expand Up @@ -88,6 +92,14 @@ export default function InformationBlock({ showInfoBlock, setShowInfoBlock, setC
ctx.mutateFitBoundsPadding((o) => (o.left = padding));
}, [showInfoBlock]);

useEffect(() => {
if (location.pathname.includes(SHARE_FILE_MAIN_URL)) {
setOpenShareFileItem(true);
} else {
setOpenShareFileItem(false);
}
}, [showInfoBlock]);

// detect leaving from Local Track Editor when another kind of object type is activated
useEffect(() => {
if (ctx.currentObjectType && isLocalTrack(ctx) === false && ctx.createTrack) {
Expand Down Expand Up @@ -146,6 +158,15 @@ export default function InformationBlock({ showInfoBlock, setShowInfoBlock, setC
}
}, [ctx.selectedWpt]);

useEffect(() => {
if (ctx.shareFile) {
setShowInfoBlock(true);
setOpenShareFileMenu(true);
} else {
setOpenShareFileMenu(false);
}
}, [ctx.shareFile]);

useEffect(() => {
if (!ctx.loginUser) {
setShowInfoBlock(false);
Expand Down Expand Up @@ -195,7 +216,12 @@ export default function InformationBlock({ showInfoBlock, setShowInfoBlock, setC
}

function hasOldTabs() {
return !openWeatherForecastDetails && !openWptDetails;
return !openWeatherForecastDetails && !openWptDetails && !openShareFileMenu;
}

function isOpenMainFavShareFile() {
const isCloseFavItemDetails = !ctx.selectedGpxFile?.markerCurrent;
return openShareFileItem && isCloseFavItemDetails;
}

return (
Expand All @@ -215,6 +241,8 @@ export default function InformationBlock({ showInfoBlock, setShowInfoBlock, setC
setShowInfoBlock={setShowInfoBlock}
/>
))}
{openShareFileMenu && <ShareFileMenu setShowInfoBlock={setShowInfoBlock} />}
{isOpenMainFavShareFile() && <ShareFile />}
{hasOldTabs() && (
<Box anchor={'right'} sx={{ height: 'auto', width: getWidth(), overflowX: 'hidden' }}>
<div id="se-infoblock-all">
Expand Down
159 changes: 0 additions & 159 deletions map/src/infoblock/components/tabs/FavoriteInfoTab.jsx

This file was deleted.

28 changes: 0 additions & 28 deletions map/src/infoblock/components/tabs/FavoritesTabList.js

This file was deleted.

Loading