Skip to content

Commit

Permalink
companion almost
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl committed Jul 31, 2024
1 parent 353661a commit eff7c10
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/SessionMessages/MessageFiles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChatContext } from '@/ChatContext';
import { ConversationFile } from '@/types';
import { cn } from 'reablocks';
import { FC, PropsWithChildren, ReactNode, useContext } from 'react';
import { FC, PropsWithChildren, useContext } from 'react';
import { MessageFile } from './MessageFile';
import { Slot } from '@radix-ui/react-slot';

Expand Down
2 changes: 1 addition & 1 deletion src/SessionMessages/MessageQuestion.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChatContext } from '@/ChatContext';
import { Slot } from '@radix-ui/react-slot';
import { cn } from 'reablocks';
import { FC, PropsWithChildren, ReactNode, useContext } from 'react';
import { FC, PropsWithChildren, useContext } from 'react';
import { Markdown } from '@/Markdown';
import { PluggableList } from 'react-markdown/lib';
import remarkGfm from 'remark-gfm';
Expand Down
2 changes: 1 addition & 1 deletion src/SessionMessages/SessionMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const messageVariants = {
opacity: 1,
y: 0,
transition: {
duration: 0.4
duration: 0.3
}
}
};
Expand Down
14 changes: 12 additions & 2 deletions src/SessionMessages/SessionMessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FC, PropsWithChildren, useContext } from 'react';
import { Button, cn } from 'reablocks';
import { ChatContext } from '@/ChatContext';
import { motion } from 'framer-motion';
import BackIcon from '@/assets/back.svg?react';

export const SessionMessagePanel: FC<PropsWithChildren> = ({ children }) => {
const { activeSessionId, theme, isCompact, selectSession } =
Expand All @@ -12,7 +13,15 @@ export const SessionMessagePanel: FC<PropsWithChildren> = ({ children }) => {
(!isCompact || isVisible) && (
<motion.div
initial={{ translateX: '200%' }}
animate={{ translateX: '0%' }}
animate={{
translateX: '0%',
transition: {
type: 'tween',
ease: 'linear',
duration: 0.2,
when: 'beforeChildren'
}
}}
exit={{ translateX: '200%' }}
className={cn(theme.messages.base, {
[theme.messages.companion]: isCompact,
Expand All @@ -27,7 +36,8 @@ export const SessionMessagePanel: FC<PropsWithChildren> = ({ children }) => {
onClick={() => selectSession(null)}
className={cn(theme.messages.back)}
>
Back
<BackIcon />
Back
</Button>
)}
{children}
Expand Down
3 changes: 2 additions & 1 deletion src/SessionMessages/SessionMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const containerVariants = {
hidden: {},
visible: {
transition: {
staggerChildren: 0.07
staggerChildren: 0.07,
when: 'beforeChildren'
}
}
};
Expand Down
10 changes: 9 additions & 1 deletion src/SessionsList/SessionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ export const SessionsList: FC<PropsWithChildren> = ({ children }) => {
(!isCompact || isVisible) && (
<motion.div
initial={{ translateX: '-100%' }}
animate={{ translateX: '0%' }}
animate={{
translateX: '0%',
transition: {
type: 'tween',
ease: 'linear',
duration: 0.2,
when: 'beforeChildren'
}
}}
exit={{ translateX: '-100%' }}
className={cn(theme.sessions.base, {
[theme.sessions.companion]: isCompact,
Expand Down
1 change: 1 addition & 0 deletions src/assets/back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/assets/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions stories/Demos.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ export const Companion = () => {
return (
<div
style={{
border: '1px solid blue',
width: 350,
height: 500,
padding: 16
padding: 20,
background: '#02020F',
borderRadius: 5
}}
>
<Chat
Expand Down

0 comments on commit eff7c10

Please sign in to comment.