mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Fix navigation
This commit is contained in:
parent
017601c478
commit
9d8c8d5e0d
@ -14,7 +14,7 @@ import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageCon
|
||||
|
||||
const MakerPage = (): JSX.Element => {
|
||||
const { fav, windowSize, navbarHeight } = useContext<UseAppStoreType>(AppContext);
|
||||
const { federation } = useContext<UseFederationStoreType>(FederationContext);
|
||||
const { federation, setDelay } = useContext<UseFederationStoreType>(FederationContext);
|
||||
const { garage, maker } = useContext<UseGarageStoreType>(GarageContext);
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
@ -50,9 +50,10 @@ const MakerPage = (): JSX.Element => {
|
||||
maker.paymentMethods,
|
||||
]);
|
||||
|
||||
const onOrderClicked = function (id: number): void {
|
||||
const onOrderClicked = function (id: number, shortAlias: string): void {
|
||||
if (garage.getSlot()?.hashId) {
|
||||
navigate(`/order/${id}`);
|
||||
setDelay(10000);
|
||||
navigate(`/order/${shortAlias}/${id}`);
|
||||
} else {
|
||||
setOpenNoRobot(true);
|
||||
}
|
||||
|
@ -46,6 +46,10 @@ const NavBar = (): JSX.Element => {
|
||||
settings: 5,
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// re-render on orde rand robot updated at for latest orderId in tab
|
||||
}, [robotUpdatedAt]);
|
||||
|
||||
useEffect(() => {
|
||||
// change tab (page) into the current route
|
||||
const pathPage: Page | string = location.pathname.split('/')[1];
|
||||
@ -53,10 +57,10 @@ const NavBar = (): JSX.Element => {
|
||||
navigate('/robot');
|
||||
setPage('robot');
|
||||
}
|
||||
if (isPage(pathPage) && pathPage.includes('order')) {
|
||||
if (isPage(pathPage)) {
|
||||
setPage(pathPage);
|
||||
}
|
||||
}, [location, navigate, orderUpdatedAt, robotUpdatedAt]);
|
||||
}, [location]);
|
||||
|
||||
const handleSlideDirection = function (oldPage: Page, newPage: Page): void {
|
||||
const oldPos: number = pagesPosition[oldPage];
|
||||
|
Loading…
Reference in New Issue
Block a user