refactor move home / into vue components (#3498)

This commit is contained in:
dni ⚡
2025-11-10 14:48:27 +01:00
committed by GitHub
parent c9270bbf7f
commit bd50a3c546
16 changed files with 491 additions and 740 deletions
+178
View File
@@ -0,0 +1,178 @@
<template id="page-home">
<div
class="home row justify-center items-center"
style="min-height: calc(100vh / 1.618)"
>
<div
class="full-width"
:style="`max-width: ${hasCustomImage ? '850' : '600'}px`"
>
<div class="row q-mb-md">
<div class="col-12">
<div v-if="showHomepageElements">
<h5 v-text="siteTitle" class="q-my-none"></h5>
<template v-if="$q.screen.gt.sm">
<h6 class="q-my-sm" v-text="siteTagline"></h6>
<p class="q-my-sm" v-html="formatDescription"></p>
</template>
</div>
</div>
</div>
<div class="row">
<q-badge
v-if="isAccessTokenExpired"
class="q-mx-auto q-mb-md"
color="primary"
rounded
>
<div class="text-h6">
<span v-text="$t('session_has_expired')"></span>
</div>
</q-badge>
<q-card bordered class="full-width q-py-md">
<div class="row">
<div
class="col-12"
:class="{'col-sm-7': hasCustomImage, 'col-lg-6': hasCustomImage}"
>
<div v-if="showClaimLnurl" class="full-height content-center">
<q-card-section>
<div class="text-body1">
<span v-text="$t('claim_desc')"></span>
</div>
</q-card-section>
<q-card-section>
<q-btn
unelevated
color="primary"
@click="processing"
type="a"
:href="'/lnurlwallet?lightning=' + lnurl"
v-text="$t('press_to_claim')"
class="full-width"
></q-btn>
</q-card-section>
</div>
<div v-else class="full-height content-center">
<username-password
v-if="authMethod != 'user-id-only'"
:allowed_new_users="allowRegister"
:auth-methods="LNBITS_AUTH_METHODS"
:auth-action="authAction"
v-model:user-name="username"
v-model:password_1="password"
v-model:password_2="passwordRepeat"
v-model:reset-key="reset_key"
@login="login"
@register="register"
@reset="reset"
>
<div
class="text-center text-grey-6"
v-if="authAction !== 'reset'"
>
<p
v-if="authAction === 'login' && allowRegister"
class="q-mb-none"
>
Not registered?
<a
href="#"
class="text-secondary cursor-pointer"
@click.prevent="showRegister('username-password')"
>Create an Account</a
>
</p>
<p
v-else-if="authAction === 'login' && !allowRegister"
class="q-mb-none"
>
<span v-text="$t('new_user_not_allowed')"></span>
</p>
<p v-else-if="authAction === 'register'" class="q-mb-none">
<span v-text="$t('existing_account_question')"></span>
<a
href="#"
class="text-secondary cursor-pointer q-ml-sm"
@click.prevent="showLogin('username-password')"
v-text="$t('login')"
></a>
</p>
</div>
</username-password>
<user-id-only
v-if="authMethod == 'user-id-only'"
:allowed_new_users="allowRegister"
v-model:usr="usr"
v-model:wallet="walletName"
:auth-action="authAction"
:auth-method="authMethod"
@show-login="showLogin"
@show-register="showRegister"
@login-usr="loginUsr"
@create-wallet="createWallet"
>
</user-id-only>
</div>
</div>
<div v-if="hasCustomImage" class="col-sm-5 col-lg-6 gt-xs">
<div class="full-height flex flex-center q-pa-lg">
<q-img :src="hasCustomImage" :ratio="1" width="250px"></q-img>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div v-if="lnbitsBannerEnabled" class="full-width q-mb-lg q-mt-sm">
<div class="flex flex-center q-gutter-md q-py-md">
<q-btn
outline
color="grey"
type="a"
href="https://github.com/lnbits/lnbits"
target="_blank"
rel="noopener noreferrer"
:label="$t('view_github')"
></q-btn>
<q-btn
outline
color="grey"
type="a"
href="https://demo.lnbits.com/lnurlp/link/fH59GD"
target="_blank"
rel="noopener noreferrer"
:label="$t('donate')"
></q-btn>
</div>
</div>
<div v-if="adsEnabled" class="q-pt-md full-width">
<div class="row justify-center q-mb-xl">
<div class="full-width text-center">
<span v-text="adsTitle" class="text-uppercase text-grey"></span>
</div>
<div class="flex flex-center columm">
<div v-for="ad in ads" class="flex flex-center column q-pr-sm">
<a :href="ad[0]">
<img
v-if="$q.dark.isActive"
:src="ad[1]"
style="max-width: 420px"
class="full-width"
/>
<img
v-else
:src="ad[2]"
style="max-width: 420px"
class="full-width"
/>
</a>
</div>
</div>
</div>
</div>
<lnbits-home-logos />
</div>
</template>