ProfileImage.svelte 501 Bytes
Newer Older
1
<script lang="ts">
2
	import { settings } from '$lib/stores';
Timothy J. Baek's avatar
Timothy J. Baek committed
3
	import { WEBUI_BASE_URL } from '$lib/constants';
Timothy J. Baek's avatar
Timothy J. Baek committed
4

5
6
7
	export let src = '/user.png';
</script>

Timothy J. Baek's avatar
Timothy J. Baek committed
8
<div class={($settings?.chatDirection ?? 'LTR') === 'LTR' ? 'mr-3' : 'ml-3'}>
Timothy J. Baek's avatar
Timothy J. Baek committed
9
10
	<img
		crossorigin="anonymous"
Timothy J. Baek's avatar
Timothy J. Baek committed
11
12
13
14
15
		src={src.startsWith(WEBUI_BASE_URL) ||
		src.startsWith('https://www.gravatar.com/avatar/') ||
		src.startsWith('data:')
			? src
			: `/user.png`}
Timothy J. Baek's avatar
Timothy J. Baek committed
16
17
18
19
		class=" w-8 object-cover rounded-full"
		alt="profile"
		draggable="false"
	/>
20
</div>