Skip to content

Commit

Permalink
feat(payment): fix paddle setup + create subscription payment UI skel…
Browse files Browse the repository at this point in the history
…eton
  • Loading branch information
NicolasRichel committed Oct 29, 2021
1 parent 9965a4c commit ed2ffa9
Show file tree
Hide file tree
Showing 14 changed files with 321 additions and 238 deletions.
4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<link rel="icon" href="<%= BASE_URL %>favicon.png">
<title>BIMData Platform</title>
<script src="https://cdn.paddle.com/paddle/paddle.js"></script>
<script type="text/javascript">
Paddle.Environment.set('sandbox');
Paddle.Setup({ vendor: 2342 });
</script>
</head>
<body>
<noscript>
Expand Down
11 changes: 11 additions & 0 deletions public/static/storage-preview-image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions public/static/subscription-info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.storage-preview {
display: flex;
flex-direction: column;
align-items: center;
gap: calc(var(--spacing-unit) * 3);
padding: calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 4);

&__actual,
&__new {
width: 100%;
}
}
64 changes: 64 additions & 0 deletions src/components/specific/payment/storage-preview/StoragePreview.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<div class="storage-preview">
<div class="storage-preview__title">
<h1>{{ $t("StoragePreview.title") }}</h1>
</div>
<div class="storage-preview__logo">
<img
src="/static/storage-preview-image.svg"
alt="storage-preview-image"
/>
</div>
<div class="storage-preview__actual">
<ProgressBar class="m-b-12" componentWidth="100%" :progressPercent="36">
<template #text-left-above>
{{ $t("StoragePreview.actualStorage") }}
</template>
<template #text-left-below>
<span>125MB</span>
</template>
<template #text-right-below>
<span>500MB</span>
</template>
</ProgressBar>
<BIMDataText color="color-tertiary-dark">
{{ $t("StoragePreview.actualStorageText") }}
</BIMDataText>
</div>
<div class="storage-preview__new">
<ProgressBar class="m-b-12" componentWidth="100%" :progressPercent="15">
<template #text-left-above>
{{ $t("StoragePreview.newStorage") }}
</template>
<template #text-left-below>
<span>125MB</span>
</template>
<template #text-right-below>
<span>10GB</span>
</template>
</ProgressBar>
<BIMDataText color="color-tertiary-dark">
{{ $t("StoragePreview.newStorageText") }}
</BIMDataText>
</div>
</div>
</template>

<script>
// Components
import ProgressBar from "@/components/generic/progress-bar/ProgressBar.vue";
export default {
components: {
ProgressBar
},
props: {
// TODO
},
setup() {
// TODO
}
};
</script>

<style scoped lang="scss" src="./StoragePreview.scss"></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.subscription-form {
// TODO
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<template>
<div class="subscription-form paddle-checkout-container">
<!-- Paddle inline checkout will be loaded here -->
</div>
</template>

<script>
import { onMounted } from "vue";
import { useUser } from "@/state/user.js";
export default {
props: {
organization: {
type: Object,
required: true
},
space: {
type: Object,
required: true
}
},
setup() {
const { user } = useUser();
onMounted(() => {
Paddle.Checkout.open({
// Checkout params
product: 12403,
method: "inline",
disableLogout: true,
referring_domain: "platform self service",
// User data
email: user.value.email,
// passthrough: {
// organization_id: "1663",
// cloud_id: "673"
// },
// Checkout frame
frameTarget: "paddle-checkout-container",
frameInitialHeight: 416,
frameStyle:
"width:100%; min-width:312px; background-color: transparent; border: none;"
});
});
}
};
</script>

<style scoped lang="scss" src="./SubscriptionForm.scss"></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div class="subscription-info">
<img src="/static/subscription-info.svg" alt="subscription-info" />
</div>
</template>
9 changes: 9 additions & 0 deletions src/i18n/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
},
"homeButtonText": "Home"
},
"Payment": {
"title": "Upgrade to pro platform"
},
"PlatformSubscription": {
"platformSubscriptionTitle": "Platform subscription",
"platformSubscriptionText": "Lorem ipsum"
Expand Down Expand Up @@ -557,6 +560,12 @@
"addUserButtonText": "Add new admin"
},

"StoragePreview": {
"title": "Storage",
"actualStorage": "Actual storage",
"newStorage": "New storage"
},

"UserCard": {
"self": "you"
},
Expand Down
11 changes: 11 additions & 0 deletions src/i18n/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
},
"homeButtonText": "Home"
},
"Payment": {
"title": "Passer à la platforme professionnelle"
},
"PlatformSubscription": {
"platformSubscriptionTitle": "Abonnement à la plateforme",
"platformSubscriptionText": "Lorem ipsum"
Expand Down Expand Up @@ -560,6 +563,14 @@
"addUserButtonText": "Ajouter un administrateur"
},

"StoragePreview": {
"title": "Stockage",
"actualStorage": "Stockage actuel",
"actualStorageText": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"newStorage": "Nouveau stockage",
"newStorageText": "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit."
},

"UserCard": {
"self": "vous"
},
Expand Down
8 changes: 4 additions & 4 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const UserProjects = () =>
import(/* webpackChunkName: "user-projects" */ "@/views/user-projects/UserProjects.vue");
const PlatformSubscription = () =>
import(/* webpackChunkName: "platform-subscription" */ "@/views/platform-subscription/PlatformSubscription.vue");
const Payment = () =>
const Payment = () =>
import(/* webpackChunkName: "payment" */ "@/views/payment/Payment.vue");
const SpacePayment = () =>
import(/* webpackChunkName: "payment" */ "@/views/space-payment/SpacePayment.vue");
const SpacePayment = () =>
import(/* webpackChunkName: "space-payment" */ "@/views/space-payment/SpacePayment.vue");
const UserSpaces = () =>
import(/* webpackChunkName: "user-spaces" */ "@/views/user-spaces/UserSpaces.vue");
/* eslint-enable */
Expand Down Expand Up @@ -99,7 +99,7 @@ const routes = [
component: PlatformSubscription
},
{
path: "/payment/",
path: "/payment",
name: routeNames.payment,
component: Payment
},
Expand Down
2 changes: 1 addition & 1 deletion src/state/organizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const resetState = () => {

const retrieveUserOrganizations = async () => {
const organizations = await OrganizationService.fetchUserOrganizations();
organizations.sort((a, b) => (a.name < b.name ? 1 : -1));
organizations.sort((a, b) => (a.created_at < b.created_at ? 1 : -1));
state.userOrganizations = organizations;
return organizations;
};
Expand Down
98 changes: 28 additions & 70 deletions src/views/payment/Payment.scss
Original file line number Diff line number Diff line change
@@ -1,79 +1,37 @@
.paddle-payment {
&__header {
h1 {
width: calc(100% - 84px);
}
button {
width: 84px;
}
.payment {
&__title {
margin: 0;
}

&__content {
display: grid;
grid-template-columns: 400px 400px;
gap: calc(var(--spacing-unit) * 4);
.create-select-orga,
.create-space {
position: relative;
&::after {
content: "";
width: 34px;
height: 34px;
position: absolute;
top: calc(-34px / 2);
background-color: var(--color-secondary);
display: inline-flex;
align-items: center;
justify-content: center;
}
}
.create-select-orga {
&::after {
content: "1";
}
}
.create-space {
&::after {
content: "2";
}
}
& > div {
background: #ffffff;
box-shadow: 0px 2px 20px rgba(0, 0, 0, 0.05);
}
&::v-deep(.bimdata-card) {
overflow: inherit;
h3 {
font-size: 24px;
}
.bimdata-radio > span {
font-size: 13px;
}
.bimdata-card__content {
padding: 12px 70px;
height: 100%;
display: flex;
justify-content: space-between;
flex-direction: column;
}
}
}
&__payment {
display: grid;
grid-template-columns: 0.5fr 1fr 1.5fr 1fr 0.5fr;
gap: calc(var(--spacing-unit) * 4);
grid-template-areas: ". left center right .";
& > div {
background: #ffffff;
box-shadow: 0px 2px 20px rgba(0, 0, 0, 0.05);
}
margin-top: calc(var(--spacing-unit) * 2);

display: flex;
justify-content: center;
gap: calc(var(--spacing-unit) * 3);

&__left {
grid-area: left;
}
width: 400px;
box-shadow: var(--box-shadow);
background-color: var(--color-white);

display: flex;
justify-content: center;
align-items: center;

padding: calc(var(--spacing-unit) * 3);
}

&__center {
grid-area: center;
width: 600px;
box-shadow: var(--box-shadow);
background-color: var(--color-white);
}

&__right {
grid-area: right;
width: 400px;
box-shadow: var(--box-shadow);
background-color: var(--color-white);
}
}
}
Loading

0 comments on commit ed2ffa9

Please sign in to comment.