feat: add ability to set default profile picture (#1061)

Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
Elias Schneider
2025-11-04 13:40:00 +01:00
committed by GitHub
parent e03270eb9d
commit ed2c7b2303
14 changed files with 320 additions and 81 deletions

View File

@@ -55,9 +55,13 @@
disabled,
isLoading = false,
autofocus = false,
onclick,
usePromiseLoading = false,
children,
...restProps
}: ButtonProps = $props();
}: ButtonProps & {
usePromiseLoading?: boolean;
} = $props();
onMount(async () => {
// Using autofocus can be bad for a11y, but in the case of Pocket ID is only used responsibly in places where there are not many choices, and on buttons only where there's descriptive text
@@ -66,6 +70,19 @@
setTimeout(() => ref?.focus(), 100);
}
});
async function handleOnClick(event: any) {
if (usePromiseLoading && onclick) {
isLoading = true;
try {
await onclick(event);
} finally {
isLoading = false;
}
} else {
onclick?.(event);
}
}
</script>
{#if href}
@@ -91,6 +108,7 @@
class={cn(buttonVariants({ variant, size }), className)}
{type}
disabled={disabled || isLoading}
onclick={handleOnClick}
{...restProps}
>
{#if isLoading}