From 57b0b48e3fe786e19223e2018d6d9b82b669ab55 Mon Sep 17 00:00:00 2001 From: amcdnl Date: Fri, 26 Jul 2024 09:02:39 -0400 Subject: [PATCH] reorganize --- src/{ => SessionMessages}/SessionEmpty.tsx | 2 +- src/{ => SessionMessages}/SessionMessage.tsx | 4 ++-- src/{ => SessionMessages}/SessionMessages.tsx | 2 +- src/SessionMessages/index.ts | 3 +++ src/Sessions.tsx | 3 --- src/{ => SessionsList}/NewSessionButton.tsx | 2 +- src/{ => SessionsList}/SessionGroups.tsx | 4 ++-- src/{ => SessionsList}/SessionListItem.tsx | 4 ++-- src/{ => SessionsList}/SessionsGroup.tsx | 2 +- src/{ => SessionsList}/SessionsList.tsx | 2 +- src/SessionsList/index.ts | 5 +++++ src/index.ts | 5 ----- stories/Demos.stories.tsx | 2 +- 13 files changed, 20 insertions(+), 20 deletions(-) rename src/{ => SessionMessages}/SessionEmpty.tsx (87%) rename src/{ => SessionMessages}/SessionMessage.tsx (97%) rename src/{ => SessionMessages}/SessionMessages.tsx (98%) create mode 100644 src/SessionMessages/index.ts rename src/{ => SessionsList}/NewSessionButton.tsx (93%) rename src/{ => SessionsList}/SessionGroups.tsx (76%) rename src/{ => SessionsList}/SessionListItem.tsx (94%) rename src/{ => SessionsList}/SessionsGroup.tsx (91%) rename src/{ => SessionsList}/SessionsList.tsx (84%) create mode 100644 src/SessionsList/index.ts diff --git a/src/SessionEmpty.tsx b/src/SessionMessages/SessionEmpty.tsx similarity index 87% rename from src/SessionEmpty.tsx rename to src/SessionMessages/SessionEmpty.tsx index 8132325..e6a50cf 100644 --- a/src/SessionEmpty.tsx +++ b/src/SessionMessages/SessionEmpty.tsx @@ -1,5 +1,5 @@ import { FC, ReactNode, useContext } from 'react'; -import { SessionsContext } from './SessionsContext'; +import { SessionsContext } from '@/SessionsContext'; import { cn } from 'reablocks'; interface SessionEmptyProps { diff --git a/src/SessionMessage.tsx b/src/SessionMessages/SessionMessage.tsx similarity index 97% rename from src/SessionMessage.tsx rename to src/SessionMessages/SessionMessage.tsx index 2867a6c..b8a6124 100644 --- a/src/SessionMessage.tsx +++ b/src/SessionMessages/SessionMessage.tsx @@ -1,5 +1,5 @@ import { FC, PropsWithChildren, ReactElement, useContext } from 'react'; -import { SessionsContext } from './SessionsContext'; +import { SessionsContext } from '@/SessionsContext'; import { IconButton, cn } from 'reablocks'; import remarkGfm from 'remark-gfm'; import CopyIcon from '@/assets/copy.svg?react'; @@ -7,7 +7,7 @@ import ThumbsDownIcon from '@/assets/thumbs-down.svg?react'; import ThumbUpIcon from '@/assets/thumbs-up.svg?react'; import RefreshIcon from '@/assets/refresh.svg?react'; import { PluggableList } from 'react-markdown/lib'; -import { Markdown } from './Markdown'; +import { Markdown } from '@/Markdown'; export interface SessionMessageProps { /** diff --git a/src/SessionMessages.tsx b/src/SessionMessages/SessionMessages.tsx similarity index 98% rename from src/SessionMessages.tsx rename to src/SessionMessages/SessionMessages.tsx index 5c02057..d63d08b 100644 --- a/src/SessionMessages.tsx +++ b/src/SessionMessages/SessionMessages.tsx @@ -8,7 +8,7 @@ import React, { } from 'react'; import { SessionEmpty } from './SessionEmpty'; import { SessionMessage } from './SessionMessage'; -import { SessionsContext } from './SessionsContext'; +import { SessionsContext } from '@/SessionsContext'; import { Button, cn, DateFormat, useInfinityList } from 'reablocks'; import { Slot } from '@radix-ui/react-slot'; diff --git a/src/SessionMessages/index.ts b/src/SessionMessages/index.ts new file mode 100644 index 0000000..0aac940 --- /dev/null +++ b/src/SessionMessages/index.ts @@ -0,0 +1,3 @@ +export * from './SessionEmpty'; +export * from './SessionMessage'; +export * from './SessionMessages'; diff --git a/src/Sessions.tsx b/src/Sessions.tsx index b0500ce..e1765a2 100644 --- a/src/Sessions.tsx +++ b/src/Sessions.tsx @@ -11,9 +11,6 @@ import { import { useHotkeys } from 'reakeys'; import { cn, useComponentTheme } from 'reablocks'; import { Session } from './types'; -import { SessionsList } from './SessionsList'; -import { SessionMessages } from './SessionMessages'; -import { SessionInput } from './SessionInput'; import { ChatTheme, chatTheme } from './theme'; import { SessionsContext } from './SessionsContext'; import { PluggableList } from 'react-markdown/lib'; diff --git a/src/NewSessionButton.tsx b/src/SessionsList/NewSessionButton.tsx similarity index 93% rename from src/NewSessionButton.tsx rename to src/SessionsList/NewSessionButton.tsx index a8e14e3..b998261 100644 --- a/src/NewSessionButton.tsx +++ b/src/SessionsList/NewSessionButton.tsx @@ -1,6 +1,6 @@ import { Button, cn } from 'reablocks'; import { FC, PropsWithChildren, useContext } from 'react'; -import { SessionsContext } from './SessionsContext'; +import { SessionsContext } from '@/SessionsContext'; import { Slot } from '@radix-ui/react-slot'; interface NewSessionButtonProps extends PropsWithChildren { diff --git a/src/SessionGroups.tsx b/src/SessionsList/SessionGroups.tsx similarity index 76% rename from src/SessionGroups.tsx rename to src/SessionsList/SessionGroups.tsx index bc0edf3..2128005 100644 --- a/src/SessionGroups.tsx +++ b/src/SessionsList/SessionGroups.tsx @@ -1,6 +1,6 @@ import { FC, ReactNode, useContext, useMemo } from 'react'; -import { GroupedSessions, groupSessionsByDate } from './utils'; -import { SessionsContext } from './SessionsContext'; +import { GroupedSessions, groupSessionsByDate } from '@/utils'; +import { SessionsContext } from '@/SessionsContext'; export interface SessionGroupsProps { diff --git a/src/SessionListItem.tsx b/src/SessionsList/SessionListItem.tsx similarity index 94% rename from src/SessionListItem.tsx rename to src/SessionsList/SessionListItem.tsx index 591fc34..04f7ebb 100644 --- a/src/SessionListItem.tsx +++ b/src/SessionsList/SessionListItem.tsx @@ -1,8 +1,8 @@ import { FC, ReactElement, ReactNode, useContext } from 'react'; import { ListItem, IconButton, cn, Ellipsis } from 'reablocks'; -import { Session } from './types'; +import { Session } from '@/types'; import TrashIcon from '@/assets/trash.svg?react'; -import { SessionsContext } from './SessionsContext'; +import { SessionsContext } from '@/SessionsContext'; import { Slot } from '@radix-ui/react-slot'; interface SessionListItemProps { diff --git a/src/SessionsGroup.tsx b/src/SessionsList/SessionsGroup.tsx similarity index 91% rename from src/SessionsGroup.tsx rename to src/SessionsList/SessionsGroup.tsx index 6611f76..eb3560f 100644 --- a/src/SessionsGroup.tsx +++ b/src/SessionsList/SessionsGroup.tsx @@ -1,5 +1,5 @@ import { FC, PropsWithChildren, useContext } from 'react'; -import { SessionsContext } from './SessionsContext'; +import { SessionsContext } from '@/SessionsContext'; import { ListItem, cn } from 'reablocks'; interface SessionsGroupProps extends PropsWithChildren { diff --git a/src/SessionsList.tsx b/src/SessionsList/SessionsList.tsx similarity index 84% rename from src/SessionsList.tsx rename to src/SessionsList/SessionsList.tsx index 3814446..eb236bd 100644 --- a/src/SessionsList.tsx +++ b/src/SessionsList/SessionsList.tsx @@ -1,6 +1,6 @@ import { FC, PropsWithChildren, useContext } from 'react'; import { List, cn } from 'reablocks'; -import { SessionsContext } from './SessionsContext'; +import { SessionsContext } from '@/SessionsContext'; export const SessionsList: FC = ({ children }) => { const { theme } = useContext(SessionsContext); diff --git a/src/SessionsList/index.ts b/src/SessionsList/index.ts new file mode 100644 index 0000000..e8e2073 --- /dev/null +++ b/src/SessionsList/index.ts @@ -0,0 +1,5 @@ +export * from './SessionsList'; +export * from './SessionListItem'; +export * from './NewSessionButton'; +export * from './SessionGroups'; +export * from './SessionsGroup'; diff --git a/src/index.ts b/src/index.ts index 7c52c54..9991359 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,7 @@ -export * from './NewSessionButton'; export * from './SessionInput'; export * from './SessionMessages'; export * from './Sessions'; -export * from './SessionMessage'; -export * from './SessionListItem'; export * from './SessionsList'; -export * from './SessionGroups'; -export * from './SessionsGroup'; export * from './types'; export * from './theme'; export * from './Markdown'; diff --git a/stories/Demos.stories.tsx b/stories/Demos.stories.tsx index 75111a3..f81ef58 100644 --- a/stories/Demos.stories.tsx +++ b/stories/Demos.stories.tsx @@ -11,13 +11,13 @@ import { NewSessionButton, SessionMessages, SessionMessage, + SessionGroups, SessionMessageProps, SessionInput } from '../src'; import { Card, Input } from 'reablocks'; import { subDays, subMinutes, subHours } from 'date-fns'; import { groupSessionsByDate } from '@/utils'; -import { SessionGroups } from '@/SessionGroups'; export default { title: 'Demos',