feat(desktop): hide tip and boost for mas

This commit is contained in:
DIYgod
2025-04-21 16:34:44 +08:00
parent a34588baf2
commit b046be71fe
5 changed files with 60 additions and 41 deletions
@@ -13,6 +13,7 @@ import { whoami } from "~/atoms/user"
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
import { apiClient } from "~/lib/api-fetch"
import { UrlBuilder } from "~/lib/url-builder"
import { isInMASReview } from "~/lib/utils"
import { useBoostModal } from "~/modules/boost/hooks"
import { useFeedClaimModal } from "~/modules/claim"
import { FeedForm } from "~/modules/discover/feed-form"
@@ -147,13 +148,17 @@ export const useFeedActions = ({
},
]
: []),
{
type: "text" as const,
label: t("words.boost"),
click: () => {
openBoostModal(feedId)
},
},
...(isInMASReview()
? []
: [
{
type: "text" as const,
label: t("words.boost"),
click: () => {
openBoostModal(feedId)
},
},
]),
{
type: "separator" as const,
disabled: isEntryList,
@@ -108,3 +108,8 @@ export const getBlockchainExplorerUrl = () => {
export const isInMAS = () => {
return typeof process !== "undefined" && process.mas
}
export const isInMASReview = () => {
const serverConfigs = getServerConfigs()
return isInMAS() && serverConfigs?.MAS_IN_REVIEW
}
@@ -20,6 +20,7 @@ import { navigateEntry } from "~/hooks/biz/useNavigateEntry"
import { getRouteParams } from "~/hooks/biz/useRouteParams"
import { tipcClient } from "~/lib/client"
import { parseHtml } from "~/lib/parse-html"
import { isInMASReview } from "~/lib/utils"
import { useActivationModal } from "~/modules/activation"
import { useGalleryModal } from "~/modules/entry-content/hooks"
import { useTipModal } from "~/modules/wallet/hooks"
@@ -107,20 +108,24 @@ export const useRegisterEntryCommands = () => {
const voice = useGeneralSettingKey("voice")
useRegisterFollowCommand([
{
id: COMMAND_ID.entry.tip,
label: t("entry_actions.tip"),
icon: <i className="i-mgc-power-outline" />,
// keyBinding: shortcuts.entry.tip.key,
// when: !isInbox && feed?.ownerUserId !== whoami()?.id && !!populatedEntry,
run: ({ userId, feedId, entryId }) => {
openTipModal({
userId,
feedId,
entryId,
})
},
},
...(isInMASReview()
? ([] as any[])
: [
{
id: COMMAND_ID.entry.tip,
label: t("entry_actions.tip"),
icon: <i className="i-mgc-power-outline" />,
// keyBinding: shortcuts.entry.tip.key,
// when: !isInbox && feed?.ownerUserId !== whoami()?.id && !!populatedEntry,
run: ({ userId, feedId, entryId }) => {
openTipModal({
userId,
feedId,
entryId,
})
},
},
]),
{
id: COMMAND_ID.entry.star,
label: t("entry_actions.star"),
@@ -4,6 +4,7 @@ import { useMemo } from "react"
import { useTranslation } from "react-i18next"
import { useWhoami } from "~/atoms/user"
import { isInMASReview } from "~/lib/utils"
import { useBoostModal } from "~/modules/boost/hooks"
import { useFeedBoostersQuery } from "~/modules/boost/query"
import { FeedIcon } from "~/modules/feed/feed-icon"
@@ -54,29 +55,31 @@ export const SupportCreator = ({ entryId }: { entryId: string }) => {
)}
<span className="-mt-6 text-lg font-medium">{feed.title}</span>
<div className="flex items-center gap-4">
{!isMyOwnedFeed && (
{!isInMASReview() && (
<div className="flex items-center gap-4">
{!isMyOwnedFeed && (
<Button
onClick={() =>
openTipModal({
userId: feed.ownerUserId ?? undefined,
feedId: entry?.feedId,
entryId,
})
}
>
<i className="i-mgc-power-outline mr-1.5 text-lg" />
{t("entry_content.support_creator")}
</Button>
)}
<Button
onClick={() =>
openTipModal({
userId: feed.ownerUserId ?? undefined,
feedId: entry?.feedId,
entryId,
})
}
variant={!isMyOwnedFeed ? "outline" : "primary"}
onClick={() => openBoostModal(feed.id)}
>
<i className="i-mgc-power-outline mr-1.5 text-lg" />
{t("entry_content.support_creator")}
<i className="i-mgc-rocket-cute-fi mr-1.5 text-lg" />
{t("boost.boost_feed")}
</Button>
)}
<Button
variant={!isMyOwnedFeed ? "outline" : "primary"}
onClick={() => openBoostModal(feed.id)}
>
<i className="i-mgc-rocket-cute-fi mr-1.5 text-lg" />
{t("boost.boost_feed")}
</Button>
</div>
</div>
)}
{supportAmount > 0 && (
<>
+1
View File
@@ -15937,6 +15937,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, ({
ANNOUNCEMENT: string;
MAX_TRIAL_USER_FEED_SUBSCRIPTION: number;
MAX_TRIAL_USER_LIST_SUBSCRIPTION: number;
MAS_IN_REVIEW: boolean;
};
};
outputFormat: "json";