kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Refactor code to use accepts_zaps_cashu
rodzic
7c9f740258
commit
0957c5b92e
|
@ -48,7 +48,7 @@ import DropdownMenu from 'soapbox/components/dropdown-menu/index.ts';
|
|||
import PureStatusReactionWrapper from 'soapbox/components/pure-status-reaction-wrapper.tsx';
|
||||
import StatusActionButton from 'soapbox/components/status-action-button.tsx';
|
||||
import HStack from 'soapbox/components/ui/hstack.tsx';
|
||||
import { useZapCashuRequest, useWalletStore } from 'soapbox/features/zap/hooks/useHooks.ts';
|
||||
import { useZapCashuRequest } from 'soapbox/features/zap/hooks/useHooks.ts';
|
||||
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
||||
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
|
||||
import { useDislike } from 'soapbox/hooks/useDislike.ts';
|
||||
|
@ -180,7 +180,6 @@ const PureStatusActionBar: React.FC<IPureStatusActionBar> = ({
|
|||
const features = useFeatures();
|
||||
const { boostModal, deleteModal } = useSettings();
|
||||
|
||||
const { acceptsZapsCashu } = useWalletStore();
|
||||
const { zapCashuList } = useZapCashuRequest();
|
||||
const isZappedCashu = zapCashuList.some((zapCashu)=> zapCashu === status.id);
|
||||
|
||||
|
@ -764,6 +763,7 @@ const PureStatusActionBar: React.FC<IPureStatusActionBar> = ({
|
|||
|
||||
const canShare = ('share' in navigator) && (status.visibility === 'public' || status.visibility === 'group');
|
||||
const acceptsZaps = status.account.ditto.accepts_zaps === true;
|
||||
const acceptsZapsCashu = status.account.ditto.accepts_zaps_cashu === true;
|
||||
|
||||
const spacing: {
|
||||
[key: string]: React.ComponentProps<typeof HStack>['space'];
|
||||
|
|
|
@ -49,7 +49,7 @@ import DropdownMenu from 'soapbox/components/dropdown-menu/index.ts';
|
|||
import StatusActionButton from 'soapbox/components/status-action-button.tsx';
|
||||
import StatusReactionWrapper from 'soapbox/components/status-reaction-wrapper.tsx';
|
||||
import HStack from 'soapbox/components/ui/hstack.tsx';
|
||||
import { useZapCashuRequest, useWalletStore } from 'soapbox/features/zap/hooks/useHooks.ts';
|
||||
import { useZapCashuRequest } from 'soapbox/features/zap/hooks/useHooks.ts';
|
||||
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
||||
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
|
||||
import { useFeatures } from 'soapbox/hooks/useFeatures.ts';
|
||||
|
@ -175,7 +175,6 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
|||
const features = useFeatures();
|
||||
const { boostModal, deleteModal } = useSettings();
|
||||
|
||||
const { acceptsZapsCashu } = useWalletStore();
|
||||
const { zapCashuList } = useZapCashuRequest();
|
||||
const isZappedCashu = zapCashuList.some((zapCashu)=> zapCashu === status.id);
|
||||
|
||||
|
@ -754,6 +753,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
|||
|
||||
const canShare = ('share' in navigator) && (status.visibility === 'public' || status.visibility === 'group');
|
||||
const acceptsZaps = status.account.ditto.accepts_zaps === true;
|
||||
const acceptsZapsCashu = status.account.ditto.accepts_zaps_cashu === true;
|
||||
|
||||
const spacing: {
|
||||
[key: string]: React.ComponentProps<typeof HStack>['space'];
|
||||
|
|
|
@ -44,7 +44,6 @@ import VerificationBadge from 'soapbox/components/verification-badge.tsx';
|
|||
import MovedNote from 'soapbox/features/account-timeline/components/moved-note.tsx';
|
||||
import ActionButton from 'soapbox/features/ui/components/action-button.tsx';
|
||||
import SubscriptionButton from 'soapbox/features/ui/components/subscription-button.tsx';
|
||||
import { useWallet } from 'soapbox/features/zap/hooks/useHooks.ts';
|
||||
import { usePaymentMethod } from 'soapbox/features/zap/usePaymentMethod.ts';
|
||||
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
||||
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
|
||||
|
@ -121,9 +120,6 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
|||
|
||||
const { software } = useAppSelector((state) => parseVersion(state.instance.version));
|
||||
|
||||
const { wallet } = useWallet();
|
||||
|
||||
|
||||
const { getOrCreateChatByAccountId } = useChats();
|
||||
|
||||
const createAndNavigateToChat = useMutation({
|
||||
|
@ -684,7 +680,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
|||
const info = makeInfo();
|
||||
const menu = makeMenu();
|
||||
const acceptsZaps = account.ditto.accepts_zaps === true;
|
||||
const hasWallet = wallet !== null;
|
||||
const acceptsZapsCashu = account.ditto.accepts_zaps_cashu === true;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -726,7 +722,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
|||
<SubscriptionButton account={account} />
|
||||
{renderMessageButton()}
|
||||
{renderShareButton()}
|
||||
{(acceptsZaps || hasWallet) && renderZapAccount()}
|
||||
{(acceptsZaps || acceptsZapsCashu) && renderZapAccount()}
|
||||
|
||||
{menu.length > 0 && (
|
||||
<DropdownMenu items={menu} placement='bottom-end'>
|
||||
|
|
|
@ -38,6 +38,7 @@ const baseAccountSchema = z.object({
|
|||
display_name: z.string().catch(''),
|
||||
ditto: coerceObject({
|
||||
accepts_zaps: z.boolean().catch(false),
|
||||
accepts_zaps_cashu: z.boolean().catch(false),
|
||||
external_url: z.string().optional().catch(undefined),
|
||||
streak: coerceObject({
|
||||
days: z.number().catch(0),
|
||||
|
|
Ładowanie…
Reference in New Issue