SYNC: licensing page improvements

This commit is contained in:
SPRINX0\prochazka
2025-11-07 14:31:56 +01:00
committed by Diflow
parent dc452cdadf
commit 3c58cb1b9c

View File

@@ -14,6 +14,7 @@
import ErrorInfo from './elements/ErrorInfo.svelte'; import ErrorInfo from './elements/ErrorInfo.svelte';
import { isOneOfPage } from './utility/pageDefs'; import { isOneOfPage } from './utility/pageDefs';
import { openWebLink } from './utility/simpleTools'; import { openWebLink } from './utility/simpleTools';
import FontIcon from './icons/FontIcon.svelte';
const config = useConfig(); const config = useConfig();
const values = writable({ amoid: null, databaseServer: null }); const values = writable({ amoid: null, databaseServer: null });
@@ -22,12 +23,10 @@
$: trialDaysLeft = $config?.trialDaysLeft; $: trialDaysLeft = $config?.trialDaysLeft;
let errorMessage = ''; let errorMessage = '';
let expiredMessageSet = false;
$: if (isExpired && !expiredMessageSet) { let isInsertingLicense = false;
errorMessage = 'Your license is expired';
expiredMessageSet = true; $: trialButtonAvailable = !isExpired && trialDaysLeft == null;
}
// $: console.log('CONFIG', $config); // $: console.log('CONFIG', $config);
@@ -41,10 +40,30 @@
<FormProviderCore {values}> <FormProviderCore {values}>
<SpecialPageLayout> <SpecialPageLayout>
{#if getElectron() || ($config?.storageDatabase && hasPermission('admin/license'))} {#if getElectron() || ($config?.storageDatabase && hasPermission('admin/license'))}
<div class="heading">License</div> <div class="heading">Thank you for using DbGate!</div>
{#if isExpired}
<div class="infotext"><FontIcon icon="img warn" /> Your license has expired. Please insert new license.</div>
{:else if trialDaysLeft > 0}
<div class="infotext">
<FontIcon icon="img warn" /> Your trial period will expire in {trialDaysLeft} day{trialDaysLeft != 1
? 's'
: ''}.
</div>
{:else}
<div class="infotext">
<FontIcon icon="img info" /> Please choose licensing model. You could either purchase Premium edition
{#if trialButtonAvailable}, use 30-day free trial{/if} or download free
<Link href="https://dbgate.io/download-community">Community edition</Link>.
</div>
{/if}
{#if isInsertingLicense}
<FormTextAreaField label="Enter your license key" name="licenseKey" rows={5} /> <FormTextAreaField label="Enter your license key" name="licenseKey" rows={5} />
<div class="submit"> <div class="submit">
<div class="flex flex1">
<div class="col-6 flex">
<FormSubmit <FormSubmit
value="Save license" value="Save license"
on:click={async e => { on:click={async e => {
@@ -59,8 +78,30 @@
}} }}
/> />
</div> </div>
<div class="col-6 flex">
<FormStyledButton
value="Cancel"
on:click={() => {
isInsertingLicense = false;
errorMessage = '';
}}
/>
</div>
</div>
</div>
{/if}
{#if !isExpired && trialDaysLeft == null} {#if !isInsertingLicense}
<div class="submit">
<FormStyledButton
value="Insert license key"
on:click={() => {
isInsertingLicense = true;
}}
/>
</div>
{#if trialButtonAvailable}
<div class="submit"> <div class="submit">
<FormStyledButton <FormStyledButton
value="Start 30-day trial" value="Start 30-day trial"
@@ -119,6 +160,7 @@
/> />
</div> </div>
{/if} {/if}
{/if}
{#if errorMessage} {#if errorMessage}
<div class="error">{errorMessage}</div> <div class="error">{errorMessage}</div>
@@ -141,6 +183,10 @@
font-size: xx-large; font-size: xx-large;
} }
.infotext {
margin: 1em;
}
.submit { .submit {
margin: var(--dim-large-form-margin); margin: var(--dim-large-form-margin);
display: flex; display: flex;