Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/telegram-dev' into telegram-wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
saltict committed May 31, 2024
2 parents 5047be3 + b3b6d5a commit 8b5ac7e
Show file tree
Hide file tree
Showing 43 changed files with 1,509 additions and 201 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/push-webapp-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build Telegram MiniApp Dev
on:
pull_request:
branches:
- telegram-dev

push:
branches:
- telegram-dev

jobs:
master:
if: "!startsWith(github.event.head_commit.message, '[CI Skip]')"
name: Deploy Telegram MiniApp
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_AUTOMATION_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Build
env:
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
NFT_MINTING_HOST: ${{ secrets.NFT_MINTING_HOST }}
BRANCH_NAME: ${{ github.ref_name }}
GAME_API_HOST: ${{ vars.API_DEV_SERVER }}
TELEGRAM_WEBAPP_LINK: ${{ vars.TELEGRAM_WEBAPP_LINK }}
run: |
yarn install --immutable | grep -v 'YN0013'
if [ ${{ github.ref_name }} == 'telegram-wallet' ]; then
yarn run webapp:change-build-number
fi
yarn webapp:build
- name: Publish to Cloudflare Pages
id: cloudflare_deployment
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME }}
gitHubToken: ${{ secrets.GH_AUTOMATION_TOKEN }}
branch: main
directory: './packages/webapp/build'
wranglerVersion: '3'
- if: "github.ref_name == 'telegram-dev' && github.event_name == 'push'"
name: Automation Bot
uses: EndBug/add-and-commit@v9
with:
author_name: Automation Bot
author_email: [email protected]
message: '[CI Skip] Auto increase webapp build number'
- name: Notify to Discord
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
username: WebApp Worker
title: ${{ github.workflow }}
description: |
The deployment is completed.
- URL: ${{ steps.cloudflare_deployment.outputs.url }}
- Alias: ${{ steps.cloudflare_deployment.outputs.alias }}
7 changes: 0 additions & 7 deletions .github/workflows/push-webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ jobs:
branch: main
directory: './packages/webapp/build'
wranglerVersion: '3'
- if: "github.ref_name == 'telegram-wallet' && github.event_name == 'push'"
name: Automation Bot
uses: EndBug/add-and-commit@v9
with:
author_name: Automation Bot
author_email: [email protected]
message: '[CI Skip] Auto increase webapp build number'
- name: Notify to Discord
uses: sarisia/actions-status-discord@v1
if: always()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
// SPDX-License-Identifier: Apache-2.0

import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';

export default class BeforeKaruraCampaign extends BaseMigrationJob {
public override async run (): Promise<void> {
const state = this.state;

state.chainService.disableChain('goldberg_testnet');
await state.chainService.updateAssetSetting('karura-NATIVE-KAR', { visible: true });
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
// SPDX-License-Identifier: Apache-2.0

import EnableAvailGoldberg from '@subwallet/extension-base/services/migration-service/scripts/EnableAvailGoldberg';
import BeforeKaruraCampaign from '@subwallet/extension-base/services/migration-service/scripts/BeforeKaruraCampaign';

import BaseMigrationJob from '../Base';

Expand Down Expand Up @@ -32,7 +32,5 @@ export default <Record<string, typeof BaseMigrationJob>>{
// '1.1.44-01': MigrateAssetSetting,
// '1.1.45-01': MigrateTransactionHistoryBySymbol,
// '1.1.46-01': AutoEnableSomeTokens
'1.1.51-01': EnableAvailGoldberg
// [`${EVERYTIME}-1.1.42-02`]: MigrateTransactionHistoryBySymbol
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
'1.1.51-03': BeforeKaruraCampaign
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
// Copyright 2019-2022 @subwallet/extension-koni-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { AirdropCampaign } from '@subwallet/extension-koni-ui/connector/booka/types';
import useTranslation from '@subwallet/extension-koni-ui/hooks/common/useTranslation';
import { ThemeProps } from '@subwallet/extension-koni-ui/types';
import { Button, Icon } from '@subwallet/react-ui';
import CN from 'classnames';
import { TelegramLogo } from 'phosphor-react';
import React from 'react';
import styled from 'styled-components';

type Props = ThemeProps & {
airdropInfo: AirdropCampaign
};

function Component ({ airdropInfo, className }: Props) {
const { t } = useTranslation();

return (
<div className={CN(className)}>
<div className='__dynamic-content-wrapper'>
{
airdropInfo.description && (
<div
className={'__dynamic-content'}
dangerouslySetInnerHTML={{ __html: airdropInfo.description }}
/>
)
}
</div>

<div className='__divider' />
<div className='__content-footer'>
<div className='__token-info'>
<div className='__token-label'>
{t('Token')}:
</div>
{/* <div className='__token-icon'></div> */}
<div className='__token-symbol'>
{airdropInfo.symbol}
</div>
</div>

<div className='__content-footer-separator' />

<div className='__social-info'>
<div className='__social-label'>
{t('Social')}:
</div>

<Button
icon={(
<Icon
customSize={'16px'}
phosphorIcon={TelegramLogo}
weight={'fill'}
/>
)}
size='xs'
type='ghost'
/>
</div>
</div>
</div>
);
}

export const AirdropDetailAbout = styled(Component)<Props>(({ theme: { extendToken, token } }: Props) => {
return ({
display: 'flex',
flexDirection: 'column',

'.__dynamic-content-wrapper': {
paddingLeft: token.padding,
paddingRight: token.padding,
overflow: 'auto',
flex: 1
},

'.__dynamic-content': {
'h2, h1': {
lineHeight: token.lineHeightLG,
color: token.colorTextDark1,
fontWeight: token.headingFontWeight,
fontSize: token.fontSizeLG,
marginBottom: token.marginSM
},

p: {
lineHeight: token.lineHeight,
color: token.colorTextDark2,
fontSize: token.fontSize,
marginBottom: token.marginSM
}
},

'.__divider': {
backgroundColor: token.colorBgDivider,
height: 1,
marginLeft: token.margin,
marginRight: token.margin
},

'.__content-footer': {
padding: token.padding,
paddingTop: 3,
paddingBottom: 7,
display: 'flex',
alignItems: 'center',
fontSize: token.fontSize,
lineHeight: token.lineHeight
},

'.__token-info, .__social-info': {
display: 'flex',
alignItems: 'center'
},

'.__token-label, .__social-label': {
color: token.colorTextDark4
},

'.__token-symbol': {
marginLeft: token.marginXXS,
fontWeight: token.headingFontWeight
},

'.__content-footer-separator': {
backgroundColor: token.colorBgDivider,
height: token.size,
width: 1,
marginLeft: token.margin,
marginRight: token.margin
}
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// Copyright 2019-2022 @subwallet/extension-koni-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { AirdropCampaign } from '@subwallet/extension-koni-ui/connector/booka/types';
import useTranslation from '@subwallet/extension-koni-ui/hooks/common/useTranslation';
import { ThemeProps } from '@subwallet/extension-koni-ui/types';
import { customFormatDate } from '@subwallet/extension-koni-ui/utils';
import CN from 'classnames';
import React from 'react';
import styled from 'styled-components';

type Props = ThemeProps & {
airdropInfo: AirdropCampaign
};

function Component ({ airdropInfo, className }: Props) {
// @ts-ignore
const { t } = useTranslation();

return (
<div className={CN(className)}>
{
airdropInfo.eligibilityList.map((item) => (
<div
className={'__eligibility-item'}
key={item.name}
>
<div className='__eligibility-item-name'>
{item.name}
</div>

<div className='__eligibility-item-line'>
<div className='__eligibility-item-line-label'>{t('Time')}</div>
<div className='__eligibility-item-line-value __eligibility-item-date'>
<span>{item.start ? customFormatDate(item.start, '#DD# #MMM#') : '__'}</span>
<span>-</span>
<span>{item.end ? customFormatDate(item.end, '#DD# #MMM#') : '__'}</span>
</div>
</div>
<div className='__eligibility-item-line'>
<div className='__eligibility-item-line-label'>{t('Method')}</div>
<div className='__eligibility-item-line-value'>Raffle ({item.boxCount})</div>
</div>

<div className='__eligibility-item-note'>
<span className='__eligibility-item-note-label'>{t('Note')}:</span>
<span className='__eligibility-item-note-content'>
{item.note || t('A player can win multiple type of rewards')}
</span>
</div>
</div>
))
}
</div>
);
}

export const AirdropDetailCondition = styled(Component)<Props>(({ theme: { extendToken, token } }: Props) => {
return ({
marginBottom: token.margin,
paddingLeft: token.padding,
paddingRight: token.padding,

'.__eligibility-item + .__eligibility-item:before': {
content: '""',
display: 'block',
height: 1,
backgroundColor: token.colorBgDivider,
marginLeft: token.marginXS,
marginRight: token.marginXS,
marginBottom: token.marginSM,
marginTop: token.marginSM
},

'.__eligibility-item-name': {
fontSize: token.fontSize,
lineHeight: token.lineHeight,
fontWeight: token.headingFontWeight,
marginBottom: token.marginSM
},

'.__eligibility-item-line': {
display: 'flex',
gap: token.sizeXS,
alignItems: 'center',
marginBottom: token.marginXS
},

'.__eligibility-item-line-label': {
lineHeight: '22px',
borderRadius: 12,
backgroundColor: token.colorPrimary,
fontWeight: token.headingFontWeight,
minWidth: 56,
fontSize: 10,
textAlign: 'center'
},

'.__eligibility-item-note-label': {
marginRight: token.marginXXS,
fontWeight: token.headingFontWeight
},

'.__eligibility-item-date': {
display: 'flex',
gap: token.sizeXXS
}
});
});
Loading

0 comments on commit 8b5ac7e

Please sign in to comment.