Update icon on homepage
parent
a3259bbefa
commit
d362944889
|
@ -12,6 +12,7 @@
|
|||
class="flex justify-end items-center self-end lg:self-start text-white mt-4
|
||||
bg-background-secondary rounded-xl py-2 px-4 hover:bg-background transition-colors duration-100"
|
||||
>
|
||||
<img src="/images/achievement.png" alt="wish" class="mr-2 h-6 w-6" />
|
||||
{$t('home.achievement.detail')}
|
||||
<Icon path={mdiChevronRight} />
|
||||
</a>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
class="flex justify-end items-center self-end lg:self-start text-white mt-4
|
||||
bg-background-secondary rounded-xl py-2 px-4 hover:bg-background transition-colors duration-100"
|
||||
>
|
||||
<img src="/images/furnishing.png" alt="wish" class="mr-2 h-6 w-6" />
|
||||
{$t('home.furnishing.detail')}
|
||||
<Icon path={mdiChevronRight} />
|
||||
</a>
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
<script>
|
||||
import { createEventDispatcher, onMount, tick } from 'svelte';
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { t } from 'svelte-i18n';
|
||||
|
||||
const numberFormat = Intl.NumberFormat('en', {
|
||||
maximumFractionDigits: 1,
|
||||
minimumFractionDigits: 0,
|
||||
});
|
||||
// const numberFormat = Intl.NumberFormat('en', {
|
||||
// maximumFractionDigits: 1,
|
||||
// minimumFractionDigits: 0,
|
||||
// });
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let count = '...';
|
||||
// let count = '...';
|
||||
|
||||
async function getData() {
|
||||
const url = new URL(`${__paimon.env.API_HOST}/visitor`);
|
||||
// async function getData() {
|
||||
// const url = new URL(`${__paimon.env.API_HOST}/visitor`);
|
||||
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
// try {
|
||||
// const res = await fetch(url, {
|
||||
// method: 'GET',
|
||||
// headers: { 'Content-Type': 'application/json' },
|
||||
// });
|
||||
|
||||
const data = await res.json();
|
||||
count = `${numberFormat.format(data.count / 1000)}k`;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
// const data = await res.json();
|
||||
// count = `${numberFormat.format(data.count / 1000)}k`;
|
||||
// } catch (err) {
|
||||
// console.error(err);
|
||||
// }
|
||||
// }
|
||||
|
||||
onMount(async () => {
|
||||
getData();
|
||||
await tick();
|
||||
// getData();
|
||||
// await tick();
|
||||
dispatch('done');
|
||||
});
|
||||
</script>
|
||||
|
@ -37,5 +37,5 @@
|
|||
<div class="bg-item rounded-xl p-4">
|
||||
<p class="text-white font-bold font-display text-xl">{$t('home.welcome')}</p>
|
||||
<p class="text-white mt-2">{$t('home.message')}</p>
|
||||
<p class="text-gray-400 mt-2">{$t('home.visitor', { values: { count } })}</p>
|
||||
<!-- <p class="text-gray-400 mt-2">{$t('home.visitor', { values: { count } })}</p> -->
|
||||
</div>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Loading…
Reference in New Issue