mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 20:25:32 -04:00
refactor: buy immich (#18289)
* refactor: buy container * refactor: buy immich
This commit is contained in:
parent
3944f5d73b
commit
fac1beb7d8
@ -4,6 +4,7 @@
|
|||||||
import { purchaseStore } from '$lib/stores/purchase.store';
|
import { purchaseStore } from '$lib/stores/purchase.store';
|
||||||
import { handleError } from '$lib/utils/handle-error';
|
import { handleError } from '$lib/utils/handle-error';
|
||||||
import { activateProduct, getActivationKey } from '$lib/utils/license-utils';
|
import { activateProduct, getActivationKey } from '$lib/utils/license-utils';
|
||||||
|
import { Heading } from '@immich/ui';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import UserPurchaseOptionCard from './individual-purchase-option-card.svelte';
|
import UserPurchaseOptionCard from './individual-purchase-option-card.svelte';
|
||||||
import ServerPurchaseOptionCard from './server-purchase-option-card.svelte';
|
import ServerPurchaseOptionCard from './server-purchase-option-card.svelte';
|
||||||
@ -36,52 +37,50 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="p-4">
|
<section>
|
||||||
<div>
|
{#if showTitle}
|
||||||
{#if showTitle}
|
<Heading color="primary" tag="h1" class="text-4xl font-bold tracking-wider">
|
||||||
<h1 class="text-4xl font-bold tracking-wider">
|
{$t('purchase_option_title')}
|
||||||
{$t('purchase_option_title')}
|
</Heading>
|
||||||
</h1>
|
{/if}
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if showMessage}
|
{#if showMessage}
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<p>
|
<p>
|
||||||
{$t('purchase_panel_info_1')}
|
{$t('purchase_panel_info_1')}
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
{$t('purchase_panel_info_2')}
|
{$t('purchase_panel_info_2')}
|
||||||
</p>
|
</p>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="flex flex-col sm:flex-row gap-6 mt-4 justify-between">
|
|
||||||
<ServerPurchaseOptionCard />
|
|
||||||
<UserPurchaseOptionCard />
|
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="mt-6">
|
<div class="flex flex-col sm:flex-row gap-6 mt-4 justify-between">
|
||||||
<p class="dark:text-immich-gray">{$t('purchase_input_suggestion')}</p>
|
<ServerPurchaseOptionCard />
|
||||||
<form class="mt-2 flex gap-2" onsubmit={activate}>
|
<UserPurchaseOptionCard />
|
||||||
<input
|
</div>
|
||||||
class="immich-form-input w-full"
|
|
||||||
id="purchaseKey"
|
<div class="mt-6">
|
||||||
type="text"
|
<p class="dark:text-immich-gray">{$t('purchase_input_suggestion')}</p>
|
||||||
bind:value={productKey}
|
<form class="mt-2 flex gap-2" onsubmit={activate}>
|
||||||
required
|
<input
|
||||||
placeholder="IMCL-0KEY-0CAN-00BE-FOUD-FROM-YOUR-EMAIL-INBX"
|
class="immich-form-input w-full"
|
||||||
disabled={isLoading}
|
id="purchaseKey"
|
||||||
/>
|
type="text"
|
||||||
<Button type="submit" rounded="lg"
|
bind:value={productKey}
|
||||||
>{#if isLoading}
|
required
|
||||||
<LoadingSpinner />
|
placeholder="IMCL-0KEY-0CAN-00BE-FOUD-FROM-YOUR-EMAIL-INBX"
|
||||||
{:else}
|
disabled={isLoading}
|
||||||
{$t('purchase_button_activate')}
|
/>
|
||||||
{/if}</Button
|
<Button type="submit" rounded="lg"
|
||||||
>
|
>{#if isLoading}
|
||||||
</form>
|
<LoadingSpinner />
|
||||||
</div>
|
{:else}
|
||||||
|
{$t('purchase_button_activate')}
|
||||||
|
{/if}</Button
|
||||||
|
>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||||
import LicenseActivationSuccess from '$lib/components/shared-components/purchasing/purchase-activation-success.svelte';
|
import LicenseActivationSuccess from '$lib/components/shared-components/purchasing/purchase-activation-success.svelte';
|
||||||
import LicenseContent from '$lib/components/shared-components/purchasing/purchase-content.svelte';
|
import LicenseContent from '$lib/components/shared-components/purchasing/purchase-content.svelte';
|
||||||
|
import SupporterBadge from '$lib/components/shared-components/side-bar/supporter-badge.svelte';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
|
import { purchaseStore } from '$lib/stores/purchase.store';
|
||||||
|
import { Alert, Container, Stack } from '@immich/ui';
|
||||||
|
import { mdiAlertCircleOutline } from '@mdi/js';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
|
||||||
import { mdiAlertCircleOutline } from '@mdi/js';
|
|
||||||
import { purchaseStore } from '$lib/stores/purchase.store';
|
|
||||||
import SupporterBadge from '$lib/components/shared-components/side-bar/supporter-badge.svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: PageData;
|
data: PageData;
|
||||||
@ -21,16 +21,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<UserPageLayout title={$t('buy')}>
|
<UserPageLayout title={$t('buy')}>
|
||||||
<section class="mx-4 flex place-content-center">
|
<Container size="medium" center>
|
||||||
<div class="w-full max-w-3xl">
|
<Stack gap={4} class="mt-4">
|
||||||
{#if data.isActivated === false}
|
{#if data.isActivated === false}
|
||||||
<div
|
<Alert icon={mdiAlertCircleOutline} color="danger" title={$t('purchase_failed_activation')} />
|
||||||
class="bg-red-100 text-red-700 px-4 py-3 rounded-md flex place-items-center place-content-center gap-2"
|
|
||||||
role="alert"
|
|
||||||
>
|
|
||||||
<Icon path={mdiAlertCircleOutline} size="18" />
|
|
||||||
<p>{$t('purchase_failed_activation')}</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if $isPurchased}
|
{#if $isPurchased}
|
||||||
@ -46,6 +40,6 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</Stack>
|
||||||
</section>
|
</Container>
|
||||||
</UserPageLayout>
|
</UserPageLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user