mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Rebase
This commit is contained in:
parent
9a8a821b7b
commit
cc63b4d57e
@ -24,7 +24,11 @@ const App = (): JSX.Element => {
|
|||||||
<GarageContextProvider>
|
<GarageContextProvider>
|
||||||
<FederationContextProvider>
|
<FederationContextProvider>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
{(window.NativeRobosats === undefined && window.RobosatsClient === undefined )? <HostAlert /> : <TorConnectionBadge />}
|
{window.NativeRobosats === undefined && window.RobosatsClient === undefined ? (
|
||||||
|
<HostAlert />
|
||||||
|
) : (
|
||||||
|
<TorConnectionBadge />
|
||||||
|
)}
|
||||||
<Main />
|
<Main />
|
||||||
</FederationContextProvider>
|
</FederationContextProvider>
|
||||||
</GarageContextProvider>
|
</GarageContextProvider>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { MemoryRouter,HashRouter ,BrowserRouter, Routes, Route } from 'react-router-dom';
|
import { MemoryRouter, HashRouter, BrowserRouter } from 'react-router-dom';
|
||||||
import { Box, Slide, Typography, styled } from '@mui/material';
|
import { Box, Typography, styled } from '@mui/material';
|
||||||
import { type UseAppStoreType, AppContext, closeAll } from '../contexts/AppContext';
|
import { type UseAppStoreType, AppContext, closeAll } from '../contexts/AppContext';
|
||||||
|
|
||||||
import { NavBar, MainDialogs } from './';
|
import { NavBar, MainDialogs } from './';
|
||||||
@ -11,7 +11,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
|
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
|
||||||
import Routes from './Routes';
|
import Routes from './Routes';
|
||||||
|
|
||||||
function getRouter() {
|
const getRouter = (): any => {
|
||||||
if (window.NativeRobosats === undefined && window.RobosatsClient === undefined) {
|
if (window.NativeRobosats === undefined && window.RobosatsClient === undefined) {
|
||||||
return BrowserRouter;
|
return BrowserRouter;
|
||||||
} else if (window.RobosatsClient === 'desktop-app') {
|
} else if (window.RobosatsClient === 'desktop-app') {
|
||||||
@ -19,7 +19,7 @@ function getRouter() {
|
|||||||
} else {
|
} else {
|
||||||
return MemoryRouter;
|
return MemoryRouter;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
const Router = getRouter();
|
const Router = getRouter();
|
||||||
|
|
||||||
const TestnetTypography = styled(Typography)({
|
const TestnetTypography = styled(Typography)({
|
||||||
@ -39,7 +39,7 @@ const MainBox = styled(Box)<MainBoxProps>((props) => ({
|
|||||||
|
|
||||||
const Main: React.FC = () => {
|
const Main: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { settings, page, slideDirection, setOpen, windowSize, navbarHeight } =
|
const { settings, page, setOpen, windowSize, navbarHeight } =
|
||||||
useContext<UseAppStoreType>(AppContext);
|
useContext<UseAppStoreType>(AppContext);
|
||||||
const { garage } = useContext<UseGarageStoreType>(GarageContext);
|
const { garage } = useContext<UseGarageStoreType>(GarageContext);
|
||||||
|
|
||||||
@ -63,87 +63,7 @@ const Main: React.FC = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<MainBox navbarHeight={navbarHeight}>
|
<MainBox navbarHeight={navbarHeight}>
|
||||||
<Routes>
|
<Routes />
|
||||||
{['/robot/:token?', '/', ''].map((path, index) => {
|
|
||||||
return (
|
|
||||||
<Route
|
|
||||||
path={path}
|
|
||||||
element={
|
|
||||||
<Slide
|
|
||||||
direction={page === 'robot' ? slideDirection.in : slideDirection.out}
|
|
||||||
in={page === 'robot'}
|
|
||||||
appear={slideDirection.in !== undefined}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<RobotPage />
|
|
||||||
</div>
|
|
||||||
</Slide>
|
|
||||||
}
|
|
||||||
key={index}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
|
|
||||||
<Route
|
|
||||||
path={'/offers'}
|
|
||||||
element={
|
|
||||||
<Slide
|
|
||||||
direction={page === 'offers' ? slideDirection.in : slideDirection.out}
|
|
||||||
in={page === 'offers'}
|
|
||||||
appear={slideDirection.in !== undefined}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<BookPage />
|
|
||||||
</div>
|
|
||||||
</Slide>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Route
|
|
||||||
path='/create'
|
|
||||||
element={
|
|
||||||
<Slide
|
|
||||||
direction={page === 'create' ? slideDirection.in : slideDirection.out}
|
|
||||||
in={page === 'create'}
|
|
||||||
appear={slideDirection.in !== undefined}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<MakerPage />
|
|
||||||
</div>
|
|
||||||
</Slide>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Route
|
|
||||||
path='/order/:shortAlias/:orderId'
|
|
||||||
element={
|
|
||||||
<Slide
|
|
||||||
direction={page === 'order' ? slideDirection.in : slideDirection.out}
|
|
||||||
in={page === 'order'}
|
|
||||||
appear={slideDirection.in !== undefined}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<OrderPage />
|
|
||||||
</div>
|
|
||||||
</Slide>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Route
|
|
||||||
path='/settings'
|
|
||||||
element={
|
|
||||||
<Slide
|
|
||||||
direction={page === 'settings' ? slideDirection.in : slideDirection.out}
|
|
||||||
in={page === 'settings'}
|
|
||||||
appear={slideDirection.in !== undefined}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<SettingsPage />
|
|
||||||
</div>
|
|
||||||
</Slide>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Routes>
|
|
||||||
</MainBox>
|
</MainBox>
|
||||||
<NavBar />
|
<NavBar />
|
||||||
<MainDialogs />
|
<MainDialogs />
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import React, { useContext, useEffect } from 'react';
|
import React, { useContext, useEffect } from 'react';
|
||||||
import { Routes as DomRoutes, Route, useNavigate } from 'react-router-dom';
|
import { Routes as DomRoutes, Route, useNavigate } from 'react-router-dom';
|
||||||
import { Box, Slide, Typography, styled } from '@mui/material';
|
import { Slide } from '@mui/material';
|
||||||
import { type UseAppStoreType, AppContext } from '../contexts/AppContext';
|
import { type UseAppStoreType, AppContext } from '../contexts/AppContext';
|
||||||
|
|
||||||
import { RobotPage, MakerPage, BookPage, OrderPage, SettingsPage } from '.';
|
import { RobotPage, MakerPage, BookPage, OrderPage, SettingsPage } from '.';
|
||||||
import { GarageContext, UseGarageStoreType } from '../contexts/GarageContext';
|
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
|
||||||
|
|
||||||
const Routes: React.FC = () => {
|
const Routes: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -14,8 +14,8 @@ const Routes: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener('navigateToPage', (event) => {
|
window.addEventListener('navigateToPage', (event) => {
|
||||||
console.log('navigateToPage', JSON.stringify(event));
|
console.log('navigateToPage', JSON.stringify(event));
|
||||||
const orderId = event?.detail?.order_id;
|
const orderId: string = event?.detail?.order_id;
|
||||||
const coordinator = event?.detail?.coordinator;
|
const coordinator: string = event?.detail?.coordinator;
|
||||||
if (orderId && coordinator) {
|
if (orderId && coordinator) {
|
||||||
const slot = garage.getSlotByOrder(coordinator, orderId);
|
const slot = garage.getSlotByOrder(coordinator, orderId);
|
||||||
if (slot?.token) {
|
if (slot?.token) {
|
||||||
|
@ -174,8 +174,8 @@ const OrderDetails = ({
|
|||||||
|
|
||||||
const isBuyer = (order.type === 0 && order.is_maker) || (order.type === 1 && !order.is_maker);
|
const isBuyer = (order.type === 0 && order.is_maker) || (order.type === 1 && !order.is_maker);
|
||||||
const tradeFee = order.is_maker
|
const tradeFee = order.is_maker
|
||||||
? (coordinator.info?.maker_fee ?? 0)
|
? coordinator.info?.maker_fee ?? 0
|
||||||
: (coordinator.info?.taker_fee ?? 0);
|
: coordinator.info?.taker_fee ?? 0;
|
||||||
const defaultRoutingBudget = 0.001;
|
const defaultRoutingBudget = 0.001;
|
||||||
const btc_now = order.satoshis_now / 100000000;
|
const btc_now = order.satoshis_now / 100000000;
|
||||||
const rate = Number(order.max_amount ?? order.amount) / btc_now;
|
const rate = Number(order.max_amount ?? order.amount) / btc_now;
|
||||||
|
@ -39,7 +39,7 @@ const audioPath =
|
|||||||
window.NativeRobosats === undefined
|
window.NativeRobosats === undefined
|
||||||
? '/static/assets/sounds'
|
? '/static/assets/sounds'
|
||||||
: 'file:///android_asset/Web.bundle/assets/sounds';
|
: 'file:///android_asset/Web.bundle/assets/sounds';
|
||||||
|
|
||||||
const EncryptedTurtleChat: React.FC<Props> = ({
|
const EncryptedTurtleChat: React.FC<Props> = ({
|
||||||
order,
|
order,
|
||||||
userNick,
|
userNick,
|
||||||
|
@ -76,20 +76,13 @@ const makeTheme = function (settings: Settings): Theme {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getHostUrl = (network = 'mainnet'): string => {
|
const getHostUrl = (network = 'mainnet'): string => {
|
||||||
let host = '';
|
let host = defaultFederation.exp[network].onion;
|
||||||
let protocol = '';
|
let protocol = 'http:';
|
||||||
if(isDesktopRoboSats){
|
if (window.NativeRobosats === undefined) {
|
||||||
host = defaultFederation.exp[network].onion;
|
|
||||||
protocol = 'http:';
|
|
||||||
}
|
|
||||||
else if (window.NativeRobosats === undefined) {
|
|
||||||
host = getHost();
|
host = getHost();
|
||||||
protocol = location.protocol;
|
protocol = location.protocol;
|
||||||
} else {
|
|
||||||
host = defaultFederation.exp[network].onion;
|
|
||||||
protocol = 'http:';
|
|
||||||
}
|
}
|
||||||
const hostUrl = `${host}`;
|
const hostUrl = `${protocol}//${host}`;
|
||||||
return hostUrl;
|
return hostUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class Garage {
|
|||||||
// Slots
|
// Slots
|
||||||
getSlot: (token?: string) => Slot | null = (token) => {
|
getSlot: (token?: string) => Slot | null = (token) => {
|
||||||
const currentToken = token ?? this.currentSlot;
|
const currentToken = token ?? this.currentSlot;
|
||||||
return currentToken ? (this.slots[currentToken] ?? null) : null;
|
return currentToken ? this.slots[currentToken] ?? null : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteSlot: (token?: string) => void = (token) => {
|
deleteSlot: (token?: string) => void = (token) => {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { redirect } from 'react-router-dom';
|
|
||||||
import {
|
import {
|
||||||
type NativeRobosatsPromise,
|
type NativeRobosatsPromise,
|
||||||
type NativeWebViewMessage,
|
type NativeWebViewMessage,
|
||||||
|
@ -250,7 +250,7 @@
|
|||||||
"Tell us about a new feature or a bug": "Proposa funcionalitats o notifica errors",
|
"Tell us about a new feature or a bug": "Proposa funcionalitats o notifica errors",
|
||||||
"We are abandoning Telegram! Our old TG groups": "Estem deixant Telegram! Els nostres grups antics de TG",
|
"We are abandoning Telegram! Our old TG groups": "Estem deixant Telegram! Els nostres grups antics de TG",
|
||||||
"X Official Account": "Compte oficial a X",
|
"X Official Account": "Compte oficial a X",
|
||||||
"#23": "Phrases in components/Dialogs/Coordinator.tsx",
|
"#24": "Phrases in components/Dialogs/Coordinator.tsx",
|
||||||
"...Opening on Nostr gateway. Pubkey copied!": "...Obrint la passarel·la Nostr. Clau pública copiada!",
|
"...Opening on Nostr gateway. Pubkey copied!": "...Obrint la passarel·la Nostr. Clau pública copiada!",
|
||||||
"24h contracted volume": "Volum contractat en 24h",
|
"24h contracted volume": "Volum contractat en 24h",
|
||||||
"24h non-KYC bitcoin premium": "Prima de bitcoin sense KYC en 24h",
|
"24h non-KYC bitcoin premium": "Prima de bitcoin sense KYC en 24h",
|
||||||
@ -475,7 +475,7 @@
|
|||||||
"You send via Lightning {{amount}} Sats (Approx)": "Tu envies via Lightning {{amount}} Sats (Approx)",
|
"You send via Lightning {{amount}} Sats (Approx)": "Tu envies via Lightning {{amount}} Sats (Approx)",
|
||||||
"You send via {{method}} {{amount}}": "Envies via {{method}} {{amount}}",
|
"You send via {{method}} {{amount}}": "Envies via {{method}} {{amount}}",
|
||||||
"{{price}} {{currencyCode}}/BTC - Premium: {{premium}}%": "{{price}} {{currencyCode}}/BTC - Prima: {{premium}}%",
|
"{{price}} {{currencyCode}}/BTC - Premium: {{premium}}%": "{{price}} {{currencyCode}}/BTC - Prima: {{premium}}%",
|
||||||
"#42": "Phrases in components/RobotInfo/index.tsx",
|
"#43": "Phrases in components/RobotInfo/index.tsx",
|
||||||
"Active order!": "Active order!",
|
"Active order!": "Active order!",
|
||||||
"Claim": "Retirar",
|
"Claim": "Retirar",
|
||||||
"Claim Sats!": "Reclamar Sats!",
|
"Claim Sats!": "Reclamar Sats!",
|
||||||
|
Loading…
Reference in New Issue
Block a user