Skip to content

Commit

Permalink
check if mutiny plus
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Oct 3, 2023
1 parent 2906a69 commit c10de32
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 22 deletions.
40 changes: 40 additions & 0 deletions src/components/MutinyPlusCta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { ParentComponent } from "solid-js";
import { A } from "solid-start";

import forward from "~/assets/icons/forward.svg";
import { useI18n } from "~/i18n/context";

export const CtaCard: ParentComponent = (props) => {
return (
<div class="w-full">
<div class="relative">
<div class="to-bg-m-grey-900/50 absolute inset-0 h-full w-full scale-[0.60] transform rounded-full bg-m-red/50 bg-gradient-to-r from-m-red/50 blur-2xl" />
<div class="relative flex-col gap-2 rounded-xl border border-m-red bg-m-grey-800 py-4">
{props.children}{" "}
</div>
</div>
</div>
);
};

export function MutinyPlusCta() {
const i18n = useI18n();
return (
<CtaCard>
<A
href={"/settings/plus"}
class="flex w-full flex-col gap-1 px-4 py-2 no-underline hover:bg-m-grey-750 active:bg-m-grey-900"
>
<div class="flex justify-between">
<span>
Mutiny<span class="text-m-red">+</span>
</span>
<img src={forward} alt="go" />
</div>
<div class="text-sm text-m-grey-400">
{i18n.t("settings.plus.cta_description")}
</div>
</A>
</CtaCard>
);
}
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ export * from "./Toaster";
export * from "./NostrActivity";
export * from "./SyncContactsForm";
export * from "./GiftLink";
export * from "./MutinyPlusCta";
8 changes: 6 additions & 2 deletions src/i18n/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ export default {
satisfaction: "Smug satisfaction",
gifting: "Gifting",
multi_device: "Multi-device access",
more: "... and more to come"
more: "... and more to come",
cta_description:
"Enjoy early access to new features and premium functionality."
},
restore: {
title: "Restore",
Expand Down Expand Up @@ -486,7 +488,9 @@ export default {
send_cta: "Create a gift",
send_delete_button: "Delete Gift",
send_delete_confirm:
"Are you sure you want to delete this gift? Is this your rugpull moment?"
"Are you sure you want to delete this gift? Is this your rugpull moment?",
need_plus:
"Upgrade to Mutiny+ to enable gifting. Gifting allows you to create a Mutiny gift URL that can be claimed by anyone with a web browser."
}
},
swap: {
Expand Down
8 changes: 4 additions & 4 deletions src/routes/settings/Connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ function NwcDetails(props: {
</KeyValue>
{/* No interval for gifts */}
<Show when={props.profile.budget_period}>
<KeyValue key={i18n.t("settings.connections.resets_every")}>
{props.profile.budget_period}
</KeyValue>
<KeyValue key={i18n.t("settings.connections.resets_every")}>
{props.profile.budget_period}
</KeyValue>
</Show>
</Show>

Expand Down Expand Up @@ -302,7 +302,7 @@ function Nwc() {
<SettingsCard
title={i18n.t("settings.connections.manage_connections")}
>
<For each={nwcProfiles()?.filter(p => p.tag !== "Gift")}>
<For each={nwcProfiles()?.filter((p) => p.tag !== "Gift")}>
{(profile) => (
<Collapser
title={profile.name}
Expand Down
17 changes: 15 additions & 2 deletions src/routes/settings/Gift.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
IntegratedQr,
LargeHeader,
LoadingSpinner,
MutinyPlusCta,
MutinyWalletGuard,
NavBar,
NiceP,
Expand All @@ -47,7 +48,10 @@ type CreateGiftForm = {
amount: string;
};

export function SingleGift(props: { profile: NwcProfile; onDelete?: () => void }) {
export function SingleGift(props: {
profile: NwcProfile;
onDelete?: () => void;
}) {
const i18n = useI18n();
const [state, _actions] = useMegaStore();

Expand Down Expand Up @@ -199,6 +203,15 @@ export default function GiftPage() {
<SafeArea>
<DefaultMain>
<BackPop />
<Show when={!state.mutiny_plus}>
<VStack>
<LargeHeader>
{i18n.t("settings.gift.send_header")}
</LargeHeader>
<NiceP>{i18n.t("settings.gift.need_plus")}</NiceP>
<MutinyPlusCta />
</VStack>
</Show>
<Show when={giftResult()}>
<VStack>
<Switch>
Expand Down Expand Up @@ -234,7 +247,7 @@ export default function GiftPage() {
</Button>
</VStack>
</Show>
<Show when={!giftResult()}>
<Show when={!giftResult() && state.mutiny_plus}>
<LargeHeader>
{i18n.t("settings.gift.send_header")}
</LargeHeader>
Expand Down
5 changes: 1 addition & 4 deletions src/routes/settings/Plus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ function Perks(props: { alreadySubbed?: boolean }) {
<Show when={props.alreadySubbed}>
<li>{i18n.t("settings.plus.satisfaction")}</li>
</Show>
<li>{i18n.t("settings.plus.gifting")} </li>
<li>
{i18n.t("redshift.title")}{" "}
<em>{i18n.t("common.coming_soon")}</em>
</li>
<li>
{i18n.t("settings.plus.gifting")}{" "}
<em>{i18n.t("common.coming_soon")}</em>
</li>
<li>
{i18n.t("settings.plus.multi_device")}{" "}
<em>{i18n.t("common.coming_soon")}</em>
Expand Down
15 changes: 5 additions & 10 deletions src/routes/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
DefaultMain,
ExternalLink,
LargeHeader,
MutinyPlusCta,
NavBar,
SafeArea,
SettingsCard,
Expand Down Expand Up @@ -78,15 +79,7 @@ export default function Settings() {
<LargeHeader>{i18n.t("settings.header")}</LargeHeader>
<VStack biggap>
<Show when={state.settings?.selfhosted !== "true"}>
<SettingsLinkList
header={i18n.t("settings.plus.title")}
links={[
{
href: "/settings/plus",
text: i18n.t("settings.support")
}
]}
/>
<MutinyPlusCta />
</Show>
<SettingsLinkList
header={i18n.t("settings.general")}
Expand Down Expand Up @@ -137,7 +130,9 @@ export default function Settings() {
disabled: !state.mutiny_plus,

text: i18n.t("settings.gift.title"),
caption: !state.mutiny_plus ? "Upgrade to Mutiny+ to enabled gifting" : undefined
caption: !state.mutiny_plus
? "Upgrade to Mutiny+ to enabled gifting"
: undefined
},
{
href: "/settings/lnurlauth",
Expand Down

0 comments on commit c10de32

Please sign in to comment.