uniform favicons
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
30
front/src/lib/components/favicon-or-icon.svelte
Normal file
30
front/src/lib/components/favicon-or-icon.svelte
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { Database, Key, Mail } from "@lucide/svelte";
|
||||||
|
import { cn } from "../utils";
|
||||||
|
|
||||||
|
let { url, icon="", class: className = "" } = $props();
|
||||||
|
|
||||||
|
let hasError = $state(false);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class={cn(
|
||||||
|
"w-10 h-10 rounded-box bg-neutral text-neutral-content items-center justify-center flex",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{#if url && !hasError}
|
||||||
|
<img
|
||||||
|
src={"https://icons.duckduckgo.com/ip3/" + url + ".ico"}
|
||||||
|
class="rounded-box w-full h-full"
|
||||||
|
alt="Favicon de {url}"
|
||||||
|
onerror={() => { hasError = true }}
|
||||||
|
/>
|
||||||
|
{:else if icon == "password"}
|
||||||
|
<Key />
|
||||||
|
{:else if icon == "email"}
|
||||||
|
<Mail />
|
||||||
|
{:else}
|
||||||
|
<Database />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Dataleak } from "$src/lib/types";
|
import type { Dataleak } from "$src/lib/types";
|
||||||
import { Database, Replace, Search } from "@lucide/svelte";
|
import { Database, Replace, Search } from "@lucide/svelte";
|
||||||
|
import FaviconOrIcon from "../../favicon-or-icon.svelte";
|
||||||
|
|
||||||
let {
|
let {
|
||||||
dataleaks,
|
dataleaks,
|
||||||
@@ -89,23 +90,14 @@
|
|||||||
{#each paginatedDataleaks as item}
|
{#each paginatedDataleaks as item}
|
||||||
<tr class="hover:bg-base-300">
|
<tr class="hover:bg-base-300">
|
||||||
<th>
|
<th>
|
||||||
<div class="size-8">
|
<FaviconOrIcon
|
||||||
{#if getDomain(item.Name)}
|
url={getDomain(item.Name)}
|
||||||
<img
|
icon={item.Columns.includes("password")
|
||||||
src="https://icons.duckduckgo.com/ip3/{getDomain(
|
? "password"
|
||||||
item.Name,
|
: item.Columns.includes("email")
|
||||||
)}.ico"
|
? "email"
|
||||||
class="size-8 rounded-xl bg-neutral"
|
: ""}
|
||||||
alt="Favicon de {getDomain(item.Name)}"
|
/>
|
||||||
/>
|
|
||||||
{:else}
|
|
||||||
<div
|
|
||||||
class="size-8 rounded-xl bg-neutral items-center justify-center flex"
|
|
||||||
>
|
|
||||||
<Database class="text-neutral-content" />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
{item.Name}
|
{item.Name}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import FaviconOrIcon from "$src/lib/components/favicon-or-icon.svelte";
|
||||||
import Table from "$src/lib/components/table.svelte";
|
import Table from "$src/lib/components/table.svelte";
|
||||||
import { ChevronDown, ChevronUp, Database, Key, Mail } from "@lucide/svelte";
|
import { ChevronDown, ChevronUp, Database, Key, Mail } from "@lucide/svelte";
|
||||||
|
|
||||||
@@ -54,35 +55,16 @@
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
{#if getDomain(row["source"])}
|
<FaviconOrIcon
|
||||||
<img
|
url={row["source"] !== null ? getDomain(row["source"]) : ""}
|
||||||
src="https://icons.duckduckgo.com/ip3/{getDomain(row['source'])}.ico"
|
icon={row["password"] !== null
|
||||||
class="size-10 rounded-box bg-neutral"
|
? "password"
|
||||||
alt="Favicon de {getDomain(row['source'])}"
|
: row["email"] !== null
|
||||||
/>
|
? "email"
|
||||||
{:else if row["password"] !== null}
|
: ""}
|
||||||
<div
|
/>
|
||||||
class="size-10 rounded-box bg-neutral items-center justify-center flex"
|
|
||||||
>
|
|
||||||
<Key class="text-neutral-content" />
|
|
||||||
</div>
|
|
||||||
{:else if row["email"] !== null}
|
|
||||||
<div
|
|
||||||
class="size-10 rounded-box bg-neutral items-center justify-center flex"
|
|
||||||
>
|
|
||||||
<Mail class="text-neutral-content" />
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<div
|
|
||||||
class="size-10 rounded-box bg-neutral items-center justify-center flex"
|
|
||||||
>
|
|
||||||
<Database class="text-neutral-content" />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="flex-1 flex flex-col min-w-0 items-start justify-center">
|
||||||
class="flex-1 flex flex-col min-w-0 items-start justify-center"
|
|
||||||
>
|
|
||||||
<div class="w-full overflow-hidden whitespace-nowrap text-ellipsis">
|
<div class="w-full overflow-hidden whitespace-nowrap text-ellipsis">
|
||||||
{getHighlightedContent(row)}
|
{getHighlightedContent(row)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user