Add license feature for PDF and update UI to account for it
This commit is contained in:
parent
ad1a285f30
commit
6fbc7d2bae
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { Body } from "@budibase/bbui"
|
||||
import { Body, Tag, Tags } from "@budibase/bbui"
|
||||
import CreationPage from "@/components/common/CreationPage.svelte"
|
||||
import blank from "./images/blank.svg"
|
||||
import table from "./images/tableInline.svg"
|
||||
|
@ -7,6 +7,7 @@
|
|||
import pdf from "./images/pdf.svg"
|
||||
import CreateScreenModal from "./CreateScreenModal.svelte"
|
||||
import { screenStore } from "@/stores/builder"
|
||||
import { licensing } from "@/stores/portal"
|
||||
import { AutoScreenTypes } from "@/constants"
|
||||
|
||||
export let onClose = null
|
||||
|
@ -55,19 +56,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="card"
|
||||
on:click={() => createScreenModal.show(AutoScreenTypes.PDF)}
|
||||
>
|
||||
<div class="image">
|
||||
<img alt="A form containing data" src={pdf} width="185" />
|
||||
</div>
|
||||
<div class="text">
|
||||
<Body size="M">PDF</Body>
|
||||
<Body size="XS">Create, edit and export your PDF</Body>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="card"
|
||||
on:click={() => createScreenModal.show(AutoScreenTypes.FORM)}
|
||||
|
@ -80,6 +68,29 @@
|
|||
<Body size="XS">Capture data from your users</Body>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="card"
|
||||
class:disabled={!$licensing.pdfEnabled}
|
||||
on:click={$licensing.pdfEnabled
|
||||
? () => createScreenModal.show(AutoScreenTypes.PDF)
|
||||
: null}
|
||||
>
|
||||
<div class="image">
|
||||
<img alt="A PDF document" src={pdf} width="185" />
|
||||
</div>
|
||||
<div class="text">
|
||||
<Body size="M">
|
||||
PDF
|
||||
{#if !$licensing.pdfEnabled}
|
||||
<Tags>
|
||||
<Tag icon="LockClosed">Premium</Tag>
|
||||
</Tags>
|
||||
{/if}
|
||||
</Body>
|
||||
<Body size="XS">Create, edit and export your PDF</Body>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CreationPage>
|
||||
</div>
|
||||
|
@ -110,7 +121,7 @@
|
|||
transition: filter 150ms;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
.card:not(.disabled):hover {
|
||||
filter: brightness(1.1);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -120,16 +131,22 @@
|
|||
width: 100%;
|
||||
max-height: 127px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card .image {
|
||||
min-width: 235px;
|
||||
height: 127px;
|
||||
background-color: var(--grey-2);
|
||||
position: relative;
|
||||
}
|
||||
.card.disabled .image:after {
|
||||
content: "";
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.image img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.text {
|
||||
|
@ -140,7 +157,11 @@
|
|||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.text :global(p:first-child) {
|
||||
display: flex;
|
||||
gap: var(--spacing-m);
|
||||
align-items: center;
|
||||
}
|
||||
.text :global(p:nth-child(2)) {
|
||||
color: var(--spectrum-global-color-gray-600);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ interface LicensingState {
|
|||
customAppScriptsEnabled: boolean
|
||||
syncAutomationsEnabled: boolean
|
||||
triggerAutomationRunEnabled: boolean
|
||||
pdfEnabled: boolean
|
||||
// the currently used quotas from the db
|
||||
quotaUsage?: QuotaUsage
|
||||
// derived quota metrics for percentages used
|
||||
|
@ -81,6 +82,7 @@ class LicensingStore extends BudiStore<LicensingState> {
|
|||
customAppScriptsEnabled: false,
|
||||
syncAutomationsEnabled: false,
|
||||
triggerAutomationRunEnabled: false,
|
||||
pdfEnabled: false,
|
||||
// the currently used quotas from the db
|
||||
quotaUsage: undefined,
|
||||
// derived quota metrics for percentages used
|
||||
|
@ -187,6 +189,7 @@ class LicensingStore extends BudiStore<LicensingState> {
|
|||
const customAppScriptsEnabled = features.includes(
|
||||
Constants.Features.CUSTOM_APP_SCRIPTS
|
||||
)
|
||||
const pdfEnabled = features.includes(Constants.Features.PDF)
|
||||
this.update(state => {
|
||||
return {
|
||||
...state,
|
||||
|
@ -208,6 +211,7 @@ class LicensingStore extends BudiStore<LicensingState> {
|
|||
triggerAutomationRunEnabled,
|
||||
perAppBuildersEnabled,
|
||||
customAppScriptsEnabled,
|
||||
pdfEnabled,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ export enum Feature {
|
|||
OFFLINE = "offline",
|
||||
EXPANDED_PUBLIC_API = "expandedPublicApi",
|
||||
CUSTOM_APP_SCRIPTS = "customAppScripts",
|
||||
PDF = "pdf",
|
||||
// deprecated - no longer licensed
|
||||
VIEW_PERMISSIONS = "viewPermissions",
|
||||
VIEW_READONLY_COLUMNS = "viewReadonlyColumns",
|
||||
|
|
Loading…
Reference in New Issue