mirror of
https://github.com/trailbaseio/trailbase
synced 2026-04-21 13:37:44 +00:00
Load *.wasm components via symlinks. Fixes blog example's auth UI.
Minor: also fix avatar fallback in blog example.
This commit is contained in:
parent
4f6b305497
commit
4dc6ce0b90
2 changed files with 21 additions and 26 deletions
|
|
@ -424,14 +424,13 @@ pub fn find_wasm_components(components_path: impl AsRef<std::path::Path>) -> Vec
|
|||
return None;
|
||||
};
|
||||
|
||||
if !metadata.is_file() {
|
||||
return None;
|
||||
if metadata.is_file() || metadata.is_symlink() {
|
||||
let path = entry.path();
|
||||
if path.extension()? == "wasm" {
|
||||
return Some(path);
|
||||
}
|
||||
}
|
||||
|
||||
let path = entry.path();
|
||||
if path.extension()? == "wasm" {
|
||||
return Some(path);
|
||||
}
|
||||
return None;
|
||||
})
|
||||
.collect();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Match, Suspense, Switch } from "solid-js";
|
||||
import { Match, Switch } from "solid-js";
|
||||
import { useStore } from "@nanostores/solid";
|
||||
import { TbOutlineUser } from "solid-icons/tb";
|
||||
import { TbFillUser } from "solid-icons/tb";
|
||||
import type { User } from "trailbase";
|
||||
|
||||
import { $client, $user, removeTokens, HOST } from "@/lib/client";
|
||||
|
|
@ -17,26 +17,22 @@ function UserBadge(props: { user: User | undefined }) {
|
|||
return undefined;
|
||||
};
|
||||
|
||||
const Fallback = () => (
|
||||
<TbOutlineUser class="inline-block size-6 rounded-full bg-pacamara-secondary p-1 dark:text-white" />
|
||||
);
|
||||
|
||||
return (
|
||||
<Suspense fallback={<p>...</p>}>
|
||||
<div class="flex items-center gap-2">
|
||||
<Switch fallback={<Fallback />}>
|
||||
<Match when={avatar()}>
|
||||
<img
|
||||
class="inline-block size-6 rounded-full"
|
||||
src={avatar()!}
|
||||
alt="avatar"
|
||||
/>
|
||||
</Match>
|
||||
</Switch>
|
||||
<div class="flex items-center gap-2">
|
||||
<object
|
||||
class="inline-block size-6 rounded-full hover:bg-gray-200"
|
||||
type="image/png"
|
||||
data={avatar()}
|
||||
aria-label="Avatar image"
|
||||
>
|
||||
{/* Fallback */}
|
||||
<div class="size-6 flex items-center justify-center">
|
||||
<TbFillUser size={18} color="#0073aa" />
|
||||
</div>
|
||||
</object>
|
||||
|
||||
<span>{profile()?.profile?.username ?? props.user?.email}</span>
|
||||
</div>
|
||||
</Suspense>
|
||||
<span>{profile()?.profile?.username ?? props.user?.email}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue