|
10 | 10 | ref="purchaseModal"
|
11 | 11 | :product="selectedProduct"
|
12 | 12 | :country="country"
|
| 13 | + :custom-server="customServer" |
13 | 14 | :publishable-key="config.public.stripePublishableKey"
|
14 | 15 | :send-billing-request="
|
15 | 16 | async (body) =>
|
|
456 | 457 | <button
|
457 | 458 | v-if="!isSmallAtCapacity"
|
458 | 459 | class="!bg-highlight-blue !font-medium !text-blue"
|
459 |
| - @click="selectProduct(pyroProducts[0])" |
| 460 | + @click="selectProduct(pyroPlanProducts[0])" |
460 | 461 | >
|
461 | 462 | Get Started
|
462 | 463 | <RightArrowIcon class="!min-h-4 !min-w-4 !text-blue" />
|
|
514 | 515 | <button
|
515 | 516 | v-if="!isMediumAtCapacity"
|
516 | 517 | class="shadow-xl"
|
517 |
| - @click="selectProduct(pyroProducts[1])" |
| 518 | + @click="selectProduct(pyroPlanProducts[1])" |
518 | 519 | >
|
519 | 520 | Get Started
|
520 | 521 | <RightArrowIcon class="!min-h-4 !min-w-4" />
|
|
561 | 562 | <button
|
562 | 563 | v-if="!isLargeAtCapacity"
|
563 | 564 | class="!bg-highlight-purple !font-medium !text-purple"
|
564 |
| - @click="selectProduct(pyroProducts[2])" |
| 565 | + @click="selectProduct(pyroPlanProducts[2])" |
565 | 566 | >
|
566 | 567 | Get Started
|
567 | 568 | <RightArrowIcon class="!min-h-4 !min-w-4 !text-purple" />
|
|
598 | 599 |
|
599 | 600 | <div class="flex w-full flex-col-reverse gap-2 md:w-auto md:flex-col md:items-center">
|
600 | 601 | <ButtonStyled color="standard" size="large">
|
601 |
| - <NuxtLink :to="loggedOut ? redirectUrl : '/servers/custom'" class="w-full md:w-fit"> |
| 602 | + <button |
| 603 | + v-if="!isLargeAtCapacity" |
| 604 | + class="w-full md:w-fit" |
| 605 | + @click="selectProduct(pyroProducts, true)" |
| 606 | + > |
| 607 | + Build your own |
| 608 | + <RightArrowIcon class="!min-h-4 !min-w-4" /> |
| 609 | + </button> |
| 610 | + <NuxtLink |
| 611 | + v-else |
| 612 | + :to="loggedOut ? redirectUrl : 'https://support.modrinth.com'" |
| 613 | + :target="loggedOut ? '_self' : '_blank'" |
| 614 | + class="w-full md:w-fit" |
| 615 | + > |
602 | 616 | <template v-if="loggedOut">
|
603 | 617 | Login
|
604 | 618 | <UserIcon class="!min-h-4 !min-w-4" />
|
605 | 619 | </template>
|
606 | 620 | <template v-else>
|
607 |
| - Build your own |
608 |
| - <RightArrowIcon class="!min-h-4 !min-w-4" /> |
| 621 | + Out of Stock |
| 622 | + <ExternalIcon class="!min-h-4 !min-w-4" /> |
609 | 623 | </template>
|
610 | 624 | </NuxtLink>
|
611 | 625 | </ButtonStyled>
|
@@ -633,7 +647,15 @@ import { products } from "~/generated/state.json";
|
633 | 647 | import LoaderIcon from "~/components/ui/servers/icons/LoaderIcon.vue";
|
634 | 648 |
|
635 | 649 | const pyroProducts = products.filter((p) => p.metadata.type === "pyro");
|
636 |
| -pyroProducts.sort((a, b) => a.metadata.ram - b.metadata.ram); |
| 650 | +const pyroPlanProducts = pyroProducts.filter( |
| 651 | + (p) => p.metadata.ram === 4096 || p.metadata.ram === 6144 || p.metadata.ram === 8192, |
| 652 | +); |
| 653 | +pyroPlanProducts.sort((a, b) => a.metadata.ram - b.metadata.ram); |
| 654 | +// yep. this is a thing. |
| 655 | +if (!pyroProducts.metadata) { |
| 656 | + pyroProducts.metadata = {}; |
| 657 | +} |
| 658 | +pyroProducts.metadata.type = "pyro"; |
637 | 659 |
|
638 | 660 | const title = "Modrinth Servers";
|
639 | 661 | const description =
|
@@ -664,6 +686,7 @@ const country = useUserCountry();
|
664 | 686 | const customer = ref(null);
|
665 | 687 | const paymentMethods = ref([]);
|
666 | 688 | const selectedProduct = ref(null);
|
| 689 | +const customServer = ref(false); |
667 | 690 | const showModal = ref(false);
|
668 | 691 | const modalKey = ref(0);
|
669 | 692 |
|
@@ -692,7 +715,7 @@ const { data: capacityStatuses, refresh: refreshCapacity } = await useAsyncData(
|
692 | 715 | "ServerCapacityAll",
|
693 | 716 | async () => {
|
694 | 717 | try {
|
695 |
| - const capacityChecks = pyroProducts.map((product) => |
| 718 | + const capacityChecks = pyroPlanProducts.map((product) => |
696 | 719 | usePyroFetch("capacity", {
|
697 | 720 | method: "POST",
|
698 | 721 | body: {
|
@@ -796,7 +819,7 @@ const isAtCapacity = computed(
|
796 | 819 | () => isSmallAtCapacity.value && isMediumAtCapacity.value && isLargeAtCapacity.value,
|
797 | 820 | );
|
798 | 821 |
|
799 |
| -const selectProduct = async (product) => { |
| 822 | +const selectProduct = async (product, custom) => { |
800 | 823 | if (isAtCapacity.value) {
|
801 | 824 | addNotification({
|
802 | 825 | group: "main",
|
@@ -824,6 +847,7 @@ const selectProduct = async (product) => {
|
824 | 847 | return;
|
825 | 848 | }
|
826 | 849 |
|
| 850 | + customServer.value = !!custom; |
827 | 851 | selectedProduct.value = product;
|
828 | 852 | showModal.value = true;
|
829 | 853 | modalKey.value++;
|
@@ -856,7 +880,8 @@ const openPurchaseModal = () => {
|
856 | 880 | return;
|
857 | 881 | }
|
858 | 882 |
|
859 |
| - selectedProduct.value = pyroProducts[0]; |
| 883 | + customServer.value = false; |
| 884 | + selectedProduct.value = pyroPlanProducts[0]; |
860 | 885 | showModal.value = true;
|
861 | 886 | modalKey.value++;
|
862 | 887 | nextTick(() => {
|
|
0 commit comments