[card] allow generating both modes (just not at once)

This commit is contained in:
Andrea Vos 2021-10-29 22:57:22 +02:00
parent 8dde2215d5
commit 000587bc8d
2 changed files with 21 additions and 13 deletions

View File

@ -37,7 +37,6 @@
<T>profile.card.link</T>: <T>profile.card.link</T>:
</small> </small>
<small v-if="profile.card === null && profile.cardDark === null"> <small v-if="profile.card === null && profile.cardDark === null">
(<T>profile.card.generate</T>)
<button class="btn btn-outline-success btn-sm" @click="generateCard(false)"> <button class="btn btn-outline-success btn-sm" @click="generateCard(false)">
<Icon v="sun"/> <Icon v="sun"/>
<T>mode.light</T> <T>mode.light</T>
@ -51,16 +50,25 @@
<Spinner/> <Spinner/>
<T>profile.card.generating</T> <T>profile.card.generating</T>
</small> </small>
<a v-if="profile.card" :href="profile.card" target="_blank" rel="noopener" <span v-else>
class="btn btn-outline-success btn-sm mx-1"> <a v-if="profile.card" :href="profile.card" target="_blank" rel="noopener"
<Icon v="sun"/> class="btn btn-outline-success btn-sm mx-1">
<T>mode.light</T> <Icon v="sun"/>
</a> <T>mode.light</T>
<a v-if="profile.cardDark" :href="profile.cardDark" target="_blank" rel="noopener" </a>
class="btn btn-outline-success btn-sm mx-1"> <a v-if="profile.cardDark" :href="profile.cardDark" target="_blank" rel="noopener"
<Icon v="moon"/> class="btn btn-outline-success btn-sm mx-1">
<T>mode.dark</T> <Icon v="moon"/>
</a> <T>mode.dark</T>
</a>
<button v-if="!profile.card" class="btn btn-outline-success btn-sm" @click="generateCard(false)">
<Icon v="sun"/>
</button>
<button v-if="!profile.cardDark" class="btn btn-outline-success btn-sm" @click="generateCard(true)">
<Icon v="moon"/>
</button>
</span>
</div> </div>
</div> </div>
</Profile> </Profile>
@ -170,7 +178,7 @@
async checkForCard() { async checkForCard() {
try { try {
const card = await this.$axios.$get(`/profile/has-card`); const card = await this.$axios.$get(`/profile/has-card`);
if (card.card || card.cardDark) { if (card.card !== '' && card.cardDark !== '') {
this.profile.card = card.card; this.profile.card = card.card;
this.profile.cardDark = card.cardDark; this.profile.cardDark = card.cardDark;
clearInterval(this.cardCheckHandle); clearInterval(this.cardCheckHandle);

View File

@ -26,7 +26,7 @@ const isSpam = (email) => {
|| email.length > 128; || email.length > 128;
} }
const replaceExtension = username => username.replace(/\.(txt|jpg|jpeg|png|pdf|gif|doc|docx|csv)$/i, '_$1'); const replaceExtension = username => username.replace(/\.(txt|jpg|jpeg|png|pdf|gif|doc|docx|csv|js|css)$/i, '_$1');
const saveAuthenticator = async (db, type, user, payload, validForMinutes = null) => { const saveAuthenticator = async (db, type, user, payload, validForMinutes = null) => {
const id = ulid(); const id = ulid();