Skip to content

Commit eeec651

Browse files
refactor(toolkit): Update folder structure and cleanup assistants_web (#729)
* wip * create UI folder * layout folder * fix * layout imports * layout folder fixes * update organization * fix * import all hooks * common constants import * utils export * fixes * code feedback * code feedback --------- Co-authored-by: Khalil Najjar <[email protected]>
1 parent dbe7cf5 commit eeec651

File tree

304 files changed

+949
-2225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+949
-2225
lines changed

src/interfaces/assistants_web/.storybook/preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Preview } from '@storybook/react';
22
import { ThemeProvider } from 'next-themes';
33
import React from 'react';
44

5-
import '../src/styles/main.css';
5+
import '@/styles/main.css';
66

77
const preview: Preview = {
88
decorators: [

src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/CompleteOauth.tsx renamed to src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/OauthCallback.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
import { useParams, useRouter, useSearchParams } from 'next/navigation';
44
import { useEffect } from 'react';
55

6-
import { Text } from '@/components/Shared';
7-
import { useAuthConfig } from '@/hooks/authConfig';
8-
import { useSession } from '@/hooks/session';
6+
import { Text } from '@/components/UI';
7+
import { useAuthConfig, useSession } from '@/hooks';
98
import { getQueryString } from '@/utils';
109

1110
/**
1211
* @description This page handles callbacks from OAuth providers and forwards the request to the backend.
1312
*/
14-
const CompleteOauth: React.FC = () => {
13+
const OauthCallback: React.FC = () => {
1514
const router = useRouter();
1615
const params = useParams();
1716
const search = useSearchParams();
@@ -72,4 +71,4 @@ const CompleteOauth: React.FC = () => {
7271
);
7372
};
7473

75-
export default CompleteOauth;
74+
export default OauthCallback;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { NextPage } from 'next';
22
import { Suspense } from 'react';
33

4-
import CompleteOauth from './CompleteOauth';
4+
import OauthCallback from './OauthCallback';
55

6-
const CompleteOauthPage: NextPage = () => {
6+
const OauthCallbackPage: NextPage = () => {
77
return (
88
<Suspense>
9-
<CompleteOauth />
9+
<OauthCallback />
1010
</Suspense>
1111
);
1212
};
1313

14-
export default CompleteOauthPage;
14+
export default OauthCallbackPage;

src/interfaces/assistants_web/src/app/(auth)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WelcomePage } from '@/components/WelcomePage';
1+
import { WelcomePage } from '@/components/Auth';
22

33
const AuthLayout: React.FC<React.PropsWithChildren> = ({ children }) => {
44
return <WelcomePage>{children}</WelcomePage>;

src/interfaces/assistants_web/src/app/(auth)/login/Login.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ import { useMemo, useState } from 'react';
55
import { SubmitHandler, useForm } from 'react-hook-form';
66

77
import { CohereUnauthorizedError, ListAuthStrategy } from '@/cohere-client';
8-
import { AuthLink } from '@/components/AuthLink';
9-
import { Button, Input, Text } from '@/components/Shared';
10-
import { OidcSSOButton } from '@/components/Welcome/OidcSSOButton';
11-
import { useAuthConfig } from '@/hooks/authConfig';
12-
import { useOidcAuthRoute } from '@/hooks/oidcAuthRoute';
13-
import { useSession } from '@/hooks/session';
14-
import { useNotify } from '@/hooks/toast';
8+
import { AuthLink, OidcSSOButton } from '@/components/Auth';
9+
import { Button, Input, Text } from '@/components/UI';
10+
import { useAuthConfig, useNotify, useOidcAuthRoute, useSession } from '@/hooks';
1511
import type { NoNullProperties } from '@/types/util';
1612
import { getQueryString, simpleEmailValidation } from '@/utils';
1713

src/interfaces/assistants_web/src/app/(auth)/logout/Logout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import { useRouter } from 'next/navigation';
44
import { useEffect } from 'react';
55

6-
import { Text } from '@/components/Shared';
7-
import { useSession } from '@/hooks/session';
6+
import { Text } from '@/components/UI';
7+
import { useSession } from '@/hooks';
88

99
/**
1010
* @description The login page supports logging in with an email and password.

src/interfaces/assistants_web/src/app/(auth)/register/Register.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import { useRouter, useSearchParams } from 'next/navigation';
44
import { SubmitHandler, useForm } from 'react-hook-form';
55

6-
import { AuthLink } from '@/components/AuthLink';
7-
import { Button, Input, Text } from '@/components/Shared';
8-
import { useSession } from '@/hooks/session';
6+
import { AuthLink } from '@/components/Auth';
7+
import { Button, Input, Text } from '@/components/UI';
8+
import { useSession } from '@/hooks';
99
import { getQueryString, simpleEmailValidation } from '@/utils';
1010

1111
interface Credentials {

src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
import { useEffect } from 'react';
44

55
import { Document, ManagedTool } from '@/cohere-client';
6-
import Conversation from '@/components/Conversation';
7-
import { ConversationError } from '@/components/ConversationError';
6+
import { Conversation, ConversationError } from '@/components/Conversation';
87
import { TOOL_PYTHON_INTERPRETER_ID } from '@/constants';
9-
import { useAgent } from '@/hooks/agents';
10-
import { useConversation } from '@/hooks/conversation';
11-
import { useListTools } from '@/hooks/tools';
8+
import { useAgent, useConversation, useListTools } from '@/hooks';
129
import { useCitationsStore, useConversationStore, useParamsStore } from '@/stores';
1310
import { OutputFiles } from '@/stores/slices/citationsSlice';
14-
import { createStartEndKey, fixCitationsLeadingMarkdown, mapHistoryToMessages } from '@/utils';
15-
import { parsePythonInterpreterToolFields } from '@/utils/tools';
11+
import {
12+
createStartEndKey,
13+
fixCitationsLeadingMarkdown,
14+
mapHistoryToMessages,
15+
parsePythonInterpreterToolFields,
16+
} from '@/utils';
1617

1718
const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({
1819
agentId,

src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Spinner } from '@/components/Shared';
1+
import { Spinner } from '@/components/UI';
22

33
const Loading: React.FC<React.PropsWithChildren> = () => {
44
return (

src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Spinner } from '@/components/Shared';
1+
import { Spinner } from '@/components/UI';
22

33
const Loading: React.FC<React.PropsWithChildren> = () => {
44
return (

0 commit comments

Comments
 (0)