Skip to content

Commit

Permalink
Merge pull request #126 from Mintplex-Labs/add-alias-frontend-root
Browse files Browse the repository at this point in the history
Add alias frontend root
  • Loading branch information
timothycarambat authored Jan 24, 2024
2 parents 63501d3 + 1961994 commit 2297b55
Show file tree
Hide file tree
Showing 82 changed files with 433 additions and 425 deletions.
40 changes: 20 additions & 20 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import { lazy, Suspense } from 'react';
import { Route, Routes } from 'react-router-dom';
import { ContextWrapper } from './AuthContext';
import PrivateRoute from './components/PrivateRoute';
import AdminRoute from './components/AdminRoute';
import { ContextWrapper } from '@/AuthContext';
import PrivateRoute from '@/components/PrivateRoute';
import AdminRoute from '@/components/AdminRoute';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

import SignIn from './pages/Authentication/SignIn';
import SignUp from './pages/Authentication/SignUp';
import SignIn from '@/pages/Authentication/SignIn';
import SignUp from '@/pages/Authentication/SignUp';

const UserManagementView = lazy(() => import('./pages/UsersView'));
const OnboardingHome = lazy(() => import('./pages/Onboarding'));
const UserManagementView = lazy(() => import('@/pages/UsersView'));
const OnboardingHome = lazy(() => import('@/pages/Onboarding'));
const OrganizationSettingsView = lazy(
() => import('./pages/OrganizationSettings')
() => import('@/pages/OrganizationSettings')
);
const OrganizationDashboard = lazy(() => import('./pages/Dashboard'));
const WorkspaceDashboard = lazy(() => import('./pages/WorkspaceDashboard'));
const DocumentView = lazy(() => import('./pages/DocumentView'));
const OrganizationDashboard = lazy(() => import('@/pages/Dashboard'));
const WorkspaceDashboard = lazy(() => import('@/pages/WorkspaceDashboard'));
const DocumentView = lazy(() => import('@/pages/DocumentView'));
const OnboardingSecuritySetup = lazy(
() => import('./pages/Onboarding/security')
() => import('@/pages/Onboarding/security')
);

// Onboarding v2
const OnboardingFlow = lazy(() => import('./pages/OnboardingFlow'));
const OnboardingFlow = lazy(() => import('@/pages/OnboardingFlow'));

const OrganizationJobsView = lazy(() => import('./pages/Jobs'));
const OrganizationToolsView = lazy(() => import('./pages/Tools'));
const SystemSettingsView = lazy(() => import('./pages/SystemSettings'));
const OrganizationJobsView = lazy(() => import('@/pages/Jobs'));
const OrganizationToolsView = lazy(() => import('@/pages/Tools'));
const SystemSettingsView = lazy(() => import('@/pages/SystemSettings'));
const MigrateConnectionView = lazy(
() => import('./pages/Tools/MigrateConnection')
() => import('@/pages/Tools/MigrateConnection')
);
const ResetConnectionView = lazy(() => import('./pages/Tools/ResetConnection'));
const RAGTestingView = lazy(() => import('./pages/Tools/RAGTesting'));
const ResetConnectionView = lazy(() => import('@/pages/Tools/ResetConnection'));
const RAGTestingView = lazy(() => import('@/pages/Tools/RAGTesting'));
const RAGDriftTestRunsView = lazy(
() => import('./pages/Tools/RAGTesting/RecentRuns')
() => import('@/pages/Tools/RAGTesting/RecentRuns')
);

function App() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/AuthContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, createContext } from 'react';
import { STORE_TOKEN, STORE_USER } from './utils/constants';
import { STORE_TOKEN, STORE_USER } from '@/utils/constants';

export const AuthContext = createContext(null);
export function ContextWrapper(props: any) {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/AdminRoute/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react';
import { Navigate } from 'react-router-dom';
import { FullScreenLoader } from '../Preloader';
import validateSessionTokenForUser from '../../utils/session';
import paths from '../../utils/paths';
import { STORE_TOKEN, STORE_USER } from '../../utils/constants';
import { FullScreenLoader } from '@/components/Preloader';
import validateSessionTokenForUser from '@/utils/session';
import { STORE_TOKEN, STORE_USER } from '@/utils/constants';
import paths from '@/utils/paths';

function useIsAuthenticated() {
const [isAuthd, setIsAuthed] = useState<Boolean | null>(null);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/DocumentPaginator/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CaretDown } from '@phosphor-icons/react';
import { numberWithCommas } from '../../utils/numbers';
import { numberWithCommas } from '@/utils/numbers';

function generatePageItems(total: number, current: number) {
if (total <= 1) return [];
Expand Down
15 changes: 7 additions & 8 deletions frontend/src/components/Modals/NewConnectorModal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { useState, memo } from 'react';
import Organization from '../../models/organization';
import PreLoader from '../Preloader';

import ChromaLogo from '../../images/vectordbs/chroma.png';
import PineconeLogoInverted from '../../images/vectordbs/pinecone-inverted.png';
import qDrantLogo from '../../images/vectordbs/qdrant.png';
import WeaviateLogo from '../../images/vectordbs/weaviate.png';
import { APP_NAME } from '../../utils/constants';
import PreLoader from '@/components/Preloader';
import ChromaLogo from '@/images/vectordbs/chroma.png';
import PineconeLogoInverted from '@/images/vectordbs/pinecone-inverted.png';
import qDrantLogo from '@/images/vectordbs/qdrant.png';
import WeaviateLogo from '@/images/vectordbs/weaviate.png';
import { APP_NAME } from '@/utils/constants';
import Organization from '@/models/organization';
const NewConnectorModal = memo(
({
organization,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Modals/SyncConnectorModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, memo } from 'react';
import Organization from '../../models/organization';
import Organization from '@/models/organization';
import paths from '@/utils/paths';
import { titleCase } from 'title-case';
import paths from '../../utils/paths';

const SyncConnectorModal = memo(
({ organization, connector }: { organization: any; connector: any }) => {
Expand Down
13 changes: 6 additions & 7 deletions frontend/src/components/Modals/UpdateConnectorModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useState, memo } from 'react';
import Organization from '../../models/organization';
import PreLoader from '../Preloader';

import ChromaLogo from '../../images/vectordbs/chroma.png';
import PineconeLogoInverted from '../../images/vectordbs/pinecone-inverted.png';
import qDrantLogo from '../../images/vectordbs/qdrant.png';
import WeaviateLogo from '../../images/vectordbs/weaviate.png';
import Organization from '@/models/organization';
import PreLoader from '@/components/Preloader';
import ChromaLogo from '@/images/vectordbs/chroma.png';
import PineconeLogoInverted from '@/images/vectordbs/pinecone-inverted.png';
import qDrantLogo from '@/images/vectordbs/qdrant.png';
import WeaviateLogo from '@/images/vectordbs/weaviate.png';

const UpdateConnectorModal = memo(
({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useEffect, memo } from 'react';
import Workspace from '../../../../models/workspace';
import Workspace from '@/models/workspace';
import truncate from 'truncate';
import { humanFileSize, milliToHms } from '../../../../utils/numbers';
import { humanFileSize, milliToHms } from '@/utils/numbers';
import { CheckCircle, XCircle } from 'react-feather';
import { Grid } from 'react-loading-icons';

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Modals/UploadDocumentModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useCallback, useState, useEffect, ReactNode } from 'react';
import { APP_NAME } from '../../../utils/constants';
import { useDropzone } from 'react-dropzone';
import { v4 } from 'uuid';
import System from '../../../models/system';
import FileUploadProgress from './FileUploadProgress';
import { useParams } from 'react-router-dom';
import { SmileySad } from '@phosphor-icons/react';
import System from '@/models/system';
import { APP_NAME } from '@/utils/constants';
import FileUploadProgress from './FileUploadProgress';

export default function UploadDocumentModal({
workspaces,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Modals/UploadModalNoKey.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AlertTriangle } from 'react-feather';
import { APP_NAME } from '../../utils/constants';
import System from '../../models/system';
import { ReactNode } from 'react';
import { APP_NAME } from '@/utils/constants';
import System from '@/models/system';

export default function UploadModalNoKey() {
const updateSystemSetting = async (e: any) => {
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/Notifications/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ReactNode, useEffect, useRef, useState } from 'react';
import { useParams } from 'react-router-dom';
import Organization from '../../models/organization';
import { databaseTimestampFromNow } from '../../utils/data';
import ChromaLogo from '../../images/vectordbs/chroma.png';
import PineconeLogo from '../../images/vectordbs/pinecone-inverted.png';
import qDrantLogo from '../../images/vectordbs/qdrant.png';
import WeaviateLogo from '../../images/vectordbs/weaviate.png';
import Organization from '@/models/organization';
import { databaseTimestampFromNow } from '@/utils/data';
import ChromaLogo from '@/images/vectordbs/chroma.png';
import PineconeLogo from '@/images/vectordbs/pinecone-inverted.png';
import qDrantLogo from '@/images/vectordbs/qdrant.png';
import WeaviateLogo from '@/images/vectordbs/weaviate.png';
import { Bell, Info, Warning, WarningOctagon } from '@phosphor-icons/react';

const POLLING_INTERVAL = 30_000;
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/PrivateRoute/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react';
import { Navigate } from 'react-router-dom';
import { FullScreenLoader } from '../Preloader';
import validateSessionTokenForUser from '../../utils/session';
import paths from '../../utils/paths';
import { STORE_TOKEN, STORE_USER } from '../../utils/constants';
import { FullScreenLoader } from '@/components/Preloader';
import validateSessionTokenForUser from '@/utils/session';
import paths from '@/utils/paths';
import { STORE_TOKEN, STORE_USER } from '@/utils/constants';

function useIsAuthenticated() {
const [isAuthd, setIsAuthed] = useState<Boolean | null>(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import paths from '../../../utils/paths';
import Organization from '../../../models/organization';
import PreLoader from '../../Preloader';
import paths from '@/utils/paths';
import Organization from '@/models/organization';
import PreLoader from '@/components/Preloader';

export default function CreateOrganizationModal() {
const [loading, setLoading] = useState(false);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Sidebar/OrganizationTab/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { NavLink, useParams } from 'react-router-dom';
import { useEffect, useState } from 'react';
import paths from '../../../utils/paths';
import paths from '@/utils/paths';
import { CaretDown, Plus, MagnifyingGlass } from '@phosphor-icons/react';
import truncate from 'truncate';
import Organization from '../../../models/organization';
import Organization from '@/models/organization';
import { debounce } from 'lodash';
import InfiniteScroll from 'react-infinite-scroll-component';
import CreateWorkspaceModal from '../../../pages/Dashboard/WorkspacesList/CreateWorkspaceModal';
import CreateWorkspaceModal from '@/pages/Dashboard/WorkspacesList/CreateWorkspaceModal';

type OrganizationTabProps = {
organization: any;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Sidebar/WorkspaceSearch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { NavLink, useParams } from 'react-router-dom';
import paths from '../../../utils/paths';
import Organization from '../../../models/organization';
import paths from '@/utils/paths';
import Organization from '@/models/organization';
import { debounce } from 'lodash';
import truncate from 'truncate';

Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useEffect, useRef, useState } from 'react';
import { NavLink, useLocation, useParams } from 'react-router-dom';
import LogoSky from '../../images/logo/logo-sky.svg';
import SidebarLinkGroup from '../SidebarLinkGroup';
import paths from '../../utils/paths';
import useUser from '../../hooks/useUser';
import LogoSky from '@/images/logo/logo-sky.svg';
import SidebarLinkGroup from '@/components/SidebarLinkGroup';
import paths from '@/utils/paths';
import useUser from '@/hooks/useUser';
import CreateOrganizationModal from './CreateOrganizationModal';
import OrganizationTab from './OrganizationTab';
import { SquaresFour, Plus } from '@phosphor-icons/react';
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/UserMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useRef, useEffect } from 'react';
import useUser from '../../hooks/useUser';
import paths from '../../utils/paths';
import { STORE_TOKEN, STORE_USER } from '../../utils/constants';
import useUser from '@/hooks/useUser';
import paths from '@/utils/paths';
import { STORE_TOKEN, STORE_USER } from '@/utils/constants';

export default function UserMenu() {
const { user } = useUser();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useUser.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext } from 'react';
import { AuthContext } from '../AuthContext';
import { AuthContext } from '@/AuthContext';

interface IContext {
store: {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/layout/AppLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ReactNode, useState } from 'react';
import Header from '../components/Header';
import Sidebar from '../components/Sidebar';
import Notifications from '../components/Notifications';
import UserMenu from '../components/UserMenu';
import Header from '@/components/Header';
import Sidebar from '@/components/Sidebar';
import Notifications from '@/components/Notifications';
import UserMenu from '@/components/UserMenu';

interface DefaultLayoutProps {
headerEntity: any;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ReactDOM from 'react-dom/client';
import { BrowserRouter as Router } from 'react-router-dom';
import App from './App';
import './index.css';
import App from '@/App';
import '@/index.css';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<Router>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/models/document.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_BASE, ISearchTypes } from '../utils/constants';
import { baseHeaders, getAPIUrlString } from '../utils/request';
import { API_BASE, ISearchTypes } from '@/utils/constants';
import { baseHeaders, getAPIUrlString } from '@/utils/request';

const Document = {
get: async (id: string | number) => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/models/jobs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_BASE } from '../utils/constants';
import { baseHeaders } from '../utils/request';
import { API_BASE } from '@/utils/constants';
import { baseHeaders } from '@/utils/request';

const Jobs = {
kill: async (jobId: number) => {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/models/organization.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { INotification } from '../components/Notifications';
import { API_BASE } from '../utils/constants';
import { baseHeaders, getAPIUrlString } from '../utils/request';
import { INotification } from '@/components/Notifications';
import { API_BASE } from '@/utils/constants';
import { baseHeaders, getAPIUrlString } from '@/utils/request';

const Organization = {
documentPageSize: 10,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/models/system.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_BASE } from '../utils/constants';
import { baseHeaders } from '../utils/request';
import { API_BASE } from '@/utils/constants';
import { baseHeaders } from '@/utils/request';

const System = {
hasSetting: async (
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/models/tools.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_BASE } from '../utils/constants';
import { baseHeaders } from '../utils/request';
import { API_BASE } from '@/utils/constants';
import { baseHeaders } from '@/utils/request';
import { IOrganization } from './organization';
import { IWorkspace } from './workspace';

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/models/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_BASE, COMPLETE_ONBOARDING } from '../utils/constants';
import { baseHeaders } from '../utils/request';
import { API_BASE, COMPLETE_ONBOARDING } from '@/utils/constants';
import { baseHeaders } from '@/utils/request';

const User = {
autoOnboard: async (): Promise<{
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/models/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_BASE, ISearchTypes } from '../utils/constants';
import { baseHeaders, getAPIUrlString } from '../utils/request';
import { API_BASE, ISearchTypes } from '@/utils/constants';
import { baseHeaders, getAPIUrlString } from '@/utils/request';

const Workspace = {
documentPageSize: 10,
Expand Down
15 changes: 7 additions & 8 deletions frontend/src/pages/Authentication/SignIn.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Link } from 'react-router-dom';
import DefaultLayout from '../../layout/DefaultLayout';
import SignInImg from '../../images/undraws/sign-in.png';
import PreLoader from '../../components/Preloader';
import DefaultLayout from '@/layout/DefaultLayout';
import SignInImg from '@/images/undraws/sign-in.png';
import PreLoader from '@/components/Preloader';
import { useEffect, useState } from 'react';
import { CheckCircle, XCircle } from 'react-feather';
import User from '../../models/user';
import { APP_NAME, STORE_TOKEN, STORE_USER } from '../../utils/constants';
import paths from '../../utils/paths';
import validateSessionTokenForUser from '../../utils/session';
import System from '../../models/system';
import User from '@/models/user';
import { APP_NAME, STORE_TOKEN, STORE_USER } from '@/utils/constants';
import paths from '@/utils/paths';
import validateSessionTokenForUser from '@/utils/session';

type IStages = 'loading' | 'failed' | 'success' | 'ready';
type FormTypes = {
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/pages/Authentication/SignUp.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Link } from 'react-router-dom';
import SignInImg from '../../images/undraws/sign-in.png';
import DefaultLayout from '../../layout/DefaultLayout';
import SignInImg from '@/images/undraws/sign-in.png';
import DefaultLayout from '@/layout/DefaultLayout';
import { useState } from 'react';
import PreLoader from '../../components/Preloader';
import PreLoader from '@/components/Preloader';
import { CheckCircle, XCircle } from 'react-feather';
import User from '../../models/user';
import { APP_NAME, STORE_TOKEN, STORE_USER } from '../../utils/constants';
import paths from '../../utils/paths';
import User from '@/models/user';
import { APP_NAME, STORE_TOKEN, STORE_USER } from '@/utils/constants';
import paths from '@/utils/paths';

type IStages = 'loading' | 'failed' | 'success' | 'ready';
type FormTypes = {
Expand Down
Loading

0 comments on commit 2297b55

Please sign in to comment.