Skip to content

Commit

Permalink
yes
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhorner committed Sep 22, 2024
1 parent b4c6d37 commit 02f19f2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { onMount } from "svelte"
import { Button } from "../ui/button"
import { Input } from "../ui/input"
import RedactedText from "../RedactedText.svelte"
interface NotificationTarget {
id: number
Expand Down Expand Up @@ -55,7 +56,7 @@
<Table.Body>
{#each targets as target}
<Table.Row>
<Table.Cell class="font-mono">{target.appriseUrl}</Table.Cell>
<Table.Cell class="font-mono"><RedactedText text={target.appriseUrl} /></Table.Cell>
<Table.Cell class="text-right">
<Button on:click={() => deleteTarget(target.id)} variant="destructive" size="sm" title="Delete">
<FontAwesomeIcon icon={faTrash} />
Expand Down
25 changes: 25 additions & 0 deletions packages/frontend/src/lib/components/RedactedText.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script lang="ts">
import { FontAwesomeIcon } from "@fortawesome/svelte-fontawesome"
import Button from "./ui/button/button.svelte"
import { faEye, faEyeSlash } from "@fortawesome/free-solid-svg-icons"
export let text: string = "REDACTED"
function toggle() {
redacted = !redacted
}
let redacted = true
$: renderedText = redacted ? new Array(text.length).join("") : text
</script>

<span {...$$restProps}>
<Button size="sm" variant="ghost" on:click={toggle}>
{#if redacted}
<FontAwesomeIcon icon={faEye} />
{:else}
<FontAwesomeIcon icon={faEyeSlash} />
{/if}
</Button>
{renderedText}
</span>

0 comments on commit 02f19f2

Please sign in to comment.