Skip to content

Commit

Permalink
fix: move settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkothari22 committed Dec 7, 2024
1 parent 5ce5f0a commit 9338190
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 68 deletions.
103 changes: 52 additions & 51 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,63 +37,64 @@ const router = createBrowserRouter(
<Route path="/" element={<WorkspaceSwitcher />}>
<Route index element={<WorkspaceSwitcherGrid />} />
<Route path="workspace-explorer" element={<WorkspaceSwitcherGrid />} />
<Route path="settings" lazy={() => import('./pages/settings/Settings')}>
<Route index lazy={() => import('./components/feature/userSettings/UserProfile/UserProfile')} />
<Route path="profile" lazy={() => import('./components/feature/userSettings/UserProfile/UserProfile')} />
<Route path="users" lazy={() => import('./pages/settings/Users/UserList')} />
<Route path="appearance" lazy={() => import('./pages/settings/Appearance')} />
<Route path="hr" lazy={() => import('./pages/settings/Integrations/FrappeHR')} />
<Route path="bots" >
<Route index lazy={() => import('./pages/settings/AI/BotList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateBot')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewBot')} />
</Route>

<Route path="functions">
<Route index lazy={() => import('./pages/settings/AI/FunctionList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateFunction')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewFunction')} />
</Route>


<Route path="instructions">
<Route index lazy={() => import('./pages/settings/AI/InstructionTemplateList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateInstructionTemplate')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewInstructionTemplate')} />
</Route>

<Route path="commands">
<Route index lazy={() => import('./pages/settings/AI/SavedPromptsList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateSavedPrompt')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewSavedPrompt')} />
</Route>

<Route path="openai-settings" lazy={() => import('./pages/settings/AI/OpenAISettings')} />

<Route path="webhooks">
<Route index lazy={() => import('./pages/settings/Webhooks/WebhookList')} />
<Route path="create" lazy={() => import('./pages/settings/Webhooks/CreateWebhook')} />
<Route path=":ID" lazy={() => import('./pages/settings/Webhooks/ViewWebhook')} />
</Route>

<Route path="scheduled-messages">
<Route index lazy={() => import('./pages/settings/ServerScripts/SchedulerEvents/SchedulerEvents')} />
<Route path="create" lazy={() => import('./pages/settings/ServerScripts/SchedulerEvents/CreateSchedulerEvent')} />
<Route path=":ID" lazy={() => import('./pages/settings/ServerScripts/SchedulerEvents/ViewSchedulerEvent')} />
</Route>

<Route path="message-actions">
<Route index lazy={() => import('./pages/settings/MessageActions/MessageActionList')} />
<Route path="create" lazy={() => import('./pages/settings/MessageActions/CreateMessageAction')} />
<Route path=":ID" lazy={() => import('./pages/settings/MessageActions/ViewMessageAction')} />
</Route>
</Route>
<Route path=":workspaceID" element={<MainPage />}>
<Route index element={<MobileTabsPage />} />
<Route path="threads" lazy={() => import('./components/feature/threads/Threads')}>
<Route path="thread/:threadID" lazy={() => import('./components/feature/threads/ThreadDrawer/ThreadDrawer')} />
</Route>
<Route path="saved-messages" lazy={() => import('./components/feature/saved-messages/SavedMessages')} />
<Route path="settings" lazy={() => import('./pages/settings/Settings')}>
<Route index lazy={() => import('./components/feature/userSettings/UserProfile/UserProfile')} />
<Route path="profile" lazy={() => import('./components/feature/userSettings/UserProfile/UserProfile')} />
<Route path="users" lazy={() => import('./pages/settings/Users/UserList')} />
<Route path="appearance" lazy={() => import('./pages/settings/Appearance')} />
<Route path="hr" lazy={() => import('./pages/settings/Integrations/FrappeHR')} />
<Route path="bots" >
<Route index lazy={() => import('./pages/settings/AI/BotList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateBot')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewBot')} />
</Route>

<Route path="functions">
<Route index lazy={() => import('./pages/settings/AI/FunctionList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateFunction')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewFunction')} />
</Route>


<Route path="instructions">
<Route index lazy={() => import('./pages/settings/AI/InstructionTemplateList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateInstructionTemplate')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewInstructionTemplate')} />
</Route>

<Route path="commands">
<Route index lazy={() => import('./pages/settings/AI/SavedPromptsList')} />
<Route path="create" lazy={() => import('./pages/settings/AI/CreateSavedPrompt')} />
<Route path=":ID" lazy={() => import('./pages/settings/AI/ViewSavedPrompt')} />
</Route>

<Route path="openai-settings" lazy={() => import('./pages/settings/AI/OpenAISettings')} />

<Route path="webhooks">
<Route index lazy={() => import('./pages/settings/Webhooks/WebhookList')} />
<Route path="create" lazy={() => import('./pages/settings/Webhooks/CreateWebhook')} />
<Route path=":ID" lazy={() => import('./pages/settings/Webhooks/ViewWebhook')} />
</Route>

<Route path="scheduled-messages">
<Route index lazy={() => import('./pages/settings/ServerScripts/SchedulerEvents/SchedulerEvents')} />
<Route path="create" lazy={() => import('./pages/settings/ServerScripts/SchedulerEvents/CreateSchedulerEvent')} />
<Route path=":ID" lazy={() => import('./pages/settings/ServerScripts/SchedulerEvents/ViewSchedulerEvent')} />
</Route>

<Route path="message-actions">
<Route index lazy={() => import('./pages/settings/MessageActions/MessageActionList')} />
<Route path="create" lazy={() => import('./pages/settings/MessageActions/CreateMessageAction')} />
<Route path=":ID" lazy={() => import('./pages/settings/MessageActions/ViewMessageAction')} />
</Route>
</Route>

<Route path=":channelID" lazy={() => import('@/pages/ChatSpace')}>
<Route path="thread/:threadID" lazy={() => import('./components/feature/threads/ThreadDrawer/ThreadDrawer')} />
</Route>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/layout/Sidebar/SidebarFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const SidebarFooter = () => {
</Box>
<Box>
<Tooltip content="Settings" side='right'>
<IconButton aria-label='Settings' size='4' color='gray' variant='ghost' onClick={() => navigate('/channel/settings/profile')}>
<IconButton aria-label='Settings' size='4' color='gray' variant='ghost' onClick={() => navigate('/settings/profile')}>
<SlSettings size='18' />
</IconButton>
</Tooltip>
Expand All @@ -52,7 +52,7 @@ export const SidebarFooter = () => {
<UserAvatar
src={myProfile?.user_image}
alt={myProfile?.full_name}
size='3'
size='2'
className='hover:shadow-sm transition-all duration-200'
availabilityStatus={myProfile?.availability_status}
isActive={isActive} />
Expand Down
47 changes: 32 additions & 15 deletions frontend/src/pages/settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
import { SettingsSidebar } from '@/components/feature/userSettings/SettingsSidebar'
import { PageHeader } from '@/components/layout/Heading/PageHeader'
import { useIsDesktop } from '@/hooks/useMediaQuery'
import { ChannelListProvider } from '@/utils/channel/ChannelListProvider'
import { __ } from '@/utils/translations'
import { UserListProvider } from '@/utils/users/UserListProvider'
import { Box, Flex, Heading } from '@radix-ui/themes'
import { BiChevronLeft } from 'react-icons/bi'
import { Link } from 'react-router-dom'
import { Outlet } from "react-router-dom"

const Settings = () => {
const isDesktop = useIsDesktop()

const lastWorkspace = localStorage.getItem('ravenLastWorkspace')
const lastChannel = localStorage.getItem('ravenLastChannel')

let path = '../'

if (lastWorkspace && lastChannel) {
path = `/${lastWorkspace}/${lastChannel}`
} else if (lastWorkspace) {
path = `/${lastWorkspace}`
}


return (
<>
<PageHeader>
<Flex align='center' gap='3' className="h-8">
<Link to='/channel' className="block bg-transparent hover:bg-transparent active:bg-transparent sm:hidden">
<BiChevronLeft size='24' className="block text-gray-12" />
</Link>
<Heading size='5'>{__("Settings")}</Heading>
<UserListProvider>
<ChannelListProvider>
<PageHeader>
<Flex align='center' gap='3' className="h-8">
<Link to={path} className="block bg-transparent hover:bg-transparent active:bg-transparent">
<BiChevronLeft size='24' className="block text-gray-12" />
</Link>
<Heading size='5'>{__("Settings")}</Heading>
</Flex>
</PageHeader>
<Flex className="min-h-screen pt-16 w-full">
{isDesktop && <SettingsSidebar />}
<Box className="w-full">
<Outlet />
</Box>
</Flex>
</PageHeader>
<Flex className="min-h-screen pt-16 w-full">
{isDesktop && <SettingsSidebar />}
<Box className="w-full">
<Outlet />
</Box>
</Flex>
</>
</ChannelListProvider>
</UserListProvider>
)
}

Expand Down

0 comments on commit 9338190

Please sign in to comment.