refac: styling

This commit is contained in:
Timothy Jaeryang Baek 2025-02-03 20:06:17 -08:00
parent b61138e676
commit 2bf68593af
4 changed files with 52 additions and 30 deletions

View File

@ -398,7 +398,7 @@
dir={$settings?.chatDirection ?? 'LTR'} dir={$settings?.chatDirection ?? 'LTR'}
> >
{#if files.length > 0} {#if files.length > 0}
<div class="mx-1 mt-2.5 mb-1 flex flex-wrap gap-2"> <div class="mx-1 mt-2.5 flex flex-wrap gap-2">
{#each files as file, fileIdx} {#each files as file, fileIdx}
{#if file.type === 'image'} {#if file.type === 'image'}
<div class=" relative group"> <div class=" relative group">
@ -411,7 +411,7 @@
</div> </div>
<div class=" absolute -top-1 -right-1"> <div class=" absolute -top-1 -right-1">
<button <button
class=" bg-gray-400 text-white border border-white rounded-full group-hover:visible invisible transition" class=" bg-white text-black border border-white rounded-full group-hover:visible invisible transition"
type="button" type="button"
on:click={() => { on:click={() => {
files.splice(fileIdx, 1); files.splice(fileIdx, 1);
@ -453,7 +453,7 @@
</div> </div>
{/if} {/if}
<div class="px-3"> <div class="px-2.5">
<div <div
class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full pt-2.5 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto" class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full pt-2.5 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto"
> >

View File

@ -573,7 +573,7 @@
dir={$settings?.chatDirection ?? 'LTR'} dir={$settings?.chatDirection ?? 'LTR'}
> >
{#if files.length > 0} {#if files.length > 0}
<div class="mx-1 mt-2.5 mb-1 flex items-center flex-wrap gap-2"> <div class="mx-1 mt-2.5 flex items-center flex-wrap gap-2">
{#each files as file, fileIdx} {#each files as file, fileIdx}
{#if file.type === 'image'} {#if file.type === 'image'}
<div class=" relative group"> <div class=" relative group">
@ -611,7 +611,7 @@
</div> </div>
<div class=" absolute -top-1 -right-1"> <div class=" absolute -top-1 -right-1">
<button <button
class=" bg-gray-400 text-white border border-white rounded-full group-hover:visible invisible transition" class=" bg-white text-black border border-white rounded-full group-hover:visible invisible transition"
type="button" type="button"
on:click={() => { on:click={() => {
files.splice(fileIdx, 1); files.splice(fileIdx, 1);
@ -661,7 +661,7 @@
</div> </div>
{/if} {/if}
<div class="px-3"> <div class="px-2.5">
{#if $settings?.richTextInput ?? true} {#if $settings?.richTextInput ?? true}
<div <div
class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full pt-2.5 pb-1 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto" class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full pt-2.5 pb-1 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto"
@ -1062,11 +1062,9 @@
<div class=" flex justify-between"> <div class=" flex justify-between">
<div class="ml-1 self-end mb-1.5 gap-0.5 flex items-center"> <div class="ml-1 self-end mb-1.5 gap-0.5 flex items-center">
<InputMenu <InputMenu
bind:imageGenerationEnabled
bind:codeInterpreterEnabled
bind:webSearchEnabled
bind:selectedToolIds bind:selectedToolIds
{screenCaptureHandler} {screenCaptureHandler}
{inputFilesHandler}
uploadFilesHandler={() => { uploadFilesHandler={() => {
filesInputElement.click(); filesInputElement.click();
}} }}

View File

@ -21,12 +21,12 @@
export let screenCaptureHandler: Function; export let screenCaptureHandler: Function;
export let uploadFilesHandler: Function; export let uploadFilesHandler: Function;
export let inputFilesHandler: Function;
export let uploadGoogleDriveHandler: Function; export let uploadGoogleDriveHandler: Function;
export let selectedToolIds: string[] = []; export let selectedToolIds: string[] = [];
export let codeInterpreterEnabled: boolean;
export let onClose: Function; export let onClose: Function;
let tools = {}; let tools = {};
@ -53,8 +53,26 @@
return a; return a;
}, {}); }, {});
}; };
function handleFileChange(event) {
const inputFiles = Array.from(event.target?.files);
if (inputFiles && inputFiles.length > 0) {
console.log(inputFiles);
inputFilesHandler(inputFiles);
}
}
</script> </script>
<!-- Hidden file input used to open the camera on mobile -->
<input
id="camera-input"
type="file"
accept="image/*"
capture="environment"
on:change={handleFileChange}
style="display: none;"
/>
<Dropdown <Dropdown
bind:show bind:show
on:change={(e) => { on:change={(e) => {
@ -120,7 +138,6 @@
<hr class="border-black/5 dark:border-white/5 my-1" /> <hr class="border-black/5 dark:border-white/5 my-1" />
{/if} {/if}
{#if !$mobile}
<Tooltip <Tooltip
content={!fileUploadEnabled ? $i18n.t('You do not have permission to upload files') : ''} content={!fileUploadEnabled ? $i18n.t('You do not have permission to upload files') : ''}
className="w-full" className="w-full"
@ -131,7 +148,15 @@
: ''}" : ''}"
on:click={() => { on:click={() => {
if (fileUploadEnabled) { if (fileUploadEnabled) {
if (!$mobile) {
screenCaptureHandler(); screenCaptureHandler();
} else {
const cameraInputElement = document.getElementById('camera-input');
if (cameraInputElement) {
cameraInputElement.click();
}
}
} }
}} }}
> >
@ -139,7 +164,6 @@
<div class=" line-clamp-1">{$i18n.t('Capture')}</div> <div class=" line-clamp-1">{$i18n.t('Capture')}</div>
</DropdownMenu.Item> </DropdownMenu.Item>
</Tooltip> </Tooltip>
{/if}
<Tooltip <Tooltip
content={!fileUploadEnabled ? $i18n.t('You do not have permission to upload files') : ''} content={!fileUploadEnabled ? $i18n.t('You do not have permission to upload files') : ''}

View File

@ -119,7 +119,7 @@
{#if dismissible} {#if dismissible}
<div class=" absolute -top-1 -right-1"> <div class=" absolute -top-1 -right-1">
<button <button
class=" bg-gray-400 text-white border border-white rounded-full group-hover:visible invisible transition" class=" bg-white text-black border border-white rounded-full group-hover:visible invisible transition"
type="button" type="button"
on:click|stopPropagation={() => { on:click|stopPropagation={() => {
dispatch('dismiss'); dispatch('dismiss');