Skip to content

Commit cc63b4d

Browse files
committed
Rebase
1 parent 9a8a821 commit cc63b4d

File tree

9 files changed

+25
-109
lines changed

9 files changed

+25
-109
lines changed

frontend/src/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ const App = (): JSX.Element => {
2424
<GarageContextProvider>
2525
<FederationContextProvider>
2626
<CssBaseline />
27-
{(window.NativeRobosats === undefined && window.RobosatsClient === undefined )? <HostAlert /> : <TorConnectionBadge />}
27+
{window.NativeRobosats === undefined && window.RobosatsClient === undefined ? (
28+
<HostAlert />
29+
) : (
30+
<TorConnectionBadge />
31+
)}
2832
<Main />
2933
</FederationContextProvider>
3034
</GarageContextProvider>

frontend/src/basic/Main.tsx

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useContext } from 'react';
2-
import { MemoryRouter,HashRouter ,BrowserRouter, Routes, Route } from 'react-router-dom';
3-
import { Box, Slide, Typography, styled } from '@mui/material';
2+
import { MemoryRouter, HashRouter, BrowserRouter } from 'react-router-dom';
3+
import { Box, Typography, styled } from '@mui/material';
44
import { type UseAppStoreType, AppContext, closeAll } from '../contexts/AppContext';
55

66
import { NavBar, MainDialogs } from './';
@@ -11,15 +11,15 @@ import { useTranslation } from 'react-i18next';
1111
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
1212
import Routes from './Routes';
1313

14-
function getRouter() {
14+
const getRouter = (): any => {
1515
if (window.NativeRobosats === undefined && window.RobosatsClient === undefined) {
1616
return BrowserRouter;
1717
} else if (window.RobosatsClient === 'desktop-app') {
1818
return HashRouter;
1919
} else {
2020
return MemoryRouter;
2121
}
22-
}
22+
};
2323
const Router = getRouter();
2424

2525
const TestnetTypography = styled(Typography)({
@@ -39,7 +39,7 @@ const MainBox = styled(Box)<MainBoxProps>((props) => ({
3939

4040
const Main: React.FC = () => {
4141
const { t } = useTranslation();
42-
const { settings, page, slideDirection, setOpen, windowSize, navbarHeight } =
42+
const { settings, page, setOpen, windowSize, navbarHeight } =
4343
useContext<UseAppStoreType>(AppContext);
4444
const { garage } = useContext<UseGarageStoreType>(GarageContext);
4545

@@ -63,87 +63,7 @@ const Main: React.FC = () => {
6363
)}
6464

6565
<MainBox navbarHeight={navbarHeight}>
66-
<Routes>
67-
{['/robot/:token?', '/', ''].map((path, index) => {
68-
return (
69-
<Route
70-
path={path}
71-
element={
72-
<Slide
73-
direction={page === 'robot' ? slideDirection.in : slideDirection.out}
74-
in={page === 'robot'}
75-
appear={slideDirection.in !== undefined}
76-
>
77-
<div>
78-
<RobotPage />
79-
</div>
80-
</Slide>
81-
}
82-
key={index}
83-
/>
84-
);
85-
})}
86-
87-
<Route
88-
path={'/offers'}
89-
element={
90-
<Slide
91-
direction={page === 'offers' ? slideDirection.in : slideDirection.out}
92-
in={page === 'offers'}
93-
appear={slideDirection.in !== undefined}
94-
>
95-
<div>
96-
<BookPage />
97-
</div>
98-
</Slide>
99-
}
100-
/>
101-
102-
<Route
103-
path='/create'
104-
element={
105-
<Slide
106-
direction={page === 'create' ? slideDirection.in : slideDirection.out}
107-
in={page === 'create'}
108-
appear={slideDirection.in !== undefined}
109-
>
110-
<div>
111-
<MakerPage />
112-
</div>
113-
</Slide>
114-
}
115-
/>
116-
117-
<Route
118-
path='/order/:shortAlias/:orderId'
119-
element={
120-
<Slide
121-
direction={page === 'order' ? slideDirection.in : slideDirection.out}
122-
in={page === 'order'}
123-
appear={slideDirection.in !== undefined}
124-
>
125-
<div>
126-
<OrderPage />
127-
</div>
128-
</Slide>
129-
}
130-
/>
131-
132-
<Route
133-
path='/settings'
134-
element={
135-
<Slide
136-
direction={page === 'settings' ? slideDirection.in : slideDirection.out}
137-
in={page === 'settings'}
138-
appear={slideDirection.in !== undefined}
139-
>
140-
<div>
141-
<SettingsPage />
142-
</div>
143-
</Slide>
144-
}
145-
/>
146-
</Routes>
66+
<Routes />
14767
</MainBox>
14868
<NavBar />
14969
<MainDialogs />

frontend/src/basic/Routes.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useContext, useEffect } from 'react';
22
import { Routes as DomRoutes, Route, useNavigate } from 'react-router-dom';
3-
import { Box, Slide, Typography, styled } from '@mui/material';
3+
import { Slide } from '@mui/material';
44
import { type UseAppStoreType, AppContext } from '../contexts/AppContext';
55

66
import { RobotPage, MakerPage, BookPage, OrderPage, SettingsPage } from '.';
7-
import { GarageContext, UseGarageStoreType } from '../contexts/GarageContext';
7+
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
88

99
const Routes: React.FC = () => {
1010
const navigate = useNavigate();
@@ -14,8 +14,8 @@ const Routes: React.FC = () => {
1414
useEffect(() => {
1515
window.addEventListener('navigateToPage', (event) => {
1616
console.log('navigateToPage', JSON.stringify(event));
17-
const orderId = event?.detail?.order_id;
18-
const coordinator = event?.detail?.coordinator;
17+
const orderId: string = event?.detail?.order_id;
18+
const coordinator: string = event?.detail?.coordinator;
1919
if (orderId && coordinator) {
2020
const slot = garage.getSlotByOrder(coordinator, orderId);
2121
if (slot?.token) {

frontend/src/components/OrderDetails/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ const OrderDetails = ({
174174

175175
const isBuyer = (order.type === 0 && order.is_maker) || (order.type === 1 && !order.is_maker);
176176
const tradeFee = order.is_maker
177-
? (coordinator.info?.maker_fee ?? 0)
178-
: (coordinator.info?.taker_fee ?? 0);
177+
? coordinator.info?.maker_fee ?? 0
178+
: coordinator.info?.taker_fee ?? 0;
179179
const defaultRoutingBudget = 0.001;
180180
const btc_now = order.satoshis_now / 100000000;
181181
const rate = Number(order.max_amount ?? order.amount) / btc_now;

frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const audioPath =
3939
window.NativeRobosats === undefined
4040
? '/static/assets/sounds'
4141
: 'file:///android_asset/Web.bundle/assets/sounds';
42-
42+
4343
const EncryptedTurtleChat: React.FC<Props> = ({
4444
order,
4545
userNick,

frontend/src/contexts/AppContext.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,13 @@ const makeTheme = function (settings: Settings): Theme {
7676
};
7777

7878
const getHostUrl = (network = 'mainnet'): string => {
79-
let host = '';
80-
let protocol = '';
81-
if(isDesktopRoboSats){
82-
host = defaultFederation.exp[network].onion;
83-
protocol = 'http:';
84-
}
85-
else if (window.NativeRobosats === undefined) {
79+
let host = defaultFederation.exp[network].onion;
80+
let protocol = 'http:';
81+
if (window.NativeRobosats === undefined) {
8682
host = getHost();
8783
protocol = location.protocol;
88-
} else {
89-
host = defaultFederation.exp[network].onion;
90-
protocol = 'http:';
9184
}
92-
const hostUrl = `${host}`;
85+
const hostUrl = `${protocol}//${host}`;
9386
return hostUrl;
9487
};
9588

frontend/src/models/Garage.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Garage {
8383
// Slots
8484
getSlot: (token?: string) => Slot | null = (token) => {
8585
const currentToken = token ?? this.currentSlot;
86-
return currentToken ? (this.slots[currentToken] ?? null) : null;
86+
return currentToken ? this.slots[currentToken] ?? null : null;
8787
};
8888

8989
deleteSlot: (token?: string) => void = (token) => {

frontend/src/services/Native/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { redirect } from 'react-router-dom';
21
import {
32
type NativeRobosatsPromise,
43
type NativeWebViewMessage,

frontend/static/locales/ca.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
"Tell us about a new feature or a bug": "Proposa funcionalitats o notifica errors",
251251
"We are abandoning Telegram! Our old TG groups": "Estem deixant Telegram! Els nostres grups antics de TG",
252252
"X Official Account": "Compte oficial a X",
253-
"#23": "Phrases in components/Dialogs/Coordinator.tsx",
253+
"#24": "Phrases in components/Dialogs/Coordinator.tsx",
254254
"...Opening on Nostr gateway. Pubkey copied!": "...Obrint la passarel·la Nostr. Clau pública copiada!",
255255
"24h contracted volume": "Volum contractat en 24h",
256256
"24h non-KYC bitcoin premium": "Prima de bitcoin sense KYC en 24h",
@@ -475,7 +475,7 @@
475475
"You send via Lightning {{amount}} Sats (Approx)": "Tu envies via Lightning {{amount}} Sats (Approx)",
476476
"You send via {{method}} {{amount}}": "Envies via {{method}} {{amount}}",
477477
"{{price}} {{currencyCode}}/BTC - Premium: {{premium}}%": "{{price}} {{currencyCode}}/BTC - Prima: {{premium}}%",
478-
"#42": "Phrases in components/RobotInfo/index.tsx",
478+
"#43": "Phrases in components/RobotInfo/index.tsx",
479479
"Active order!": "Active order!",
480480
"Claim": "Retirar",
481481
"Claim Sats!": "Reclamar Sats!",

0 commit comments

Comments
 (0)