From 7071ed4ef4641bc7a7247f2b56ba1159c9606112 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 5 Mar 2021 12:46:13 +0100 Subject: [PATCH] prices --- docker/kratos/oathkeeper/access-rules.yml | 2 +- .../dashboard/src/pages/payments-square.js | 245 ------------------ 2 files changed, 1 insertion(+), 246 deletions(-) delete mode 100644 packages/dashboard/src/pages/payments-square.js diff --git a/docker/kratos/oathkeeper/access-rules.yml b/docker/kratos/oathkeeper/access-rules.yml index ae5bbd71..66e7b770 100644 --- a/docker/kratos/oathkeeper/access-rules.yml +++ b/docker/kratos/oathkeeper/access-rules.yml @@ -65,7 +65,7 @@ preserve_host: true url: "http://accounts:3000" match: - url: "http://oathkeeper<{,:4455}>/<{user,user/**,login,logout}>" + url: "http://oathkeeper<{,:4455}>/<{user,user/**,prices,login,logout}>" methods: - GET - POST diff --git a/packages/dashboard/src/pages/payments-square.js b/packages/dashboard/src/pages/payments-square.js deleted file mode 100644 index b4541e71..00000000 --- a/packages/dashboard/src/pages/payments-square.js +++ /dev/null @@ -1,245 +0,0 @@ -import dayjs from "dayjs"; -import Layout from "../components/Layout"; -import useSWR from "swr"; -import ky from "ky/umd"; - -const plans = [ - { id: "initial_free", name: "Free", price: 0, description: "Unlimited bandwidth with throttled speed" }, - { id: "initial_plus", name: "Skynet Plus", price: 5, description: "1 TB premium bandwidth with full speed" }, - { id: "initial_pro", name: "Skynet Pro", price: 20, description: "5 TB premium bandwidth with full speed" }, - { id: "initial_extreme", name: "Skynet Extreme", price: 80, description: "20 TB premium bandwidth with full speed" }, -]; -const currentlyActivePlan = "initial_free"; - -const fetcher = (url) => fetch(url).then((r) => r.json()); - -export default function Payments() { - const { data: invoices } = useSWR("/api/square/invoices", fetcher); - const { data: subscription, mutate: mutateSubscription } = useSWR("/api/square/subscription", fetcher); - const handleSubscriptionCancel = async (e) => { - e.preventDefault(); - - try { - const subscription = await ky.post("/api/square/subscription/cancel").json(); - - mutateSubscription(subscription, false); - } catch (error) { - console.log(error); - } - }; - const handleSubscriptionRestore = async (e) => { - e.preventDefault(); - - try { - const subscription = await ky.post("/api/square/subscription/restore").json(); - - mutateSubscription(subscription, false); - } catch (error) { - console.log(error); - } - }; - - return ( - -
-
- {/* This example requires Tailwind CSS v2.0+ */} -
-
-
-
Current plan
-
Free
-
-
-
-
-
Current payment
-
-
-
-
-
-
Plan usage this month
-
24.57%
-
-
-
- - {/* Plan */} -
-
-
-
-
-
-

- Plan -

-
-
-
- Pricing plans -
    - {plans.map((plan, index) => ( -
  • - {/* On: "bg-orange-50 border-orange-200 z-10", Off: "border-gray-200" */} -
    - -

    - {/* On: "text-orange-900", Off: "text-gray-900" */} - {plan.price ? `$${plan.price} / mo` : "no cost"} - {/* On: "text-orange-700", Off: "text-gray-500" */} - {/* ($290 / yr) */} -

    - {/* On: "text-orange-700", Off: "text-gray-500" */} -

    - {plan.description} -

    -
    -
  • - ))} -
-
-
- Currently active plan: - {subscription ? subscription.planId : "Free"} - {subscription && ( - - paid until {subscription.paidUntilDate} -{" "} - {subscription.canceledDate ? ( - <> - cancelled on {subscription.canceledDate} -{" "} - - restore subscription - - - ) : ( - <> - - cancel subscription - - - )} - - )} -
-
-
- -
-
-
-
- {/* Billing history */} -
-
-
-

- Billing history -

-
-
-
-
-
- - - - - - - - {/* - `relative` is added here due to a weird bug in Safari that causes `sr-only` headings to introduce overflow on the body on mobile. - */} - - - - - {invoices && - invoices.map((invoice) => ( - - - - - - - - ))} - -
- Date - - Invoice - - Description - - Status - - View receipt -
- {dayjs(invoice.createdAt).format("DD/MM/YYYY")} - - {invoice.invoiceNumber} - {invoice.title}{invoice.status} - - View invoice - -
-
-
-
-
-
-
-
-
-
- ); -}