Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docs/header-menu-jsons/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "/docs/lightning/"
},
{
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>TOR Network</span>",
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>Tor Network</span>",
"url": "/docs/tor/"
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/header-menu-jsons/navigation_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "/docs/es/lightning/"
},
{
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>La red TOR</span>",
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>La red Tor</span>",
"url": "/docs/es/tor/"
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/header-menu-jsons/navigation_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "/docs/fr/lightning/"
},
{
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>TOR Network</span>",
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>Tor Network</span>",
"url": "/docs/fr/tor/"
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/header-menu-jsons/navigation_pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "/docs/pt/lightning/"
},
{
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>A rede TOR</span>",
"title": "<span class=\"side-bar-item\">&nbsp;&nbsp;<img id=\"side-icon-small\" src=\"/assets/vector/tor.svg\"/>A rede Tor</span>",
"url": "/docs/pt/tor/"
},
{
Expand Down
14 changes: 14 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"reconnecting-websocket": "^4.4.0",
"robo-identities-wasm": "^0.1.0",
"simple-plist": "^1.3.1",
"uuid": "^11.1.0",
"webln": "^0.3.2",
"websocket": "^1.0.35"
}
Expand Down
11 changes: 1 addition & 10 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ReactDOM from 'react-dom/client';
import Main from './basic/Main';
import { CssBaseline } from '@mui/material';
import HostAlert from './components/HostAlert';
import TorConnectionBadge from './components/TorConnection';

import { I18nextProvider } from 'react-i18next';
import i18n from './i18n/Web';
Expand All @@ -13,7 +12,6 @@ import ErrorBoundary from './components/ErrorBoundary';
import { AppContextProvider } from './contexts/AppContext';
import { GarageContextProvider } from './contexts/GarageContext';
import { FederationContextProvider } from './contexts/FederationContext';
import NotificationSwitchBadge from './components/NotificationSwitch';

const App = (): React.JSX.Element => {
const [client] = window.RobosatsSettings.split('-');
Expand All @@ -26,14 +24,7 @@ const App = (): React.JSX.Element => {
<FederationContextProvider>
<GarageContextProvider>
<CssBaseline />
{client === 'mobile' ? (
<div style={{ display: 'inline-flex', position: 'fixed', top: '0.5em' }}>
<TorConnectionBadge />
<NotificationSwitchBadge />
</div>
) : (
<HostAlert />
)}
{client !== 'mobile' && <HostAlert />}
<Main />
</GarageContextProvider>
</FederationContextProvider>
Expand Down
129 changes: 0 additions & 129 deletions frontend/src/basic/DesktopBar/index.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions frontend/src/basic/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const MainBox = styled(Box)<MainBoxProps>((props) => ({

const Main: React.FC = () => {
const { t } = useTranslation();
const { settings, page, setOpen, windowSize, navbarHeight, client } =
const { settings, page, setOpen, windowSize, navbarHeight } =
useContext<UseAppStoreType>(AppContext);
const { garage } = useContext<UseGarageStoreType>(GarageContext);

Expand All @@ -65,7 +65,7 @@ const Main: React.FC = () => {
<></>
)}
<NavBar />
<MainBox navbarHeight={navbarHeight} style={{ paddingTop: client === 'mobile' ? '25px' : 0 }}>
<MainBox navbarHeight={navbarHeight}>
<Routes />
</MainBox>
<MainDialogs />
Expand Down
59 changes: 57 additions & 2 deletions frontend/src/basic/NavBar/AppBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Fab,
Button,
Collapse,
CircularProgress,
} from '@mui/material';
import { useTranslation } from 'react-i18next';
import {
Expand All @@ -36,7 +37,7 @@ import { UseGarageStoreType, GarageContext } from '../../../contexts/GarageConte
import { Page } from '..';
import RobotAvatar from '../../../components/RobotAvatar';
import { AppContext, closeAll, UseAppStoreType } from '../../../contexts/AppContext';
import { RoboSatsTextIcon } from '../../../components/Icons';
import { RoboSatsTextIcon, TorIcon } from '../../../components/Icons';
import { genBase62Token } from '../../../utils';
import { UseFederationStoreType, FederationContext } from '../../../contexts/FederationContext';

Expand All @@ -48,13 +49,35 @@ const AppBar = ({ changePage }: AppBarProps): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
const { garage } = useContext<UseGarageStoreType>(GarageContext);
const { open, setOpen, page } = useContext<UseAppStoreType>(AppContext);
const { open, setOpen, page, torStatus, client } = useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);
const [show, setShow] = useState<boolean>(false);
const [openGarage, setOpenGarage] = useState<boolean>(false);

const [torColor, setTorColor] = useState<
'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'inherit'
>('error');
const [torProgress, setTorProgress] = useState<boolean>(true);
const [torTitle, setTorTitle] = useState<string>(t('Connection error'));

const slot = garage.getSlot();

useEffect(() => {
if (torStatus === 'OFF' || torStatus === 'STOPPING') {
setTorColor('primary');
setTorProgress(true);
setTorTitle(t('Initializing Tor daemon'));
} else if (torStatus === 'STARTING') {
setTorColor('warning');
setTorProgress(true);
setTorTitle(t('Connecting to Tor network'));
} else if (torStatus === 'ON') {
setTorColor('success');
setTorProgress(false);
setTorTitle(t('Connected to Tor network'));
}
}, [torStatus]);

const onSectionClick = (newPage: Page) => {
setShow(false);
changePage(newPage);
Expand Down Expand Up @@ -274,6 +297,38 @@ const AppBar = ({ changePage }: AppBarProps): React.JSX.Element => {
</ListItemButton>
</ListItem>
<div style={{ flexGrow: 1 }} />
{client === 'mobile' && (
<ListItem disablePadding sx={{ display: 'flex', flexDirection: 'column' }}>
<ListItemButton selected>
<ListItemIcon>
{torProgress ? (
<>
<CircularProgress color={torColor} thickness={6} size={22} />
<Box
sx={{
top: 0,
left: 0,
bottom: 0,
right: 0,
position: 'absolute',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<TorIcon color={torColor} sx={{ width: 20, height: 20 }} />
</Box>
</>
) : (
<Box>
<TorIcon color={torColor} sx={{ width: 20, height: 20 }} />
</Box>
)}
</ListItemIcon>
<ListItemText primary={torTitle} />
</ListItemButton>
</ListItem>
)}
<ListItem disablePadding sx={{ display: 'flex', flexDirection: 'column' }}>
<svg width={0} height={0}>
<linearGradient id='linearColors' x1={1} y1={0} x2={1} y2={1}>
Expand Down
17 changes: 13 additions & 4 deletions frontend/src/basic/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ const NavBar = (): React.JSX.Element => {
const navigate = useNavigate();
const location = useLocation();

const pagesPosition = {
robot: 1,
const pagesPositionWeb = {
garage: 1,
offers: 2,
create: 3,
order: 4,
settings: 5,
};

const pagesPositionMobile = {
garage: 5,
offers: 4,
order: 3,
create: 2,
settings: 1,
};

useEffect(() => {
// change tab (page) into the current route
const pathPage: Page | string = location.pathname.split('/')[1];
Expand All @@ -42,8 +50,9 @@ const NavBar = (): React.JSX.Element => {
}, [location]);

const handleSlideDirection = function (oldPage: Page, newPage: Page): void {
const oldPos: number = pagesPosition[oldPage];
const newPos: number = pagesPosition[newPage];
const position = mobileView ? pagesPositionMobile : pagesPositionWeb;
const oldPos: number = position[oldPage];
const newPos: number = position[newPage];
setSlideDirection(
newPos > oldPos ? { in: 'left', out: 'right' } : { in: 'right', out: 'left' },
);
Expand Down
Loading