2024-07-08 23:55:12 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import { slide } from 'svelte/transition';
|
|
|
|
import Modal from '../common/Modal.svelte';
|
|
|
|
import Controls from './Controls/Controls.svelte';
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
|
|
|
export let show = false;
|
|
|
|
|
2024-07-09 02:26:31 +00:00
|
|
|
export let chatId = null;
|
|
|
|
export let params = {};
|
2024-07-08 23:55:12 +00:00
|
|
|
|
2024-07-09 02:26:31 +00:00
|
|
|
let largeScreen = false;
|
2024-07-08 23:55:12 +00:00
|
|
|
onMount(() => {
|
|
|
|
// listen to resize 1024px
|
|
|
|
const mediaQuery = window.matchMedia('(min-width: 1024px)');
|
|
|
|
|
|
|
|
const handleMediaQuery = (e) => {
|
|
|
|
if (e.matches) {
|
|
|
|
largeScreen = true;
|
|
|
|
} else {
|
|
|
|
largeScreen = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
mediaQuery.addEventListener('change', handleMediaQuery);
|
|
|
|
|
|
|
|
handleMediaQuery(mediaQuery);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
mediaQuery.removeEventListener('change', handleMediaQuery);
|
|
|
|
};
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if largeScreen}
|
2024-07-09 01:31:58 +00:00
|
|
|
{#if show}
|
|
|
|
<div class=" absolute bottom-0 right-0 z-20 h-full pointer-events-none">
|
|
|
|
<div class="pr-4 pt-14 pb-8 w-[24rem] h-full" in:slide={{ duration: 200, axis: 'x' }}>
|
|
|
|
<div
|
2024-07-09 07:26:02 +00:00
|
|
|
class="w-full h-full px-5 py-4 bg-white dark:shadow-lg dark:bg-gray-850 border border-gray-50 dark:border-gray-800 rounded-xl z-50 pointer-events-auto overflow-y-auto scrollbar-hidden"
|
2024-07-09 01:31:58 +00:00
|
|
|
>
|
|
|
|
<Controls
|
|
|
|
on:close={() => {
|
|
|
|
show = false;
|
|
|
|
}}
|
2024-07-09 02:26:31 +00:00
|
|
|
bind:params
|
2024-07-09 01:31:58 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2024-07-08 23:55:12 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-09 01:31:58 +00:00
|
|
|
{/if}
|
2024-07-08 23:55:12 +00:00
|
|
|
{:else}
|
|
|
|
<Modal bind:show>
|
2024-07-09 02:26:31 +00:00
|
|
|
<div class=" px-6 py-4 h-full">
|
2024-07-08 23:55:12 +00:00
|
|
|
<Controls
|
|
|
|
on:close={() => {
|
|
|
|
show = false;
|
|
|
|
}}
|
2024-07-09 02:26:31 +00:00
|
|
|
bind:params
|
2024-07-08 23:55:12 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Modal>
|
|
|
|
{/if}
|