Skip to content

Commit

Permalink
chore: pick released to main (#3795)
Browse files Browse the repository at this point in the history
* [Release] Hotfix 6.6.0 => 6.6.1 (patch) (#3726)

* chore: bump version to 6.6.1

* chore: mobile login view (#3732)

* chore: quick reply button (#3736)

* chore: max height for post by (#3737)

* chore: max height for post by

* chore: ui

* fix: disable solana red packet (#3745)

* chore: schedule list ui (#3744)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: nuanyang233 <[email protected]>
Co-authored-by: dudu0506 <[email protected]>

* [Release] Hotfix 6.6.1 => 6.6.2 (patch) (#3750)

* [Release] Hotfix 6.6.2 => 6.6.3 (patch) (#3777)

* chore: bump version to 6.6.3

* fix: event share url no twitter handle

* fix: mobile only loading status and hidden android contact us tips

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: LeifXu <[email protected]>

* [Release] Hotfix 6.6.3 => 6.6.4 (patch) (#3784)

* chore: code maintenance [bot]

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: nuanyang233 <[email protected]>
Co-authored-by: dudu0506 <[email protected]>
  • Loading branch information
5 people authored Jan 20, 2025
1 parent 7db6efb commit 5b96713
Show file tree
Hide file tree
Showing 27 changed files with 643 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mask.social",
"type": "module",
"version": "6.6.0",
"version": "6.6.4",
"private": true,
"packageManager": "[email protected]",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/app/(settings)/settings/more/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import MaskRoundIcon from '@/assets/mask.round.svg';
import SecurityIcon from '@/assets/security.svg';
import TelegramIcon from '@/assets/telegram.svg';
import { XIcon } from '@/components/XIcon.js';
import { FIREFLY_TELEGRAM_URL } from '@/constants/index.js';
import { useNavigatorTitle } from '@/hooks/useNavigatorTitle.js';

function SmallXIcon() {
Expand Down Expand Up @@ -68,7 +69,7 @@ export default function More() {
},
{
title: <Trans>Join our Telegram</Trans>,
link: 'https://t.me/fireflyapp',
link: FIREFLY_TELEGRAM_URL,
logo: TelegramIcon,
},
].map(({ title, link, logo }) => (
Expand Down
3 changes: 1 addition & 2 deletions src/components/Activity/ActivityConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ export function ActivityConnectButton({ source, chainId }: { source: SocialSourc
</Menu.Button>
<Menu.Items
className={classNames(
'absolute bottom-[calc(100%+12px)] z-50 flex max-h-[200px] w-[200px] flex-col overflow-y-auto rounded-[12px] border border-line bg-primaryBottom shadow-lg',
address ? 'right-0' : 'left-0 md:left-[unset] md:right-0',
'absolute bottom-[calc(100%+12px)] right-0 z-50 flex max-h-[200px] w-[200px] flex-col overflow-y-auto rounded-[12px] border border-line bg-primaryBottom shadow-lg',
)}
>
{addresses.map(({ address, ens }) => (
Expand Down
20 changes: 19 additions & 1 deletion src/components/Activity/ActivityMobileOnly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ import { Trans } from '@lingui/react/macro';
import type { PropsWithChildren } from 'react';

import { Link } from '@/components/Activity/Link.js';
import { FIREFLY_APP_APP_STORE_URL, FIREFLY_APP_GOOGLE_PLAY_URL } from '@/constants/index.js';
import { LoadingIcon } from '@/components/LoadingIcon.js';
import { FIREFLY_APP_APP_STORE_URL, FIREFLY_APP_GOOGLE_PLAY_URL, FIREFLY_TELEGRAM_URL } from '@/constants/index.js';
import { useMounted } from '@/hooks/useMounted.js';
import { fireflyBridgeProvider } from '@/providers/firefly/Bridge.js';

export function ActivityMobileOnly({ children, disabled = false }: PropsWithChildren<{ disabled?: boolean }>) {
const isMounted = useMounted();
if (!isMounted) {
return (
<div className="flex w-full items-center justify-center py-6">
<LoadingIcon />
</div>
);
}
if (disabled || fireflyBridgeProvider.supported) return children;
return (
<div className="flex w-full flex-col px-6">
Expand All @@ -30,6 +40,14 @@ export function ActivityMobileOnly({ children, disabled = false }: PropsWithChil
<Trans>Google Play</Trans>
</Link>
</div>
<p className="my-4 w-full text-center text-[10px]">
<Trans>
All rights reserved by Firefly. For any inquiries, please{' '}
<Link href={FIREFLY_TELEGRAM_URL} target="_blank" className="inline text-highlight">
contact us.
</Link>
</Trans>
</p>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ export function ActivityPremiumAddressVerifyButton({ source, chainId }: { source
</Menu.Button>
<Menu.Items
className={classNames(
'absolute bottom-[calc(100%+12px)] z-50 flex max-h-[200px] w-[200px] flex-col overflow-y-auto rounded-[12px] border border-line bg-primaryBottom shadow-lg',
premiumAddress ? 'right-0' : 'left-0 md:left-[unset] md:right-0',
'absolute bottom-[calc(100%+12px)] right-0 z-50 flex max-h-[200px] w-[200px] flex-col overflow-y-auto rounded-[12px] border border-line bg-primaryBottom shadow-lg',
)}
>
{addresses.map(({ address, ens }) => (
Expand Down
251 changes: 251 additions & 0 deletions src/components/Activity/ActivityTasks/ActivityTrumpTasks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
import { t } from '@lingui/core/macro';
import { Trans } from '@lingui/react/macro';
import { safeUnreachable } from '@masknet/kit';
import { ChainId } from '@masknet/web3-shared-evm';
import { ChainId as SolChainId } from '@masknet/web3-shared-solana';
import { useCallback, useContext, useState } from 'react';

import { ActionButton } from '@/components/ActionButton.js';
import { ActivityClaimButton } from '@/components/Activity/ActivityClaimButton.js';
import { ActivityConnectCard } from '@/components/Activity/ActivityConnectCard.js';
import { ActivityContext } from '@/components/Activity/ActivityContext.js';
import { ActivityLoginButton } from '@/components/Activity/ActivityLoginButton.js';
import { ActivityNormalSuccessDialog } from '@/components/Activity/ActivityNormalSuccessDialog.js';
import { ActivityPremiumAddressVerifyCard } from '@/components/Activity/ActivityPremiumAddressVerifyCard.js';
import { ActivityPremiumConditionList } from '@/components/Activity/ActivityPremiumConditionList.js';
import { ActivityTaskFollowCard } from '@/components/Activity/ActivityTaskFollowCard.js';
import { ActivityVerifyText } from '@/components/Activity/ActivityVerifyText.js';
import { useActivityClaimCondition } from '@/components/Activity/hooks/useActivityClaimCondition.js';
import { useActivityPremiumList } from '@/components/Activity/hooks/useActivityPremiumList.js';
import { useActivityShareUrl } from '@/components/Activity/hooks/useActivityShareUrl.js';
import { useIsFollowInActivity } from '@/components/Activity/hooks/useIsFollowInActivity.js';
import { Link } from '@/components/Activity/Link.js';
import { ClickableButton } from '@/components/ClickableButton.js';
import { Popover } from '@/components/Popover.js';
import { IS_ANDROID } from '@/constants/bowser.js';
import { Source } from '@/constants/enum.js';
import { FIREFLY_TELEGRAM_URL } from '@/constants/index.js';
import { FIREFLY_MENTION, FIREFLY_TWITTER_PROFILE, TRUMP_TWITTER_PROFILE } from '@/constants/mentions.js';
import type { Chars } from '@/helpers/chars.js';
import { classNames } from '@/helpers/classNames.js';
import { replaceObjectInStringArray } from '@/helpers/replaceObjectInStringArray.js';
import { resolveProfileUrl } from '@/helpers/resolveProfileUrl.js';
import { runInSafe } from '@/helpers/runInSafe.js';
import { fireflyBridgeProvider } from '@/providers/firefly/Bridge.js';
import { type ActivityInfoResponse, ActivityStatus } from '@/providers/types/Firefly.js';

function DisclaimerDialog({ open, onClose }: { open: boolean; onClose: () => void }) {
return (
<Popover
open={open}
onClose={onClose}
dialogPanelClassName="!max-w-[386px]"
hiddenTopLine
enableOverflow={false}
>
<h3 className="w-full text-center text-lg font-bold">
<Trans>Disclaimer</Trans>
</h3>
<div className="mt-4 w-full text-medium leading-[18px]">
<Trans>
<p className="mb-4">
By participating, you confirm that you are at least 18 years old and reside in a jurisdiction
where such promotions are lawful. This promotion is void where prohibited by law.
</p>
<p className="mb-4">
No purchase or payment is required to enter or win, and such actions will not affect your
chances of winning. Winners will be selected randomly through a transparent process. Entries
must be submitted by January 23, 2025.
</p>
<p className="mb-4">
Participants are responsible for ensuring compliance with applicable laws. We disclaim liability
for any losses arising from participation. By participating, you release us from all liability
to the fullest extent permitted by law.
</p>
</Trans>
</div>
<ActionButton onClick={onClose}>
<Trans>Done</Trans>
</ActionButton>
</Popover>
);
}

export function ActivityTrumpTasks({
data,
}: {
data: Pick<Required<ActivityInfoResponse>['data'], 'status' | 'name'>;
}) {
const { address, premiumAddress } = useContext(ActivityContext);
const { data: claimCondition } = useActivityClaimCondition(Source.Twitter);
const list = useActivityPremiumList(Source.Twitter);
const isPremium = list.some((x) => x.verified);
const followTrumpTwitterProfile = {
handle: TRUMP_TWITTER_PROFILE.handle,
profileId: TRUMP_TWITTER_PROFILE.platform_id,
following: claimCondition?.x?.followingTrump,
};
const { data: isFollowedFirefly } = useIsFollowInActivity(
Source.Twitter,
FIREFLY_TWITTER_PROFILE.platform_id,
FIREFLY_TWITTER_PROFILE.handle,
);
const shareUrl = useActivityShareUrl(data.name);
const shareContent = runInSafe(() => {
const fireflyMention = 'FIREFLY_MENTION';
return replaceObjectInStringArray(
t`Just joined this exclusive raffle event "🇺🇸 Winning with $TRUMP 🇺🇸" from ${fireflyMention}
Check your eligibility and participate here ${shareUrl}
#TRUMP #FireflySocial`,
{
[fireflyMention]: FIREFLY_MENTION,
},
);
});

const disabled = !isFollowedFirefly;
const buttonText = runInSafe(() => {
const status = data.status;
switch (status) {
case ActivityStatus.Upcoming:
return <Trans>Not Started</Trans>;
case ActivityStatus.Ended:
return <Trans>Ended</Trans>;
case ActivityStatus.Active:
if (claimCondition?.participationBlocked) {
return <Trans>Participation Blocked</Trans>;
}
if (claimCondition?.alreadyClaimed) {
return <Trans>Participated</Trans>;
}
return <Trans>Participate Now</Trans>;
default:
safeUnreachable(status);
return null;
}
});
const [isSuccessParticipate, setIsSuccessParticipate] = useState(false);
const [openDisclaimer, setOpenDisclaimer] = useState(false);

return (
<>
<DisclaimerDialog open={openDisclaimer} onClose={() => setOpenDisclaimer(false)} />
<div className="mb-4 w-full space-y-4 px-6 pt-4">
<div className="flex w-full flex-col space-y-2">
<div className="flex h-8 items-center justify-between">
<h2 className="text-base font-semibold leading-6">
<Trans>Check Eligibility</Trans>
</h2>
<ActivityLoginButton source={Source.Twitter} />
</div>
</div>
<div
className={classNames(
'w-full rounded-2xl p-3 text-sm font-normal leading-6',
followTrumpTwitterProfile.following ? 'bg-success/10 dark:bg-success/20' : 'bg-bg',
)}
>
<ActivityVerifyText verified={followTrumpTwitterProfile.following}>
<h3>
<Trans>
Followed{' '}
<Link
className="inline text-highlight"
href={resolveProfileUrl(Source.Twitter, followTrumpTwitterProfile.profileId)}
>
@{followTrumpTwitterProfile.handle}
</Link>{' '}
on X before Jan 18, 2025
</Trans>
</h3>
</ActivityVerifyText>
</div>
<ActivityTaskFollowCard
source={Source.Twitter}
handle={FIREFLY_TWITTER_PROFILE.handle}
profileId={FIREFLY_TWITTER_PROFILE.platform_id}
/>
<h2 className="text-base font-semibold leading-6">
<Trans>Connect Wallet</Trans>
</h2>
<ActivityConnectCard
chainId={SolChainId.Mainnet}
source={Source.Twitter}
label={address ? <Trans>Wallet submitted</Trans> : <Trans>submit a wallet to receive $TRUMP</Trans>}
/>
<h2 className="text-base font-semibold leading-6">
<Trans>Eligible for Premium?</Trans>
</h2>
<ActivityPremiumAddressVerifyCard
chainId={ChainId.Mainnet}
source={Source.Twitter}
label={
premiumAddress ? <Trans>Wallet submitted</Trans> : <Trans>Submit an evm wallet to check</Trans>
}
/>
<div className="flex w-full flex-col space-y-2 text-sm font-semibold leading-6">
<ActivityPremiumConditionList
title={<Trans>Meet any of the following to unlock premium status and get more $Trump:</Trans>}
source={Source.Twitter}
/>
</div>
</div>
<p className="mb-4 w-full px-6 text-center text-[10px]">
{IS_ANDROID ? (
<Trans>
Read this{' '}
<ClickableButton className="inline text-highlight" onClick={() => setOpenDisclaimer(true)}>
disclaimer
</ClickableButton>{' '}
before participation. All rights reserved by Firefly.
</Trans>
) : (
<Trans>
Read this{' '}
<ClickableButton className="inline text-highlight" onClick={() => setOpenDisclaimer(true)}>
disclaimer
</ClickableButton>{' '}
before participation. For any inquiries, please{' '}
<Link href={FIREFLY_TELEGRAM_URL} target="_blank" className="inline text-highlight">
contact us
</Link>
. All rights reserved by Firefly.
</Trans>
)}
</p>
<div
className={classNames(
'sticky bottom-0 mt-auto w-full bg-primaryBottom px-4',
fireflyBridgeProvider.supported && IS_ANDROID
? 'pb-safe-or-8'
: 'pt-1.5 pb-safe-or-4 max-md:pb-safe-or-2',
)}
>
<ActivityClaimButton
status={data.status}
shareContent={shareContent as Chars}
claimType={isPremium ? 'premium' : 'base'}
disabled={disabled}
source={Source.Twitter}
buttonText={buttonText}
claimApiExtraParams={{
evmWalletAddress: premiumAddress,
solanaWalletAddress: address,
}}
onSuccess={useCallback(() => {
setIsSuccessParticipate(true);
}, [])}
hasSuccessDialog={false}
/>
<ActivityNormalSuccessDialog
shareContent={shareContent as Chars}
claimType={isPremium ? 'premium' : 'base'}
open={isSuccessParticipate}
onClose={() => setIsSuccessParticipate(false)}
/>
</div>
</>
);
}
7 changes: 7 additions & 0 deletions src/components/Activity/ActivityTasks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ActivityElex24Tasks } from '@/components/Activity/ActivityTasks/Activit
import { ActivityFrensgivingTasks } from '@/components/Activity/ActivityTasks/ActivityFrensgivingTasks.js';
import { ActivityHlblTasks } from '@/components/Activity/ActivityTasks/ActivityHlblTasks.js';
import { ActivityPenguTasks } from '@/components/Activity/ActivityTasks/ActivityPenguTasks.js';
import { ActivityTrumpTasks } from '@/components/Activity/ActivityTasks/ActivityTrumpTasks.js';
import type { ActivityInfoResponse } from '@/providers/types/Firefly.js';

interface Props {
Expand All @@ -26,6 +27,12 @@ export function ActivityTasks({ name, data }: Props) {
<ActivityPenguTasks data={data} />
</ActivityMobileOnly>
);
case 'trump':
return (
<ActivityMobileOnly>
<ActivityTrumpTasks data={data} />
</ActivityMobileOnly>
);
default:
return null;
}
Expand Down
11 changes: 7 additions & 4 deletions src/components/Activity/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { forwardRef, type HTMLProps, type PropsWithChildren } from 'react';
import urlcat from 'urlcat';

import { Link as RawLink } from '@/components/Link.js';
import { IS_ANDROID } from '@/constants/bowser.js';
import { fireflyBridgeProvider } from '@/providers/firefly/Bridge.js';
import { SupportedMethod } from '@/types/bridge.js';

Expand All @@ -17,13 +18,15 @@ export const Link = forwardRef<
data-disable-nprogress
onClick={(event) => {
if (fireflyBridgeProvider.supported) {
event.preventDefault();
const url = !props.href.startsWith('https')
? urlcat(window.location.origin, props.href)
: props.href;
fireflyBridgeProvider.request(SupportedMethod.OPEN_URL, {
url,
});
if (!IS_ANDROID) {
event.preventDefault();
fireflyBridgeProvider.request(SupportedMethod.OPEN_URL, {
url,
});
}
} else {
props.onClick?.(event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function useActivityCurrentAccountHandle(source: SocialSource) {
const { data } = useActivityConnections();
switch (source) {
case Source.Twitter:
return data?.rawConnections.twitter.connected[0]?.twitters?.[0].handle;
return data?.rawConnections.twitter.connected[0]?.handle;
case Source.Lens:
return data?.rawConnections.lens.connected[0]?.lens?.[0].fullHandle;
case Source.Farcaster:
Expand Down
Loading

0 comments on commit 5b96713

Please sign in to comment.