-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from iceljc/features/refine-chat-window
Features/refine chat window
- Loading branch information
Showing
13 changed files
with
166 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<script> | ||
import { range, durationUnitRegex } from "$lib/helpers/utils/common"; | ||
/** @type {string} */ | ||
export let color = '#FF3E00'; | ||
/** @type {string} */ | ||
export let unit = 'px'; | ||
/** @type {string} */ | ||
export let duration = '1.2s'; | ||
/** @type {string | number} */ | ||
export let size = '60'; | ||
/** @type {boolean} */ | ||
export let pause = false; | ||
/** @type {string | number} */ | ||
export let gap = '5'; | ||
/** @type {string} */ | ||
export let containerClasses = ''; | ||
/** @type {string} */ | ||
export let containerStyles = ''; | ||
/** @type {string} */ | ||
let durationUnit = duration.match(durationUnitRegex)?.[0] ?? 's'; | ||
/** @type {string} */ | ||
let durationNum = duration.replace(durationUnitRegex, ''); | ||
</script> | ||
<div class={`stretch-wrapper ${containerClasses}`} style={`--size: ${size}${unit}; --color: ${color}; --duration: ${duration}; --gap: ${gap}${unit}; ${containerStyles}`}> | ||
{#each range(5, 1) as version} | ||
<div | ||
class="rect" | ||
class:pause-animation={pause} | ||
style="animation-delay: {(version - 1) * (+durationNum / 12)}{durationUnit}" | ||
/> | ||
{/each} | ||
</div> | ||
<style> | ||
.stretch-wrapper { | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: fit-content; | ||
height: calc(var(--size)); | ||
gap: var(--gap); | ||
margin-top: calc(var(--size) * 3); | ||
margin-bottom: calc(var(--size) * 3); | ||
} | ||
.rect { | ||
width: calc(var(--size) / 1.2); | ||
height: calc(var(--size) * 5); | ||
display: inline-block; | ||
transform: scaleY(0.2); | ||
background-color: var(--color); | ||
animation: stretch var(--duration) ease-in-out infinite; | ||
} | ||
.pause-animation { | ||
animation-play-state: paused; | ||
} | ||
@keyframes stretch { | ||
0%, | ||
40%, | ||
100% { | ||
transform: scaleY(0.3); | ||
} | ||
20% { | ||
transform: scaleY(1); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/routes/page/conversation/[conversationId]/conv-dialog-element.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script> | ||
import Markdown from '$lib/common/Markdown.svelte'; | ||
import { Button } from '@sveltestrap/sveltestrap'; | ||
/** @type {import('$types').ChatResponseModel} */ | ||
export let dialog; | ||
let is_collapsed = true; | ||
/** @param {any} e */ | ||
function toggleText(e) { | ||
e.preventDefault(); | ||
is_collapsed = !is_collapsed; | ||
} | ||
</script> | ||
|
||
<div | ||
class="fw-bold" | ||
class:text-collapse={!!is_collapsed} | ||
> | ||
<Markdown | ||
containerClasses={'text-primary'} | ||
text={dialog?.rich_content?.message?.text || dialog?.text} | ||
/> | ||
</div> | ||
|
||
<Button | ||
class='toggle-btn btn-sm text-secondary' | ||
color="link" | ||
style={'padding-left: 0px;'} | ||
on:click={(e) => toggleText(e)} | ||
> | ||
{`${is_collapsed ? 'More +' : 'Less -'}`} | ||
</Button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters