Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishtar committed Jul 8, 2024
1 parent 0371678 commit 68f4cb1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
16 changes: 6 additions & 10 deletions frontend/src/components/Charts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const Charts = (props: {

if (isLoading) {
return (
<Flex justifyContent="center" alignItems="center" className="h-screen">
<Flex justifyContent="center" alignItems="center" className="h-dvh">
<Loader />
</Flex>
)
Expand All @@ -45,25 +45,23 @@ export const Charts = (props: {
if (!data) {
return (
<Flex justifyContent="center" alignItems="center">
<h2 className="text-2xl text-slate-600">{t('label.error')}</h2>
<h2 className="text-2xl">{t('label.error')}</h2>
</Flex>
)
}

if (!data.jettons.length) {
return (
<Flex justifyContent="center" alignItems="center">
<h2 className="text-2xl text-slate-600">{t('label.noJettons')}</h2>
<h2 className="text-2xl">{t('label.noJettons')}</h2>
</Flex>
)
}

if (data) {
return (
<div className={s.charts}>
<h1
className={`${s.yourJettonsHeader} w-full text-3xl text-slate-700 text-center`}
>
<h1 className={`${s.yourJettonsHeader} w-full text-3xl text-center`}>
{t('label.yourJettons')}
</h1>
{data
Expand All @@ -82,15 +80,13 @@ export const Charts = (props: {
className="shadow rounded-full max-w-full h-auto align-middle border-none"
/>
</div>
<h1
className={`${s.symbolHeader} text-2xl text-slate-500 pl-2`}
>
<h1 className={`${s.symbolHeader} text-2xl pl-2`}>
{obj.symbol}
</h1>
</Flex>
{obj.pnlPercentage !== 0 ? (
<div className="flex">
<h3 className="text-xl text-slate-500 pr-2">{}</h3>
<h3 className="text-xl pr-2">{}</h3>
<BadgeDelta
size="lg"
deltaType={badgeType(obj.pnlPercentage)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ html {
padding-bottom: 12px;
max-width: 560px;
width: 100%;
min-height: var(--tg-viewport-height);
min-height: 100%;
/* overflow-x: hidden; */
color: var(--tg-theme-text-color);
display: flex;
Expand Down
2 changes: 2 additions & 0 deletions src/services/bot/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ I don't understand. You can send me an address to watch, or open the Telegram mi
},
button: {
linkWallet: () => 'Connect Wallet',
openApp: () => `Open App`,
open: () => `Open`,
link: () => 'Connect',
},
command: {
Expand Down
2 changes: 2 additions & 0 deletions src/services/bot/i18n/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ ${disconnectCOmmandList}
},
button: {
linkWallet: () => 'Подключить кошелёк',
openApp: () => `Открыть приложение`,
open: () => `Открыть`,
link: () => 'Подключить',
},
command: {
Expand Down
3 changes: 3 additions & 0 deletions src/services/bot/utils/handleNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const handleNotification = async (bot: Telegraf<TTelegrafContext>) => {
walletUserFriendly,
notification.price,
),
{
parse_mode: 'Markdown'
}
)
continue
}
Expand Down
20 changes: 18 additions & 2 deletions src/services/bot/utils/handleSuccessfulWalletLinkNotification.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Telegraf } from 'telegraf'
import { Markup, type Telegraf } from 'telegraf'
import TonWeb from 'tonweb'
import type { TTelegrafContext } from '../types'
import type { TDbConnection, TSuccessfulWalletLinkNotificationCh } from '../../../types'
Expand Down Expand Up @@ -70,7 +70,7 @@ export const handleSuccessfulWalletLinkNotification = async (
})
const address = new TonWeb.utils.Address(payload.address)
const userFriendlyAddress = address.toString(true, true, true)
await bot.telegram.sendMessage(
const message = await bot.telegram.sendMessage(
payload.userId,
i18n(userSettings?.languageCode).message.newWalletConnected(
userFriendlyAddress,
Expand All @@ -80,8 +80,24 @@ export const handleSuccessfulWalletLinkNotification = async (
),
{
parse_mode: 'Markdown',
reply_markup: {
inline_keyboard: [[
Markup.button.webApp(i18n(userSettings?.languageCode).button.openApp(), process.env.TELEGRAM_BOT_WEB_APP),
]],
}
},
)
await bot.telegram.pinChatMessage(payload.userId, message.message_id)
await bot.telegram.setChatMenuButton({
chatId: payload.userId,
menuButton: {
type: 'web_app',
text: i18n(userSettings?.languageCode).button.open(),
web_app: {
url: process.env.TELEGRAM_BOT_WEB_APP,
},
}
})
}
return true
}

0 comments on commit 68f4cb1

Please sign in to comment.