From a2bdd2ef101998d3241cbbd72ace668037466970 Mon Sep 17 00:00:00 2001 From: siandreev Date: Tue, 12 Mar 2024 12:44:11 +0100 Subject: [PATCH] fix: aside menu bottom maid sticky. tg -> ton_proof Auth fixes --- apps/desktop/src/app/App.tsx | 2 +- packages/core/src/entries/pro.ts | 2 +- packages/core/src/service/proService.ts | 4 ++-- .../core/src/tonConsoleApi/services/ProServiceService.ts | 4 ++-- packages/uikit/src/components/aside/AsideMenu.tsx | 8 +++++++- packages/uikit/src/components/aside/SubscriptionInfo.tsx | 2 +- .../uikit/src/components/dashboard/DashboardTable.tsx | 2 +- packages/uikit/src/components/settings/ProSettings.tsx | 2 +- packages/uikit/src/state/dashboard/useDashboardData.ts | 2 +- 9 files changed, 17 insertions(+), 11 deletions(-) diff --git a/apps/desktop/src/app/App.tsx b/apps/desktop/src/app/App.tsx index c6e9c86da..e61b67cde 100644 --- a/apps/desktop/src/app/App.tsx +++ b/apps/desktop/src/app/App.tsx @@ -180,7 +180,7 @@ const WideLayout = styled.div` display: flex; & > *:first-child { - width: 200px; + width: 250px; } `; diff --git a/packages/core/src/entries/pro.ts b/packages/core/src/entries/pro.ts index 676f72f25..fe7f77c33 100644 --- a/packages/core/src/entries/pro.ts +++ b/packages/core/src/entries/pro.ts @@ -1,6 +1,6 @@ export interface ProState { wallet: ProStateWallet; - hasCookie: boolean; + hasWalletAuthCookie: boolean; subscription: ProSubscription; } diff --git a/packages/core/src/service/proService.ts b/packages/core/src/service/proService.ts index 241f564b3..059063f21 100644 --- a/packages/core/src/service/proService.ts +++ b/packages/core/src/service/proService.ts @@ -47,7 +47,7 @@ export const getProState = async (storage: IStorage, wallet: WalletState): Promi } catch (e) { return { subscription: toEmptySubscription(), - hasCookie: false, + hasWalletAuthCookie: false, wallet: { publicKey: wallet.publicKey, rawAddress: wallet.active.rawAddress @@ -115,7 +115,7 @@ export const loadProState = async ( return { subscription, - hasCookie: true, + hasWalletAuthCookie: !!user.pub_key, wallet }; }; diff --git a/packages/core/src/tonConsoleApi/services/ProServiceService.ts b/packages/core/src/tonConsoleApi/services/ProServiceService.ts index 8f22aeeb1..cdfa8d82c 100644 --- a/packages/core/src/tonConsoleApi/services/ProServiceService.ts +++ b/packages/core/src/tonConsoleApi/services/ProServiceService.ts @@ -84,8 +84,8 @@ export class ProServiceService { * @throws ApiError */ public static proServiceGetUserInfo(): CancelablePromise<{ - pub_key: string; - version: string; + pub_key?: string; + version?: string; user_id?: number; tg_id?: number; }> { diff --git a/packages/uikit/src/components/aside/AsideMenu.tsx b/packages/uikit/src/components/aside/AsideMenu.tsx index a2e9afbcc..38db14816 100644 --- a/packages/uikit/src/components/aside/AsideMenu.tsx +++ b/packages/uikit/src/components/aside/AsideMenu.tsx @@ -21,7 +21,7 @@ const AsideContainer = styled.div` background: ${p => p.theme.backgroundContent}; display: flex; flex-direction: column; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0; `; const IconWrapper = styled.div` @@ -40,6 +40,7 @@ const AsideMenuCard = styled.button<{ isSelected: boolean }>` padding: 6px 10px; width: 100%; height: 36px; + min-height: 36px; display: flex; align-items: center; gap: 10px; @@ -65,6 +66,11 @@ const AsideMenuBottom = styled.div` display: flex; flex-direction: column; justify-content: flex-end; + position: sticky; + bottom: 0; + + background: ${p => p.theme.backgroundContent}; + padding: 0.5rem 0; `; export const AsideMenuAccount: FC<{ publicKey: string; isSelected: boolean }> = ({ diff --git a/packages/uikit/src/components/aside/SubscriptionInfo.tsx b/packages/uikit/src/components/aside/SubscriptionInfo.tsx index 76f9e580f..16a50f99d 100644 --- a/packages/uikit/src/components/aside/SubscriptionInfo.tsx +++ b/packages/uikit/src/components/aside/SubscriptionInfo.tsx @@ -71,7 +71,7 @@ export const SubscriptionStatus: FC<{ data: ProState }> = ({ data }) => { export const SubscriptionInfo: FC<{ className?: string }> = ({ className }) => { const { data } = useProState(); - if (!data) { + if (!data || !data.subscription.valid) { return null; } diff --git a/packages/uikit/src/components/dashboard/DashboardTable.tsx b/packages/uikit/src/components/dashboard/DashboardTable.tsx index b371250ff..b8a61035c 100644 --- a/packages/uikit/src/components/dashboard/DashboardTable.tsx +++ b/packages/uikit/src/components/dashboard/DashboardTable.tsx @@ -103,7 +103,7 @@ export const DashboardTable: FC<{ className?: string }> = ({ className }) => { const { data: dashboardData } = useDashboardData(); const { data: wallets, isFetched: isWalletsFetched } = useWalletsState(); const mainnetPubkeys = wallets - ?.filter(w => w?.network === Network.MAINNET) + ?.filter(w => w && w.network !== Network.TESTNET) .map(w => w!.publicKey); const [isResizing, setIsResizing] = useState(false); diff --git a/packages/uikit/src/components/settings/ProSettings.tsx b/packages/uikit/src/components/settings/ProSettings.tsx index 65aae9ed2..ee9e2e0fe 100644 --- a/packages/uikit/src/components/settings/ProSettings.tsx +++ b/packages/uikit/src/components/settings/ProSettings.tsx @@ -320,7 +320,7 @@ const PreServiceStatus: FC<{ data: ProState; setReLogin: () => void }> = ({ const ProContent: FC<{ data: ProState }> = ({ data }) => { const [reLogin, setReLogin] = useState(false); - if (!data.hasCookie || reLogin) { + if (!data.hasWalletAuthCookie || reLogin) { return ; } if (isPaidSubscription(data.subscription)) { diff --git a/packages/uikit/src/state/dashboard/useDashboardData.ts b/packages/uikit/src/state/dashboard/useDashboardData.ts index dc97a5685..3097216ed 100644 --- a/packages/uikit/src/state/dashboard/useDashboardData.ts +++ b/packages/uikit/src/state/dashboard/useDashboardData.ts @@ -22,7 +22,7 @@ export function useDashboardData() { const client = useQueryClient(); const { data: walletsState } = useWalletsState(); - const mainnetWallets = walletsState?.filter(w => w?.network === Network.MAINNET); + const mainnetWallets = walletsState?.filter(w => w && w.network !== Network.TESTNET); const publicKeysMainnet = mainnetWallets?.map(w => w!.publicKey); return useQuery(