refactor code

This commit is contained in:
MuslemRahimi 2024-11-11 18:02:57 +01:00
parent 34e38644fc
commit 9fda78a077
3 changed files with 27 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,4 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://useast-pb.stocknear.com/_/
HostUrl=https://useast-pb.stocknear.com/api/files/_pb_users_auth_/9ncz4wunmhk0k52/profile_icon_kof6ixwefd4c1_n9a6Ljm6rj.webp?token=

View File

@ -1,10 +1,10 @@
<script lang="ts"> <script lang="ts">
import { getImageURL, formatDate } from "$lib/utils"; import { formatDate } from "$lib/utils";
import ArrowLogo from "lucide-svelte/icons/move-up-right"; import ArrowLogo from "lucide-svelte/icons/move-up-right";
import { goto } from "$app/navigation"; import avatar from "$lib/images/visual_mod.webp";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { numberOfUnreadNotification } from "$lib/store"; import { numberOfUnreadNotification } from "$lib/store";
import defaultAvatar from "$lib/images/default_avatar.png";
export let data; export let data;
export let form; export let form;
@ -112,6 +112,7 @@
{#if notificationList?.length !== 0} {#if notificationList?.length !== 0}
<div class="flex flex-col items-start w-full text-white"> <div class="flex flex-col items-start w-full text-white">
{#each notificationList as item} {#each notificationList as item}
{#if item?.notifyType === "priceAlert"}
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div <div
class="sm:hover:bg-[#2B2B2B] pb-3 sm:p-3 mb-6 sm:mb-3 text-gray-200 w-full {!item?.readed class="sm:hover:bg-[#2B2B2B] pb-3 sm:p-3 mb-6 sm:mb-3 text-gray-200 w-full {!item?.readed
@ -120,25 +121,16 @@
> >
<div class="flex flex-row items-center w-full"> <div class="flex flex-row items-center w-full">
<!-- svelte-ignore a11y-label-has-associated-control --> <!-- svelte-ignore a11y-label-has-associated-control -->
<a <a class="avatar w-11 h-11 flex-shrink-0 mr-4">
class="avatar w-11 h-11 flex-shrink-0 cursor-pointer mr-4"
>
<img <img
style="clip-path: circle(50%);" style="clip-path: circle(50%);"
class="flex-shrink-0 w-11 h-11 rounded-full inline-block" class="flex-shrink-0 w-11 h-11 rounded-full inline-block"
src={item?.expand?.user?.avatar src={avatar}
? getImageURL(
item?.expand?.user?.collectionId,
item?.expand?.user?.id,
item?.expand?.user?.avatar,
)
: defaultAvatar}
alt="User avatar" alt="User avatar"
/> />
</a> </a>
<div class="text-white text-sm sm:text-[1rem]"> <div class="text-white text-sm sm:text-[1rem]">
{#if item?.notifyType === "priceAlert"}
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-label-has-associated-control --> <!-- svelte-ignore a11y-label-has-associated-control -->
<div class="flex flex-col items-start"> <div class="flex flex-col items-start">
@ -168,19 +160,10 @@
>{formatDate(item?.created)} ago</span >{formatDate(item?.created)} ago</span
> >
</div> </div>
</div>
</div>
</div>
{/if} {/if}
</div>
<!--
{#if item?.expand?.post?.thumbnail}
<img
src="{getImageURL(item?.expand?.post?.collectionId, item?.expand?.post?.id, item?.expand?.post?.thumbnail)}"
class="w-24 sm:w-20 max-h-[50px] rounded-md inline-block"
alt="post thumbnail"
/>
{/if}
-->
</div>
</div>
{/each} {/each}
</div> </div>
{:else} {:else}