enh: share rating to community

This commit is contained in:
Timothy J. Baek 2024-10-17 00:51:46 -07:00
parent 86adcf33b0
commit 4dcbf1af07
2 changed files with 21 additions and 6 deletions

View File

@ -2,6 +2,7 @@
import { toast } from 'svelte-sonner';
import { createEventDispatcher, onMount, getContext } from 'svelte';
import { config } from '$lib/stores';
const i18n = getContext('i18n');
@ -69,7 +70,7 @@
</script>
<div
class=" my-2.5 rounded-xl px-4 py-3 border dark:border-gray-850"
class=" my-2.5 rounded-xl px-4 py-3 border border-gray-50 dark:border-gray-850"
id="message-feedback-{message.id}"
>
<div class="flex justify-between items-center">
@ -97,7 +98,7 @@
<div class="flex flex-wrap gap-2 text-sm mt-2.5">
{#each reasons as reason}
<button
class="px-3.5 py-1 border dark:border-gray-850 hover:bg-gray-100 dark:hover:bg-gray-850 {selectedReason ===
class="px-3.5 py-1 border border-gray-50 dark:border-gray-850 hover:bg-gray-100 dark:hover:bg-gray-850 {selectedReason ===
reason
? 'bg-gray-200 dark:bg-gray-800'
: ''} transition rounded-lg"
@ -120,9 +121,21 @@
/>
</div>
<div class="mt-2 flex justify-end">
<div class="mt-2 gap-1.5 flex justify-end">
{#if $config?.features.enable_community_sharing}
<button
class=" self-center px-3.5 py-2 rounded-xl text-sm font-medium bg-gray-50 hover:bg-gray-100 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-white transition"
type="button"
on:click={() => {
show = false;
}}
>
{$i18n.t('Share to OpenWebUI Community')}
</button>
{/if}
<button
class=" bg-emerald-700 text-white text-sm font-medium rounded-lg px-3.5 py-1.5"
class=" bg-emerald-700 hover:bg-emerald-800 transition text-white text-sm font-medium rounded-xl px-3.5 py-1.5"
on:click={() => {
saveHandler();
}}

View File

@ -188,14 +188,14 @@
});
if (res) {
toast.success('Folder deleted successfully');
toast.success($i18n.t('Folder deleted successfully'));
dispatch('update');
}
};
const nameUpdateHandler = async () => {
if (name === '') {
toast.error("Folder name can't be empty");
toast.error($i18n.t('Folder name cannot be empty'));
return;
}
@ -218,6 +218,8 @@
if (res) {
folders[folderId].name = name;
toast.success($i18n.t('Folder name updated successfully'));
dispatch('update');
}
};