Skip to content

Commit

Permalink
removed react-components empty package
Browse files Browse the repository at this point in the history
- also sorted the the react-component components into the right folders
- fixed components that returned an array of elements instead of a JSX element
  • Loading branch information
tpatel committed Mar 19, 2024
1 parent 6894cc0 commit f1e1333
Show file tree
Hide file tree
Showing 26 changed files with 66 additions and 6,324 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/src/components/atoms/elements/File.tsx
@@ -1,6 +1,6 @@
import Link from '@mui/material/Link';

import { Attachment } from 'components/molecules/react-components/Attachment';
import { Attachment } from 'components/atoms/Attachment';

import { type IFileElement } from 'client-types/';

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/atoms/elements/Text.tsx
@@ -1,6 +1,6 @@
import Box from '@mui/material/Box';

import { Markdown } from 'components/molecules/react-components/Markdown';
import { Markdown } from 'components/molecules/Markdown';

import { useFetch } from 'hooks/useFetch';

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/atoms/inputs/InputLabel.tsx
Expand Up @@ -3,7 +3,7 @@ import Box from '@mui/material/Box';
import MInputLabel from '@mui/material/InputLabel';
import Tooltip from '@mui/material/Tooltip';

import { NotificationCount } from 'components/molecules/react-components/NotificationCount';
import { NotificationCount } from 'components/molecules/messages/components/NotificationCount';

import { NotificationCountProps } from 'types/NotificationCount';

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/atoms/inputs/selects/MenuItem.tsx
Expand Up @@ -3,7 +3,7 @@ import { grey, primary } from 'theme/index';
import MMenuItem from '@mui/material/MenuItem';
import Stack from '@mui/material/Stack';

import { NotificationCount } from 'components/molecules/react-components/NotificationCount';
import { NotificationCount } from 'components/molecules/messages/components/NotificationCount';

import { SelectItem } from './SelectInput';

Expand Down
Expand Up @@ -10,7 +10,7 @@ import { useIsDarkMode } from 'hooks/useIsDarkMode';

import 'highlight.js/styles/monokai-sublime.css';

import { ClipboardCopy } from './ClipboardCopy';
import { ClipboardCopy } from '../atoms/ClipboardCopy';

const CodeSnippet = ({
language,
Expand Down
Expand Up @@ -16,12 +16,12 @@ import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';

import { Code } from 'components/molecules/Code';
import { ElementRef } from 'components/molecules/messages/components/ElementRef';
import { Code } from 'components/molecules/react-components/Code';

import type { IMessageElement } from 'client-types/';

import { InlineCode } from './InlineCode';
import { InlineCode } from '../atoms/InlineCode';

interface Props {
allowHtml?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/molecules/attachments.tsx
Expand Up @@ -6,9 +6,9 @@ import IconButton from '@mui/material/IconButton';
import Stack from '@mui/material/Stack';
import Tooltip from '@mui/material/Tooltip';

import { Attachment } from 'components/atoms/Attachment';
import CircularProgressIconButton from 'components/atoms/buttons/progressIconButton';
import { Translator } from 'components/i18n';
import { Attachment } from 'components/molecules/react-components/Attachment';

import { attachmentsState } from 'state/chat';

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/molecules/chatProfiles.tsx
Expand Up @@ -12,7 +12,7 @@ import {
} from '@chainlit/react-client';

import { InputStateHandler } from 'components/atoms/inputs';
import { Markdown } from 'components/molecules/react-components/Markdown';
import { Markdown } from 'components/molecules/Markdown';

import { useIsDarkMode } from 'hooks/useIsDarkMode';

Expand Down
Expand Up @@ -11,9 +11,9 @@ import IconButton from '@mui/material/IconButton';
import Stack from '@mui/material/Stack';
import Tooltip from '@mui/material/Tooltip';

import Dialog from 'components/atoms/Dialog';
import { AccentButton } from 'components/atoms/buttons/AccentButton';
import { TextInput } from 'components/atoms/inputs';
import Dialog from 'components/molecules/react-components/Dialog';

import type { IStep } from 'client-types/';

Expand Down
Expand Up @@ -4,7 +4,7 @@ import { grey } from 'theme/palette';

import Stack from '@mui/material/Stack';

import { ClipboardCopy } from 'components/molecules/react-components/ClipboardCopy';
import { ClipboardCopy } from 'components/atoms/ClipboardCopy';

import { useIsDarkMode } from 'hooks/useIsDarkMode';

Expand Down
Expand Up @@ -6,9 +6,9 @@ import Divider from '@mui/material/Divider';
import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';

import { Collapse } from 'components/atoms/Collapse';
import { InlinedElements } from 'components/atoms/elements/InlinedElements';
import { Collapse } from 'components/molecules/react-components/Collapse';
import { Markdown } from 'components/molecules/react-components/Markdown';
import { Markdown } from 'components/molecules/Markdown';

import type { IMessageElement, IStep } from 'client-types/';

Expand Down
Expand Up @@ -6,7 +6,7 @@ import Stack, { StackProps } from '@mui/material/Stack';
import Typography from '@mui/material/Typography';
import { Theme, useTheme } from '@mui/material/styles';

import { ClipboardCopy } from 'components/molecules/react-components/ClipboardCopy';
import { ClipboardCopy } from 'components/atoms/ClipboardCopy';

interface Props {
className?: string;
Expand Down
Expand Up @@ -2,7 +2,7 @@ import { memo } from 'react';

import { Box } from '@mui/material';

import { Markdown } from 'components/molecules/react-components/Markdown';
import { Markdown } from 'components/molecules/Markdown';

const WelcomeScreen = memo(
({
Expand Down
54 changes: 29 additions & 25 deletions frontend/src/components/organisms/threadHistory/Thread.tsx
Expand Up @@ -73,31 +73,35 @@ const Thread = ({ thread, error, isLoading }: Props) => {
);

if (isLoading) {
return [1, 2, 3].map((index) => (
<Stack
key={`thread-skeleton-${index}`}
sx={{
px: 2,
gap: 4,
mt: 5,
flexDirection: 'row',
justifyContent: 'center'
}}
>
<Stack>
<Skeleton width={50} />
<Skeleton width={50} />
</Stack>
<Skeleton
variant="rounded"
sx={{
maxWidth: '60rem',
width: '100%',
height: 100
}}
/>
</Stack>
));
return (
<>
{[1, 2, 3].map((index) => (
<Stack
key={`thread-skeleton-${index}`}
sx={{
px: 2,
gap: 4,
mt: 5,
flexDirection: 'row',
justifyContent: 'center'
}}
>
<Stack>
<Skeleton width={50} />
<Skeleton width={50} />
</Stack>
<Skeleton
variant="rounded"
sx={{
maxWidth: '60rem',
width: '100%',
height: 100
}}
/>
</Stack>
))}
</>
);
}

if (!thread || error) {
Expand Down
Expand Up @@ -43,25 +43,29 @@ const ThreadList = ({
const { clear } = useChatInteract();
const navigate = useNavigate();
if (isFetching || (!threadHistory?.timeGroupedThreads && isLoadingMore)) {
return [1, 2, 3].map((index) => (
<Box key={`threads-skeleton-${index}`} sx={{ px: 1.5, mt: 2 }}>
<Skeleton width={100} />
{[1, 2].map((childIndex) => (
<Stack
key={`threads-skeleton-${index}-${childIndex}`}
sx={{
py: 2,
flexDirection: 'row',
alignItems: 'center',
gap: 1.5
}}
>
<Skeleton width={30} />
<Skeleton width={'100%'} />
</Stack>
return (
<>
{[1, 2, 3].map((index) => (
<Box key={`threads-skeleton-${index}`} sx={{ px: 1.5, mt: 2 }}>
<Skeleton width={100} />
{[1, 2].map((childIndex) => (
<Stack
key={`threads-skeleton-${index}-${childIndex}`}
sx={{
py: 2,
flexDirection: 'row',
alignItems: 'center',
gap: 1.5
}}
>
<Skeleton width={30} />
<Skeleton width={'100%'} />
</Stack>
))}
</Box>
))}
</Box>
));
</>
);
}

if (error) {
Expand Down
1 change: 0 additions & 1 deletion libs/react-components/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions libs/react-components/README.md

This file was deleted.

76 changes: 0 additions & 76 deletions libs/react-components/package.json

This file was deleted.

0 comments on commit f1e1333

Please sign in to comment.