Skip to content

Commit

Permalink
Merge pull request #60 from tonkeeper/feature/pro-dashboard
Browse files Browse the repository at this point in the history
Fix: Tonkeeper Pro UI fixes
  • Loading branch information
KuznetsovNikita authored Apr 1, 2024
2 parents b785641 + 7d325c8 commit d9f395e
Show file tree
Hide file tree
Showing 59 changed files with 1,104 additions and 253 deletions.
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tonkeeper/desktop",
"license": "Apache-2.0",
"version": "3.9.1",
"version": "3.9.2",
"description": "Your desktop wallet on The Open Network",
"main": ".webpack/main",
"repository": {
Expand Down
57 changes: 43 additions & 14 deletions apps/desktop/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ import { DesktopTokens } from '@tonkeeper/uikit/dist/desktop-pages/tokens/Deskto
import { DesktopCoinPage } from '@tonkeeper/uikit/dist/desktop-pages/coin/DesktopCoinPage';
import { DesktopHistoryPage } from '@tonkeeper/uikit/dist/desktop-pages/history/DesktopHistoryPage';
import { useStonfiAssets } from '@tonkeeper/uikit/dist/state/stonfi';
import { PreferencesAsideMenu } from '@tonkeeper/uikit/dist/components/desktop/aside/PreferencesAsideMenu';
import { DesktopPreferencesRouting } from '@tonkeeper/uikit/dist/desktop-pages/preferences/DesktopPreferencesRouting';
import { DesktopWalletSettingsRouting } from '@tonkeeper/uikit/dist/desktop-pages/settings/DesktopWalletSettingsRouting';
import { useUserFiat } from '@tonkeeper/uikit/dist/state/fiat';

const queryClient = new QueryClient({
defaultOptions: {
Expand Down Expand Up @@ -152,7 +156,7 @@ export const App = () => {
const ThemeAndContent = () => {
const { data } = useProBackupState();
return (
<UserThemeProvider displayType="full-width" isPro={data?.valid}>
<UserThemeProvider displayType="full-width" isPro={data?.valid} isProSupported>
<DarkThemeContext.Provider value={!data?.valid}>
<GlobalStyle />
<HeaderGlobalStyle />
Expand All @@ -170,13 +174,8 @@ const FullSizeWrapper = styled(Container)`
max-width: 800px;
`;

const Wrapper = styled.div<{ withPadding: boolean }>`
const Wrapper = styled.div`
box-sizing: border-box;
${p =>
p.withPadding &&
css`
padding-top: 64px;
`}
height: 100%;
display: flex;
Expand Down Expand Up @@ -214,6 +213,17 @@ const WalletRoutingWrapper = styled.div`
position: relative;
`;

const PreferencesLayout = styled.div`
height: 100%;
display: flex;
`;

const PreferencesRoutingWrapper = styled.div`
flex: 1;
overflow: auto;
position: relative;
`;

const FullSizeWrapperBounded = styled(FullSizeWrapper)`
max-height: 100%;
overflow: auto;
Expand All @@ -228,6 +238,7 @@ export const Loader: FC = () => {
const { i18n } = useTranslation();
const { data: account } = useAccountState();
const { data: auth } = useAuthState();
const { data: fiat } = useUserFiat();

const tonendpoint = useTonendpoint(
TARGET_ENV,
Expand Down Expand Up @@ -258,12 +269,17 @@ export const Loader: FC = () => {
window.backgroundApi.onRefresh(() => queryClient.invalidateQueries());
}, []);

if (auth === undefined || account === undefined || config === undefined || lock === undefined) {
if (
auth === undefined ||
account === undefined ||
config === undefined ||
lock === undefined ||
fiat === undefined
) {
return <Loading />;
}

const network = activeWallet?.network ?? Network.MAINNET;
const fiat = activeWallet?.fiat ?? FiatCurrencies.USD;
const context = {
api: getApiConfig(config, network, REACT_APP_TONCONSOLE_API),
auth,
Expand Down Expand Up @@ -346,6 +362,7 @@ export const Content: FC<{
<Routes>
<Route path={AppProRoute.dashboard} element={<DashboardPage />} />
<Route path={AppRoute.browser} element={<DesktopBrowser />} />
<Route path={any(AppRoute.settings)} element={<PreferencesContent />} />
<Route path="*" element={<WalletContent />} />
</Routes>
</WideContent>
Expand All @@ -364,15 +381,16 @@ const WalletContent = () => {
<WalletAsideMenu />
<WalletRoutingWrapper className="hide-scrollbar">
<Routes>
<Route element={<OldAppRouting withPadding />}>
<Route path={any(AppRoute.settings)} element={<Settings />} />
</Route>
<Route element={<OldAppRouting />}>
<Route path={AppRoute.activity} element={<DesktopHistoryPage />} />
<Route path={any(AppRoute.purchases)} element={<DesktopPurchases />} />
<Route path={AppRoute.coins}>
<Route path=":name/*" element={<DesktopCoinPage />} />
</Route>
<Route
path={any(AppRoute.walletSettings)}
element={<DesktopWalletSettingsRouting />}
/>
<Route path="*" element={<DesktopTokens />} />
</Route>
</Routes>
Expand All @@ -382,9 +400,20 @@ const WalletContent = () => {
);
};

const OldAppRouting: FC<{ withPadding?: boolean }> = ({ withPadding }) => {
const PreferencesContent = () => {
return (
<PreferencesLayout>
<PreferencesAsideMenu />
<PreferencesRoutingWrapper className="hide-scrollbar">
<DesktopPreferencesRouting />
</PreferencesRoutingWrapper>
</PreferencesLayout>
);
};

const OldAppRouting = () => {
return (
<Wrapper withPadding={withPadding}>
<Wrapper>
<Outlet />
<MemoryScroll />
</Wrapper>
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8" />
<title>Tonkeeper Desktop</title>
<title>Tonkeeper Pro</title>

<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&amp;display=swap"
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from './electron/protocol';
import { TonConnectSSE } from './electron/sseEvetns';

app.setName('Tonkeeper Desktop Pro');
app.setName('Tonkeeper Pro');

log.initialize({ preload: true });
log.info('Application start-up');
Expand Down
26 changes: 13 additions & 13 deletions apps/desktop/webpack.main.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { rules } from './webpack.rules';
import { plugins } from './webpack.plugins';

export const mainConfig: Configuration = {
/**
* This is the main entry point for your application, it's the first file
* that runs in the main process.
*/
entry: './src/index.ts',
// Put your normal webpack config below here
module: {
rules,
},
plugins,
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'],
},
/**
* This is the main entry point for your application, it's the first file
* that runs in the main process.
*/
entry: './src/index.ts',
// Put your normal webpack config below here
module: {
rules
},
plugins,
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json']
}
};
2 changes: 1 addition & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/extension",
"version": "3.9.0",
"version": "3.9.2",
"author": "Nikita Kuznetsov <nkuz915@gmail.com>",
"description": "Your extension wallet on The Open Network",
"dependencies": {
Expand Down
5 changes: 3 additions & 2 deletions apps/extension/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { Notifications } from './components/Notifications';
import { connectToBackground } from './event';
import { ExtensionAppSdk } from './libs/appSdk';
import { useAnalytics, useAppWidth } from './libs/hooks';
import { useUserFiat } from "@tonkeeper/uikit/dist/state/fiat";

const ImportRouter = React.lazy(() => import('@tonkeeper/uikit/dist/pages/import'));
const Settings = React.lazy(() => import('@tonkeeper/uikit/dist/pages/settings'));
Expand Down Expand Up @@ -164,6 +165,7 @@ const Wrapper = styled(FullSizeWrapper)<{

export const Loader: FC = React.memo(() => {
const { data: activeWallet } = useActiveWallet();
const { data: fiat } = useUserFiat();

const lock = useLock(sdk);
const { data: account } = useAccountState();
Expand All @@ -178,7 +180,7 @@ export const Loader: FC = React.memo(() => {

const { data: tracker } = useAnalytics(sdk.storage, account, activeWallet, sdk.version);

if (!account || !auth || !config || lock === undefined) {
if (!account || !auth || !config || lock === undefined || fiat === undefined) {
return (
<FullSizeWrapper standalone={false}>
<Loading />
Expand All @@ -187,7 +189,6 @@ export const Loader: FC = React.memo(() => {
}

const network = activeWallet?.network ?? Network.MAINNET;
const fiat = activeWallet?.fiat ?? FiatCurrencies.USD;

const context: IAppContext = {
api: getApiConfig(config, network),
Expand Down
5 changes: 3 additions & 2 deletions apps/twa/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { TwaNftNotification } from './components/nft/NftNotification';
import { TwaSendNotification } from './components/transfer/SendNotifications';
import { TwaAppSdk } from './libs/appSdk';
import { useAnalytics, useTwaAppViewport } from './libs/hooks';
import { useUserFiat } from "@tonkeeper/uikit/dist/state/fiat";

const Initialize = React.lazy(() => import('@tonkeeper/uikit/dist/pages/import/Initialize'));
const ImportRouter = React.lazy(() => import('@tonkeeper/uikit/dist/pages/import'));
Expand Down Expand Up @@ -210,6 +211,7 @@ const seeIfShowQrScanner = (platform: TwaPlatform): boolean => {
export const Loader: FC<{ sdk: IAppSdk }> = ({ sdk }) => {
const { data: activeWallet } = useActiveWallet();
const webApp = useWebApp();
const { data: fiat } = useUserFiat();

const lock = useLock(sdk);
const { data: account } = useAccountState();
Expand All @@ -226,14 +228,13 @@ export const Loader: FC<{ sdk: IAppSdk }> = ({ sdk }) => {
const navigate = useNavigate();
const { data: tracker } = useAnalytics(account, activeWallet);

if (auth === undefined || account === undefined || config === undefined || lock === undefined) {
if (auth === undefined || account === undefined || config === undefined || lock === undefined || fiat === undefined) {
return <Loading />;
}

const showQrScan = seeIfShowQrScanner(webApp.platform);

const network = activeWallet?.network ?? Network.MAINNET;
const fiat = activeWallet?.fiat ?? FiatCurrencies.USD;
const context: IAppContext = {
api: getApiConfig(config, network),
auth,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/web",
"version": "3.9.0",
"version": "3.9.2",
"author": "Nikita Kuznetsov <nkuz915@gmail.com>",
"description": "Your web wallet on The Open Network",
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { FiatCurrencies } from '@tonkeeper/core/dist/entries/fiat';
import { localizationText } from '@tonkeeper/core/dist/entries/language';
import { Network, getApiConfig } from '@tonkeeper/core/dist/entries/network';
import { WalletState } from '@tonkeeper/core/dist/entries/wallet';
Expand Down Expand Up @@ -49,6 +48,7 @@ import { BrowserRouter, Route, Routes, useLocation, useNavigate } from 'react-ro
import styled, { css } from 'styled-components';
import { BrowserAppSdk } from './libs/appSdk';
import { useAnalytics, useAppHeight, useAppWidth } from './libs/hooks';
import { useUserFiat } from "@tonkeeper/uikit/dist/state/fiat";

const ImportRouter = React.lazy(() => import('@tonkeeper/uikit/dist/pages/import'));
const Settings = React.lazy(() => import('@tonkeeper/uikit/dist/pages/settings'));
Expand Down Expand Up @@ -164,6 +164,7 @@ const Wrapper = styled(FullSizeWrapper)<{ standalone: boolean }>`

export const Loader: FC = () => {
const { data: activeWallet } = useActiveWallet();
const { data: fiat } = useUserFiat();

const [ios, standalone] = useMemo(() => {
return [sdk.isIOs(), sdk.isStandalone()] as const;
Expand Down Expand Up @@ -199,12 +200,11 @@ export const Loader: FC = () => {
}
}, [activeWallet, i18n]);

if (auth === undefined || account === undefined || config === undefined || lock === undefined) {
if (auth === undefined || account === undefined || config === undefined || lock === undefined || fiat === undefined) {
return <Loading />;
}

const network = activeWallet?.network ?? Network.MAINNET;
const fiat = activeWallet?.fiat ?? FiatCurrencies.USD;
const context = {
api: getApiConfig(config, network),
auth,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/Keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum AppKey {

THEME = 'theme',
UI_PREFERENCES = 'ui_preferences',
FIAT = 'fiat',

PASSWORD = 'password',
LOCK = 'lock',
Expand Down
9 changes: 0 additions & 9 deletions packages/core/src/entries/theme.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/entries/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export interface WalletState {
orderJettons?: string[];

lang?: Language;
fiat?: FiatCurrencies;
theme?: string;

proxy?: WalletProxy;
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/service/walletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ export const updateWalletProperty = async (
| 'shownJettons'
| 'orderJettons'
| 'lang'
| 'fiat'
| 'network'
| 'emoji'
>
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/tonkeeperApi/tonendpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface TonendpointConfig {
neocryptoWebView?: string;

directSupportUrl?: string;
faq_url?: string;

accountExplorer?: string;
transactionExplorer?: string;
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/utils/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Address } from '@ton/core';
import { decodeBase58, sha256 } from 'ethers';
import { Network } from '../entries/network';
import { CryptoCurrency } from '../entries/crypto';

export const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

Expand Down Expand Up @@ -53,9 +54,13 @@ export const areEqAddresses = (address1: string, address2: string) => {
}
};

export const isTonAddress = (address: string) => {
return address.toLowerCase() === CryptoCurrency.TON.toLowerCase();
};

export const toShortValue = (value: string, length = 4): string => {
if (value.length > length * 2) {
return value.slice(0, length) + '...' + value.slice(-length);
return value.slice(0, length) + '' + value.slice(-length);
} else {
return value;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/locales/src/tonkeeper-web/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
"Password" : "Password",
"PasswordChanged" : "Password Changed",
"PasswordDoNotMatch" : "Passwords do not match.",
"preferences_aside_dev_menu" : "Dev Menu",
"preferences_aside_faq" : "FAQ",
"preferences_aside_sign_out" : "Sign Out",
"preferences_aside_sign_out_all" : "Sign Out of all Accounts",
"preferences_aside_theme" : "Theme",
"pro_banner_buy" : "Buy Pro",
"pro_banner_days_left" : "Trial ends in %days%",
"pro_banner_start_trial" : "Try Pro for Free",
Expand Down
Loading

0 comments on commit d9f395e

Please sign in to comment.