Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

Flowbite chat #820

Merged
merged 36 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b8c466a
init
andrewrisse Jul 18, 2024
c9af3c4
remove carbon sass preprocessing
andrewrisse Jul 18, 2024
f47d0ee
add navbar with drawer links, needs styling
andrewrisse Jul 18, 2024
760ff2f
finished navbar
andrewrisse Jul 18, 2024
52d9636
update header test
andrewrisse Jul 18, 2024
c65d791
Add sidebar with edit and delete
andrewrisse Jul 18, 2024
7506131
fix sidebar menu btn
andrewrisse Jul 19, 2024
480ac2a
merge main
andrewrisse Jul 19, 2024
c26748d
update sidebar tests
andrewrisse Jul 19, 2024
abe58d9
all unit tests passing
andrewrisse Jul 19, 2024
c9a3f9e
playwright in progress
andrewrisse Jul 19, 2024
4ff9120
add sidebar menu open/close btn
andrewrisse Jul 22, 2024
9be9b07
Merge branch 'main' into flowbite
andrewrisse Jul 22, 2024
b077e1a
rename sidebar.svelte
andrewrisse Jul 22, 2024
b24e1d3
add select assistant dropdown
andrewrisse Jul 22, 2024
e7d9dc4
add dynamic height textarea
andrewrisse Jul 22, 2024
925459e
fix unit tests
andrewrisse Jul 22, 2024
b4f02f4
message wip
andrewrisse Jul 22, 2024
7e96757
fix message styling
andrewrisse Jul 23, 2024
80da249
finish styling for chat page
andrewrisse Jul 23, 2024
40881c4
lint
andrewrisse Jul 23, 2024
1d03bca
Fix e2es
andrewrisse Jul 23, 2024
24c77c2
Fix e2es 2
andrewrisse Jul 23, 2024
de1255e
remove file attach btn
andrewrisse Jul 23, 2024
8bf0457
Remove unnecessary comment
andrewrisse Jul 23, 2024
0fffbfd
merge main
andrewrisse Jul 23, 2024
875fdee
Merge branch 'flowbite' into flowbite-chat
andrewrisse Jul 23, 2024
953200d
fix duplicate package
andrewrisse Jul 23, 2024
dc0dd5a
Merge branch 'flowbite' into flowbite-chat
andrewrisse Jul 23, 2024
302c601
fix styles due to carbon override
andrewrisse Jul 23, 2024
e6f4dd1
flaky e2e fix
andrewrisse Jul 23, 2024
a3fd40d
init
andrewrisse Jul 24, 2024
67f07a8
Merge branch 'fix-e2e-locally' into flowbite
andrewrisse Jul 24, 2024
d232655
merge main
andrewrisse Jul 25, 2024
a48c077
Merge branch 'flowbite' into flowbite-chat
andrewrisse Jul 25, 2024
4d4cfb2
merge flowbite-integration
andrewrisse Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/leapfrogai_ui/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,66 @@
@tailwind components;
@tailwind utilities;

:root {
--header-height: 3rem;
--message-input-height: 2.5rem;
}

/*TODO - can we get rid of some of these?*/
@layer utilities {
.lf-content {
display: flex;
flex-grow: 1;
padding: 2rem;
}
.no-scrollbar {
scrollbar-width: none;
}

.hide {
opacity: 0;
transition: opacity 0.2s;
}

.lf-content-container {
display: flex;
height: 100%;
flex-direction: column;
justify-content: space-between;
}

.centered-flexbox {
display: flex;
justify-content: center;
align-items: center;
}

.remove-btn-style {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
}

.link {
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 400;
letter-spacing: 0.16px;
text-decoration: none;
color: #78a9ff;
cursor: pointer;
}
}

@layer components {
.chat-icon {
width: 32px;
height: 52px;
padding: 14px 0.25rem;
color: white;
}
}
21 changes: 3 additions & 18 deletions src/leapfrogai_ui/src/lib/components/Citation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { browser } from '$app/environment';
import { toastStore } from '$stores';
import type { FileObject } from 'openai/resources/files';
import { ArrowUp } from 'carbon-icons-svelte';
import { ArrowUpOutline } from 'flowbite-svelte-icons';
export let file: FileObject;
export let index: string;

Expand Down Expand Up @@ -38,27 +38,12 @@
</script>

<button
class="centered-flexbox citation-container remove-btn-style"
class="flex items-center justify-center gap-1"
on:click={(e) => {
e.preventDefault();
handleClick();
}}
>
<span class="link">{`[${index}] ${file.filename}`}</span>
<ArrowUp class="link" color="#78a9ff" style="cursor: pointer;" />
<ArrowUpOutline class="link cursor-pointer" color="#78a9ff" />
</button>

<style lang="scss">
.citation-container {
gap: 0.25rem;
}
.link {
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 400;
letter-spacing: 0.16px;
text-decoration: none;
color: #78a9ff;
cursor: pointer;
}
</style>
10 changes: 10 additions & 0 deletions src/leapfrogai_ui/src/lib/components/HeaderButton.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
import { twMerge } from 'tailwind-merge';

export let btnClass =
'dark:text-gray-400 hover:bg-secondary-800 dark:hover:bg-secondary-300 dark:hover:text-white rounded-lg p-1 focus:outline-none focus:ring-4 focus:ring-primary-300 dark:focus:ring-primary-300 transition duration-100 ease-in-out';
</script>

<button type="button" {...$$restProps} class={twMerge(btnClass, $$props.class)} on:click>
<slot />
</button>
14 changes: 8 additions & 6 deletions src/leapfrogai_ui/src/lib/components/IconButton.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<button
type="button"
class="hover:bg-secondary-800 dark:hover:bg-secondary-300 rounded-lg p-1 focus:outline-none focus:ring-4 focus:ring-primary-300 dark:focus:ring-primary-300"
on:click
{...$$restProps}
>
<script lang="ts">
import { twMerge } from 'tailwind-merge';

export let btnClass =
'dark:text-gray-400 dark:hover:text-white rounded-lg p-1 transition duration-100 ease-in-out';
</script>

<button type="button" {...$$restProps} class={twMerge(btnClass, $$props.class)} on:click>
<slot />
</button>
14 changes: 7 additions & 7 deletions src/leapfrogai_ui/src/lib/components/LFHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logo from '$assets/LeapfrogAI.png';
import { Button, Drawer, Navbar, NavBrand } from 'flowbite-svelte';
import { BarsOutline, CloseOutline, CogOutline, UserCircleOutline } from 'flowbite-svelte-icons';
import IconButton from '$components/IconButton.svelte';
import HeaderButton from '$components/HeaderButton.svelte';
import { sineIn } from 'svelte/easing';

export let isUsingOpenAI: boolean;
Expand All @@ -29,7 +29,7 @@
else activeDrawer = name;
};

let drawerStyle = 'top-header';
let drawerStyle = 'top-header text-white';
let linkStyle = 'flex p-4 flex-col gap-3.5';
let headerLinkStyle =
'text-sm leading-5 font-semibold tracking-tight cursor-pointer bg-none text-inherit border-none p-0 outline-none hover:text-white';
Expand All @@ -39,7 +39,7 @@
<svelte:window bind:innerWidth />

<header>
<Navbar fluid class="h-header py-1">
<Navbar fluid class="h-header py-1 dark:bg-black">
<NavBrand
href={$threadsStore.lastVisitedThreadId
? `/chat/${$threadsStore.lastVisitedThreadId}`
Expand All @@ -65,13 +65,13 @@
<img src={logo} class="w-[7.875rem]] h-[2.25rem]" alt="LeapfrogAI Logo" />
</NavBrand>
<div class="flex items-center gap-x-2">
<IconButton on:click={() => toggleDrawer('settings')}>
<HeaderButton on:click={() => toggleDrawer('settings')}>
<CogOutline data-testid="header-settings-btn" />
</IconButton>
</HeaderButton>

<IconButton on:click={() => toggleDrawer('user')}>
<HeaderButton on:click={() => toggleDrawer('user')}>
<UserCircleOutline data-testid="header-user-btn" />
</IconButton>
</HeaderButton>
</div>
</Navbar>

Expand Down
5 changes: 2 additions & 3 deletions src/leapfrogai_ui/src/lib/components/LFSidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@
</script>

<!--Custom styling allows center SidebarGroup (chat threads) to scroll-->

<Sidebar class="w-full max-w-64" data-testid="sidebar">
<SidebarWrapper class=" flex h-full flex-col">
<Sidebar data-testid="sidebar" class="dark:bg-gray-800">
<SidebarWrapper class="flex h-full flex-col">
<SidebarGroup>
<div class="flex flex-col gap-2">
<Button on:click={() => threadsStore.changeThread('')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ It adds a "three-dot" menu button with Popover, and delete confirmation Modal
id={`btn-${threadId}`}
class={popperOpen && 'focus:rounded focus:bg-gray-400'}
>
<DotsVerticalOutline />
<DotsVerticalOutline color="white" />
</button>
<Popover
data-testid={'sidebar-popover'}
class="w-32 text-sm font-light"
class="w-32 border-none text-sm font-light"
defaultClass="p-0"
placement="right"
trigger="click"
Expand All @@ -141,10 +141,8 @@ It adds a "three-dot" menu button with Popover, and delete confirmation Modal
popperOpen = !popperOpen;
}}
><div class="flex flex-col items-center gap-1">
<Button color="alternative" size="xs" class="w-full" on:click={handleEditClick}>Edit</Button
>
<Button size="xs" class="w-full" on:click={handleEditClick}>Edit</Button>
<Button
color="alternative"
size="xs"
class="w-full"
on:click={(e) => {
Expand Down
Loading
Loading