ShareChatModal.svelte 2.48 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
<script lang="ts">
2
	import { getContext } from 'svelte';
Timothy J. Baek's avatar
Timothy J. Baek committed
3
	import Modal from '../common/Modal.svelte';
4
	import Link from '../icons/Link.svelte';
Timothy J. Baek's avatar
Timothy J. Baek committed
5

6
7
	const i18n = getContext('i18n');

Timothy J. Baek's avatar
Timothy J. Baek committed
8
9
	export let downloadChat: Function;
	export let shareChat: Function;
10
	export let shareLocalChat: Function;
Timothy J. Baek's avatar
Timothy J. Baek committed
11
12
13
14

	export let show = false;
</script>

15
16
17
18
<Modal bind:show size="sm">
	<div>
		<div class=" flex justify-between dark:text-gray-300 px-5 py-4">
			<div class=" text-lg font-medium self-center">{$i18n.t('Share Chat')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
19
			<button
20
				class="self-center"
Timothy J. Baek's avatar
Timothy J. Baek committed
21
22
23
24
				on:click={() => {
					show = false;
				}}
			>
25
26
27
28
29
30
31
32
33
34
				<svg
					xmlns="http://www.w3.org/2000/svg"
					viewBox="0 0 20 20"
					fill="currentColor"
					class="w-5 h-5"
				>
					<path
						d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
					/>
				</svg>
Timothy J. Baek's avatar
Timothy J. Baek committed
35
36
			</button>
		</div>
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
		<hr class=" dark:border-gray-800" />

		<div class="px-4 pt-4 pb-5 w-full flex flex-col justify-center">
			<div class=" text-sm dark:text-gray-300 mb-1">
				Messages you send after creating your link won't be shared. Anyone with the URL will be able
				to view the shared chat.
			</div>

			<div class="flex justify-end">
				<div class="flex flex-col items-end space-x-1 mt-1.5">
					<div class="flex gap-1">
						<button
							class=" self-center px-3.5 py-2 rounded-xl text-sm font-medium bg-gray-100 hover:bg-gray-200 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-white"
							type="button"
							on:click={() => {
								shareChat();
								show = false;
							}}
						>
							{$i18n.t('Share to OpenWebUI Community')}
						</button>

						<button
							class=" self-center flex items-center gap-1 px-3.5 py-2 rounded-xl text-sm font-medium bg-emerald-600 hover:bg-emerald-500 text-white"
							type="button"
							on:click={() => {
								shareLocalChat();
								show = false;
							}}
						>
							<Link />
							{$i18n.t('Copy Link')}
						</button>
					</div>
					<div class="flex gap-1 mt-1.5">
						<div class=" self-center text-gray-400 text-xs font-medium">{$i18n.t('or')}</div>
						<button
							class=" text-right rounded-full text-xs font-medium text-gray-700 dark:text-gray-500 underline"
							type="button"
							on:click={() => {
								downloadChat();
								show = false;
							}}
						>
							{$i18n.t('Download as a File')}
						</button>
					</div>
				</div>
			</div>
		</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
87
88
	</div>
</Modal>